[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f64cdddd-807e-2918-744b-56ced47a94dd@huawei.com>
Date: Fri, 28 Jun 2019 09:29:58 +0800
From: Chao Yu <yuchao0@...wei.com>
To: Jaegeuk Kim <jaegeuk@...nel.org>, <linux-kernel@...r.kernel.org>,
<linux-f2fs-devel@...ts.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH] f2fs: allocate blocks for pinned file
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.
Thanks,
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.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;
>
>
Powered by blists - more mailing lists