Re: [PATCH v2 5/6] Btrfs: grab write lock directly if write_lock_level is the max level

2018-05-28 Thread David Sterba
On Fri, May 18, 2018 at 11:00:23AM +0800, Liu Bo wrote: > Typically, when acquiring root node's lock, btrfs tries its best to get > read lock and trade for write lock if @write_lock_level implies to do so. > > In case of (cow && (p->keep_locks || p->lowest_level)), write_lock_level > is set to

[PATCH v2 5/6] Btrfs: grab write lock directly if write_lock_level is the max level

2018-05-17 Thread Liu Bo
Typically, when acquiring root node's lock, btrfs tries its best to get read lock and trade for write lock if @write_lock_level implies to do so. In case of (cow && (p->keep_locks || p->lowest_level)), write_lock_level is set to BTRFS_MAX_LEVEL, which means we need to acquire root node's write