All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>,
	Liu Bo <bo.liu@linux.alibaba.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/6] Btrfs: remove unused check of skip_locking
Date: Wed, 16 May 2018 15:06:24 +0800	[thread overview]
Message-ID: <f1722837-aef9-1d82-0705-3df02323edb8@gmx.com> (raw)
In-Reply-To: <760f01dd-db0f-0110-d48b-751cfcd733e8@suse.com>



On 2018年05月16日 15:03, Nikolay Borisov wrote:
> 
> 
> On 15.05.2018 20:52, Liu Bo wrote:
>> The check is superfluous since all of callers who set search_for_commit
>> also have skip_locking set.
> 
> This is false. For example btrfs_qgroup_rescan_worker sets
> search_commit_root = 1 but doesn't set skip locking. So either your
> assumption is wrong or the code in btrfs_qgroup_rescan_worker has missed
> that (which seems more likely).

Liu's assumption on all commit root searcher don't need lock looks good
to me, thus qgroup code could set skip_locking.

> 
> I think this change necessitates either:
> 
> a) ASSERT(p->skip_locking) inside the if (p->search_commit_root) branch
> 
> or
> 
> b) Unconditionally setting ->skip_locking if we have set
> search_commit_root and removing opencoded set of skip_locking alongside
> search_commit_root.
> 
> I think b) is the better option since it provides "fire and forget"
> semantics when you want to search the commit root, since it's only read
> only.

b) looks better to me.

Thanks,
Qu

> 
>>
>> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
>> ---
>>  fs/btrfs/ctree.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
>> index 399839df7a8f..cf34eca41d4e 100644
>> --- a/fs/btrfs/ctree.c
>> +++ b/fs/btrfs/ctree.c
>> @@ -2623,8 +2623,6 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root,
>>  		level = btrfs_header_level(b);
>>  		if (p->need_commit_sem)
>>  			up_read(&fs_info->commit_root_sem);
>> -		if (!p->skip_locking)
>> -			btrfs_tree_read_lock(b);
>>  
>>  		goto out;
>>  	}
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2018-05-16  7:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 17:52 [PATCH 0/6] btrfs_search_slot cleanups Liu Bo
2018-05-15 17:52 ` [PATCH 1/6] Btrfs: remove superfluous free_extent_buffer Liu Bo
2018-05-16  6:40   ` Nikolay Borisov
2018-05-15 17:52 ` [PATCH 2/6] Btrfs: use more straightforward extent_buffer_uptodate Liu Bo
2018-05-16  6:43   ` Nikolay Borisov
2018-05-18  2:09     ` Liu Bo
2018-05-15 17:52 ` [PATCH 3/6] Btrfs: move get root of btrfs_search_slot to a helper Liu Bo
2018-05-16  6:54   ` Nikolay Borisov
2018-05-15 17:52 ` [PATCH 4/6] Btrfs: remove unused check of skip_locking Liu Bo
2018-05-16  7:03   ` Nikolay Borisov
2018-05-16  7:06     ` Qu Wenruo [this message]
2018-05-18  2:55     ` Liu Bo
2018-05-18  5:36       ` Nikolay Borisov
2018-05-15 17:52 ` [PATCH 5/6] Btrfs: grab write lock directly if write_lock_level is the max level Liu Bo
2018-05-16  7:09   ` Nikolay Borisov
2018-05-15 17:52 ` [PATCH 6/6] Btrfs: remove always true check in unlock_up Liu Bo
2018-05-16  6:47   ` Nikolay Borisov
2018-05-15 18:15 ` [PATCH 0/6] btrfs_search_slot cleanups David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1722837-aef9-1d82-0705-3df02323edb8@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=bo.liu@linux.alibaba.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.