]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: improve the loop of scrub_stripe
authorLiu Bo <bo.li.liu@oracle.com>
Sat, 27 Apr 2013 02:56:57 +0000 (02:56 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 6 May 2013 19:55:26 +0000 (15:55 -0400)
commit7c3bfc7bbab6689fea09ce6cc8302eeafa19dbd1
tree76277ca036ae9910b5ec94a5263907c4c5ffd48b
parentfc1e25667cc8b7fab878f7b9750f9a0b40ed80b4
Btrfs: improve the loop of scrub_stripe

1) Right now scrub_stripe() is looping in some unnecessary cases:
* when the found extent item's objectid has been out of the dev extent's range
  but we haven't finish scanning all the range within the dev extent
* when all the items has been processed but we haven't finish scanning all the
  range within the dev extent

In both cases, we can just finish the loop to save costs.

2) Besides, when the found extent item's length is larger than the stripe
len(64k), we don't have to release the path and search again as it'll get at the
same key used in the last loop, we can instead increase the logical cursor in
place till all space of the extent is scanned.

3) And we use 0 as the key's offset to search btree, then get to previous item
to find a smaller item, and again have to move to the next one to get the right
item.  Setting offset=-1 and previous_item() is the correct way.

4) As we won't find any checksum at offset unless this 'offset' is in a data
extent, we can just find checksum when we're really going to scrub an extent.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/scrub.c