Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1476172

Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

From Qu Wenruo <quwenruo@cn.fujitsu.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.
Date 2016-09-05 10:00 +0200
Message-ID <sdWYW-N5-19@gated-at.bofh.it> (permalink)
References <sdQJP-5ac-5@gated-at.bofh.it> <sdQJP-5ac-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



At 09/05/2016 09:19 AM, Zhao Lei wrote:
> Hi, Sean Fu
>
>> From: Sean Fu [mailto:fxinrong@gmail.com]
>> Sent: Sunday, September 04, 2016 7:54 PM
>> To: dsterba@suse.com
>> Cc: clm@fb.com; anand.jain@oracle.com; fdmanana@suse.com;
>> zhaolei@cn.fujitsu.com; linux-btrfs@vger.kernel.org;
>> linux-kernel@vger.kernel.org; Sean Fu <fxinrong@gmail.com>
>> Subject: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in
>> btrfs_read_chunk_tree.
>>
>> The input argument root is already set with "fs_info->chunk_root".
>> "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
>> "open_ctree".
>> “root->fs_info = fs_info” in "btrfs_alloc_root".
>>
> The root argument of this function means "any root".
> And the function is designed getting chunk root from
> "any root" in head.
>
> Since there is only one caller of this function,
> and the caller always send chunk_root as root argument in
> current code, we can remove above conversion,
> and I suggest renaming root to chunk_root to make it clear,
> something like:
>
> - btrfs_read_chunk_tree(struct btrfs_root *root)
> + btrfs_read_chunk_tree(struct btrfs_root *chunk_root)

Since root is only used to get fs_info->chunk_root, why not use fs_info 
directly?

Thanks,
Qu

>
> Thanks
> Zhaolei
>
>> Signed-off-by: Sean Fu <fxinrong@gmail.com>
>> ---
>>  fs/btrfs/volumes.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 366b335..384a6d2 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
>>  	int ret;
>>  	int slot;
>>
>> -	root = root->fs_info->chunk_root;
>> -
>>  	path = btrfs_alloc_path();
>>  	if (!path)
>>  		return -ENOMEM;
>> --
>> 2.6.2
>>
>
>
>
>
> --
> 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
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RE: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree. Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-09-05 03:20 +0200
  Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Qu Wenruo <quwenruo@cn.fujitsu.com> - 2016-09-05 10:00 +0200
    RE: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree. Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-09-06 04:50 +0200
    Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Jeff Mahoney <jeffm@suse.com> - 2016-09-06 05:10 +0200
      Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Jeff Mahoney <jeffm@suse.com> - 2016-09-06 05:40 +0200
        Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. David Sterba <dsterba@suse.cz> - 2016-09-06 12:10 +0200
          Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Jeff Mahoney <jeffm@suse.com> - 2016-09-06 17:20 +0200
            Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Sean Fu <fxinrong@gmail.com> - 2016-09-07 03:50 +0200
            Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Sean Fu <fxinrong@gmail.com> - 2016-09-09 05:10 +0200
              Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Jeff Mahoney <jeffm@suse.com> - 2016-09-09 05:30 +0200
                Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Sean Fu <fxinrong@gmail.com> - 2016-09-09 05:50 +0200
    Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Sean Fu <fxinrong@gmail.com> - 2016-09-07 03:40 +0200
      Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment  in btrfs_read_chunk_tree. Qu Wenruo <quwenruo@cn.fujitsu.com> - 2016-09-07 04:00 +0200

csiph-web