linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Sun Qiuyang <sunqiuyang@huawei.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] f2fs: merge equivalent flags F2FS_GET_BLOCK_[READ|DIO]
Date: Wed, 9 Aug 2017 09:13:19 +0800	[thread overview]
Message-ID: <75d6efdd-a4a6-2c00-150f-458a00b3892f@huawei.com> (raw)
In-Reply-To: <8ce0003f-780a-a349-e30e-218fdf61488d@huawei.com>

On 2017/8/8 19:41, Sun Qiuyang wrote:
> 
> 
>> On 2017/8/8 18:27, sunqiuyang wrote:
>>> From: Qiuyang Sun <sunqiuyang@huawei.com>
>>>
>>> Currently, the two flags F2FS_GET_BLOCK_[READ|DIO] are totally equivalent
>>> and can be used interchangably in all scenarios they are involved in. This
>>> patch deletes F2FS_GET_BLOCK_READ and uses F2FS_GET_BLOCK_DIO instead.
>>
>> Seems weird from readability point of view, so how about keeping
>> F2FS_GET_BLOCK_READ alive but sharing defined value with F2FS_GET_BLOCK_DIO?
>>
>> enum {
>> 	F2FS_GET_BLOCK_DIO,
>> 	F2FS_GET_BLOCK_READ = F2FS_GET_BLOCK_DIO,
>> 	F2FS_GET_BLOCK_FIEMAP,
>> 	...
>> }
>>
>> Thanks,
> How about renaming both of them F2FS_GET_BLOCK_DEFAULT? Actually neither 
> READ nor DIO is explicitly referenced in f2fs_map_blocks(); it is just 
> the "default" case. We have no reason to limit the use of this flag to 
> "read" or "direct IO" only.

Better. :)

Thanks,

> 
> Thanks,
>>
>>>
>>> Signed-off-by: Qiuyang Sun <sunqiuyang@huawei.com>
>>> ---
>>>  fs/f2fs/data.c | 2 +-
>>>  fs/f2fs/f2fs.h | 1 -
>>>  fs/f2fs/file.c | 4 ++--
>>>  3 files changed, 3 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index c43262d..e0a59bf 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -1244,7 +1244,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
>>>  			map.m_len = last_block - block_in_file;
>>>
>>>  			if (f2fs_map_blocks(inode, &map, 0,
>>> -						F2FS_GET_BLOCK_READ))
>>> +						F2FS_GET_BLOCK_DIO))
>>>  				goto set_error_page;
>>>  		}
>>>  got_it:
>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>> index cea329f..0593ca7 100644
>>> --- a/fs/f2fs/f2fs.h
>>> +++ b/fs/f2fs/f2fs.h
>>> @@ -514,7 +514,6 @@ struct f2fs_map_blocks {
>>>  };
>>>
>>>  /* for flag in get_data_block */
>>> -#define F2FS_GET_BLOCK_READ		0
>>>  #define F2FS_GET_BLOCK_DIO		1
>>>  #define F2FS_GET_BLOCK_FIEMAP		2
>>>  #define F2FS_GET_BLOCK_BMAP		3
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index e2b33b8..8271cb5 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -2074,7 +2074,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
>>>  	 */
>>>  	while (map.m_lblk < pg_end) {
>>>  		map.m_len = pg_end - map.m_lblk;
>>> -		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ);
>>> +		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_DIO);
>>>  		if (err)
>>>  			goto out;
>>>
>>> @@ -2116,7 +2116,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
>>>
>>>  do_map:
>>>  		map.m_len = pg_end - map.m_lblk;
>>> -		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ);
>>> +		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_DIO);
>>>  		if (err)
>>>  			goto clear_out;
>>>
>>>
>>
>>
>> .
>>
> 
> 
> .
> 

  reply	other threads:[~2017-08-09  1:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 10:27 [PATCH 1/1] f2fs: merge equivalent flags F2FS_GET_BLOCK_[READ|DIO] sunqiuyang
2017-08-08 11:24 ` Chao Yu
2017-08-08 11:41   ` Sun Qiuyang
2017-08-09  1:13     ` Chao Yu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-08-09  9:27 sunqiuyang
2017-08-10 10:45 ` Chao Yu

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=75d6efdd-a4a6-2c00-150f-458a00b3892f@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sunqiuyang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).