]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ufs_trunc_branch(): massage towards killing recursion
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 18 Jun 2015 21:23:34 +0000 (17:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 6 Jul 2015 21:39:46 +0000 (17:39 -0400)
We always have 0 < depth2 <= depth in there, so
if (--depth) {
if (--depth2)
A
B
} else {
C // not using depth2
}
D // not using depth2

is equivalent to

if (--depth2)
A with s/depth/depth - 1/
if (--depth)
B
else
C
D

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ufs/inode.c

index c06556558c9b9780871b30c4d04c6a4638b6c7dc..dac81c318da71f4ca590f42d5a6990e67d72aa59 100644 (file)
@@ -1145,12 +1145,12 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2,
                return;
        }
 
+       if (--depth2) {
+               void *ind = ubh_get_data_ptr(uspi, ubh, from++);
+               ufs_trunc_branch(inode, offsets, depth2, depth - 1, ind);
+               ubh_mark_buffer_dirty(ubh);
+       }
        if (--depth) {
-               if (--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);
                        free_full_branch(inode, depth, ind);