btrfs: scrub: Introduce full stripe lock for RAID56
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Fri, 14 Apr 2017 00:35:54 +0000 (08:35 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Apr 2017 12:07:27 +0000 (14:07 +0200)
commit0966a7b1300f953b04b436aa82486d3d1b17c96d
tree918f983ce93ded51f7c8176740cdaee6f1ee7eb6
parentfa7aede2ab5f54352c7aec056930dd17b28f3a78
btrfs: scrub: Introduce full stripe lock for RAID56

Unlike mirror based profiles, RAID5/6 recovery needs to read out the
whole full stripe.

And if we don't do proper protection, it can easily cause race condition.

Introduce 2 new functions: lock_full_stripe() and unlock_full_stripe()
for RAID5/6.
Which store a rb_tree of mutexes for full stripes, so scrub callers can
use them to lock a full stripe to avoid race.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ minor comment adjustments ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/scrub.c