]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: use btrfs_next_leaf instead of btrfs_next_item when slots > nritems
authorMarcos Paulo de Souza <mpdesouza@suse.com>
Tue, 13 Jul 2021 13:58:03 +0000 (10:58 -0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Aug 2021 11:19:01 +0000 (13:19 +0200)
commitd37214d9ecc4dbafb0b9104ccb828c8ce4fe6d36
treece8bfefc86aea7de9db84027408190b38f1a8bc7
parentf6ae469b5bbfc6d65bcae1c9338378889fb523c5
btrfs: use btrfs_next_leaf instead of btrfs_next_item when slots > nritems

After calling btrfs_search_slot is a common practice to check if the
slot found isn't bigger than number of slots in the current leaf, and if
so, search for the same key in the next leaf by calling btrfs_next_leaf,
which calls btrfs_next_old_leaf to do the job.

Calling btrfs_next_item in the same situation would end up in the same
code flow, since

* btrfs_next_item
  * btrfs_next_old_item
    * if slot >= nritems(curr_leaf)
      btrfs_next_old_leaf

Change btrfs_verify_dev_extents and calculate_emulated_zone_size
functions to use btrfs_next_leaf in the same situation.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c
fs/btrfs/zoned.c