]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: scrub: refactor scrub_find_csum()
authorQu Wenruo <wqu@suse.com>
Tue, 3 Nov 2020 13:31:04 +0000 (21:31 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:54:05 +0000 (15:54 +0100)
commitc9ab5d8410249dfb383dfbf1c8f21354898c09f3
treed81465488070407b1c59a28fdd137e2d57374c56
parentaae3c8dba66d1671cf21f3ed36ad6ee00b9cc2ad
btrfs: scrub: refactor scrub_find_csum()

Function scrub_find_csum() is to locate the csum for bytenr @logical
from sctx->csum_list.

However it lacks a lot of comments to explain things like how the
csum_list is organized and why we need to drop csum range which is
before us.

Refactor the function by:

- Add more comments explaining the behavior
- Add comment explaining why we need to drop the csum range
- Put the csum copy in the main loop
  This is mostly for the incoming patches to make scrub_find_csum() able
  to find multiple checksums.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/scrub.c