summaryrefslogtreecommitdiff
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorGabriel Niebler <gniebler@suse.com>2022-03-09 16:50:38 +0300
committerDavid Sterba <dsterba@suse.com>2022-05-16 18:03:07 +0300
commit62142be363ae902c948729eeb35851ddf34b317d (patch)
tree4eb2dc666a801f98b6a015e7b1b0b37bd14f9e5e /fs/btrfs/dev-replace.c
parente360d2f5810434d44ee61b47437ecd5e66528a5a (diff)
downloadlinux-62142be363ae902c948729eeb35851ddf34b317d.tar.xz
btrfs: introduce btrfs_for_each_slot iterator macro
There is a common pattern when searching for a key in btrfs: * Call btrfs_search_slot to find the slot for the key * Enter an endless loop: * If the found slot is larger than the no. of items in the current leaf, check the next leaf * If it's still not found in the next leaf, terminate the loop * Otherwise do something with the found key * Increment the current slot and continue To reduce code duplication, we can replace this code pattern with an iterator macro, similar to the existing for_each_X macros found elsewhere in the kernel. This also makes the code easier to understand for newcomers by putting a name to the encapsulated functionality. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Signed-off-by: Gabriel Niebler <gniebler@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
0 files changed, 0 insertions, 0 deletions