Re: [PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-05-01 Thread David Sterba
On Fri, Apr 27, 2018 at 01:36:35PM +0800, Liu Bo wrote: > > What does btrfs_search_forward do as the first statement: > > > > 5115 int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key > > *min_key, > > 5116 struct btrfs_path *path, > > 5117

Re: [PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-04-27 Thread David Sterba
On Fri, Apr 27, 2018 at 11:23:23AM +0800, Liu Bo wrote: > >> --- > >> v2: update commit log with more details. > >> > >> fs/btrfs/tree-defrag.c | 3 +-- > >> 1 file changed, 1 insertion(+), 2 deletions(-) > >> > >> diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c > >> index

Re: [PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-04-26 Thread Liu Bo
On Fri, Apr 27, 2018 at 2:06 AM, David Sterba wrote: > On Thu, Apr 26, 2018 at 09:27:43AM +0800, Liu Bo wrote: >> path->keep_lock may force to lock tree root and higher nodes, and make >> lock contention worse, thus it needs to be avoided as much as >> possible. >> >> In

Re: [PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-04-26 Thread Liu Bo
On Fri, Apr 27, 2018 at 2:06 AM, David Sterba wrote: > On Thu, Apr 26, 2018 at 09:27:43AM +0800, Liu Bo wrote: >> path->keep_lock may force to lock tree root and higher nodes, and make >> lock contention worse, thus it needs to be avoided as much as >> possible. >> >> In

Re: [PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-04-26 Thread David Sterba
On Thu, Apr 26, 2018 at 09:27:43AM +0800, Liu Bo wrote: > path->keep_lock may force to lock tree root and higher nodes, and make > lock contention worse, thus it needs to be avoided as much as > possible. > > In btrfs_degrag_leaves, path->keep_lock is set but @path immediatley > gets released,

[PATCH v2] Btrfs: set keep_lock when necessary in btrfs_defrag_leaves

2018-04-25 Thread Liu Bo
path->keep_lock may force to lock tree root and higher nodes, and make lock contention worse, thus it needs to be avoided as much as possible. In btrfs_degrag_leaves, path->keep_lock is set but @path immediatley gets released, which is not necessary at all. Signed-off-by: Liu Bo