]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ufs_trunc_branch(): separate the calls with non-NULL offsets
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 18 Jun 2015 20:13:56 +0000 (16:13 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 6 Jul 2015 21:39:43 +0000 (17:39 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ufs/inode.c

index 9e409c12afdfad17fa1aff57c3ac11f357f05c08..480c34ee180599a2eee40292ac78e2ee352872af 100644 (file)
@@ -1091,13 +1091,16 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2,
        }
 
        if (--depth) {
-               if (!--depth2)
-                       offsets = NULL;
-               for (i = from ; i < uspi->s_apb ; i++, offsets = NULL) {
-                       void *ind = ubh_get_data_ptr(uspi, ubh, i);
+               if (offsets && --depth2) {
+                       void *ind = ubh_get_data_ptr(uspi, ubh, from++);
                        ufs_trunc_branch(inode, offsets, depth2, depth, ind);
                        ubh_mark_buffer_dirty(ubh);
                }
+               for (i = from ; i < uspi->s_apb ; i++) {
+                       void *ind = ubh_get_data_ptr(uspi, ubh, i);
+                       ufs_trunc_branch(inode, NULL, 0, depth, ind);
+                       ubh_mark_buffer_dirty(ubh);
+               }
        } else {
                u64 frag_to_free = 0;
                unsigned free_count = 0;