linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: allocate blocks for pinned file
Date: Fri, 28 Jun 2019 10:42:01 +0800	[thread overview]
Message-ID: <a8bfab96-f98f-c637-8ba0-caf702080b6f@huawei.com> (raw)
In-Reply-To: <20190628021551.GA10489@jaegeuk-macbookpro.roam.corp.google.com>

On 2019/6/28 10:15, Jaegeuk Kim wrote:
> On 06/28, Chao Yu wrote:
>> Hi Jaegeuk,
>>
>> On 2019/6/28 1:05, Jaegeuk Kim wrote:
>>> This patch allows fallocate to allocate physical blocks for pinned file.
>>
>> Quoted from manual of fallocate(2):
>> "
>> Any subregion within the range specified by offset and len that did not contain
>> data before the  call  will  be  initialized  to zero.
>>
>> If  the  FALLOC_FL_KEEP_SIZE  flag  is specified in mode .... Preallocating
>> zeroed blocks beyond the end of the file in this manner is useful for optimizing
>> append workloads.
>> "
>>
>> As quoted description, our change may break the rule of fallocate(, mode = 0),
>> because with after this change, we can't guarantee that preallocated physical
>> block contains zeroed data
>>
>> Should we introduce an additional ioctl for this case? Or maybe add one more
>> flag in fallocate() for unzeroed block preallocation, not sure.
> 
> I thought like that, but this is a very corner case for the pinned file only in
> f2fs. And, the pinned file is also indeed used by this purpose.

Okay, I think we need to find one place to document such behavior that is not
matching regular poxis fallocate's sematic, user should be noticed about it.

Thanks,

> 
> Thanks,
> 
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>  fs/f2fs/file.c | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index e7c368db8185..cdfd4338682d 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -1528,7 +1528,12 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
>>>  	if (off_end)
>>>  		map.m_len++;
>>>  
>>> -	err = f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PRE_AIO);
>>> +	if (f2fs_is_pinned_file(inode))
>>> +		map.m_seg_type = CURSEG_COLD_DATA;
>>> +
>>> +	err = f2fs_map_blocks(inode, &map, 1, (f2fs_is_pinned_file(inode) ?
>>> +						F2FS_GET_BLOCK_PRE_DIO :
>>> +						F2FS_GET_BLOCK_PRE_AIO));
>>>  	if (err) {
>>>  		pgoff_t last_off;
>>>  
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2019-06-28  2:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27 17:05 [f2fs-dev] [PATCH] f2fs: allocate blocks for pinned file Jaegeuk Kim
2019-06-28  1:29 ` Chao Yu
2019-06-28  2:15   ` Jaegeuk Kim
2019-06-28  2:42     ` Chao Yu [this message]
2019-06-28 15:36 ` [f2fs-dev] [PATCH v2] " Jaegeuk Kim
2019-06-29  8:36   ` 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=a8bfab96-f98f-c637-8ba0-caf702080b6f@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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).