Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-04-02 Thread Qu Wenruo
At 04/01/2017 01:26 AM, David Sterba wrote: On Fri, Mar 31, 2017 at 10:03:28AM +0800, Qu Wenruo wrote: At 03/30/2017 06:31 PM, David Sterba wrote: On Thu, Mar 30, 2017 at 09:03:21AM +0800, Qu Wenruo wrote: +static int lock_full_stripe(struct btrfs_fs_info *fs_info, u64 bytenr) +{ +

Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-31 Thread David Sterba
On Fri, Mar 31, 2017 at 10:03:28AM +0800, Qu Wenruo wrote: > > > At 03/30/2017 06:31 PM, David Sterba wrote: > > On Thu, Mar 30, 2017 at 09:03:21AM +0800, Qu Wenruo wrote: > +static int lock_full_stripe(struct btrfs_fs_info *fs_info, u64 bytenr) > +{ > +struct

Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-30 Thread Qu Wenruo
At 03/30/2017 06:31 PM, David Sterba wrote: On Thu, Mar 30, 2017 at 09:03:21AM +0800, Qu Wenruo wrote: +static int lock_full_stripe(struct btrfs_fs_info *fs_info, u64 bytenr) +{ + struct btrfs_block_group_cache *bg_cache; + struct btrfs_full_stripe_locks_tree *locks_root; +

Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-30 Thread David Sterba
On Thu, Mar 30, 2017 at 09:03:21AM +0800, Qu Wenruo wrote: > >> +static int lock_full_stripe(struct btrfs_fs_info *fs_info, u64 bytenr) > >> +{ > >> + struct btrfs_block_group_cache *bg_cache; > >> + struct btrfs_full_stripe_locks_tree *locks_root; > >> + struct full_stripe_lock *existing; > >>

Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-29 Thread Qu Wenruo
At 03/30/2017 08:34 AM, Liu Bo wrote: On Wed, Mar 29, 2017 at 09:33:18AM +0800, Qu Wenruo wrote: Unlike mirror based profiles, RAID5/6 recovery needs to read out the whole full stripe. And if we don't do proper protect, it can easily cause race condition. Introduce 2 new functions:

Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-29 Thread Liu Bo
On Wed, Mar 29, 2017 at 09:33:18AM +0800, Qu Wenruo wrote: > Unlike mirror based profiles, RAID5/6 recovery needs to read out the > whole full stripe. > > And if we don't do proper protect, it can easily cause race condition. > > Introduce 2 new functions: lock_full_stripe() and

[PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56

2017-03-28 Thread Qu Wenruo
Unlike mirror based profiles, RAID5/6 recovery needs to read out the whole full stripe. And if we don't do proper protect, it can easily cause race condition. Introduce 2 new functions: lock_full_stripe() and unlock_full_stripe() for RAID5/6. Which stores a rb_tree of mutex for full stripes, so