btrfs: eliminate if in main loop in tree_search_offset
PATCH 1/1 btrfs: eliminate if in main loop in tree_search_offset
Reshuffle the code inside the first loop of tree_search_offset so that one if() is eliminated and the becomes more linear.
--- fs/btrfs/free-space-cache.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/btrfs/free-space-cache.c +3 -6
@@ -1595,12 +1595,7 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,struct btrfs_free_space *entry, *prev =NULL ;/* find entry that is closest to the 'offset' */ -while (1 ) { -if (!n) { - entry =NULL ; -break ; - } - +while (n) { entry = rb_entry(n, struct btrfs_free_space, offset_index); prev = entry;
@@ -1610,6 +1605,8 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl, n = n->rb_right; else break; + + entry =NULL ; }if (bitmap_only) {
Signature · 1 line
2.17.1
Quoted 2 lines · Nikolay Borisov
Reshuffle the code inside the first loop of
tree_search_offsetso that oneif()is eliminated and the becomes more linear.
Need a SOB and you need to set entry = NULL initially if you're going to make this change. Thanks,
Josef
Quoted 6 lines · Josef Bacik
Quoted 2 lines · Nikolay Borisov
Reshuffle the code inside the first loop of
tree_search_offsetso that oneif()is eliminated and the becomes more linear.Need a SOB and you need to set entry = NULL initially if you're going to make this change. Thanks,
Doh, I had it set before nuking the work via git checkout and on the 2nd try I forgot....
Quoted 3 lines
Josef