From: Chao Yu <yuchao0@huawei.com>
To: Chao Yu <chao@kernel.org>, Jia Zhu <zhujia13@huawei.com>,
jaegeuk@kernel.org
Cc: jaizhu.zj@gmail.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] f2fs: fix m_may_create to make OPU DIO write correctly
Date: Tue, 27 Nov 2018 11:15:07 +0800 [thread overview]
Message-ID: <fcd92bd8-23fe-a254-bf14-85cfbec5330a@huawei.com> (raw)
In-Reply-To: <c72e1624-1c9f-1a21-385e-badb2fc5d641@kernel.org>
Ping,
On 2018/11/20 19:58, Chao Yu wrote:
> On 2018-11-20 4:29, Jia Zhu wrote:
>> Previously, we added a parameter @map.m_may_create to trigger OPU
>> allocation and call f2fs_balance_fs() correctly.
>>
>> But in get_more_blocks(), @create has been overwritten by below code.
>> So the function f2fs_map_blocks() will not allocate new block address
>> but directly go out. Meanwile,there are several functions calling
>> f2fs_map_blocks() directly and @map.m_may_create not initialized.
>
> Oh, I missed to check all f2fs_map_blocks structure referrers, sorry.
>
>> CODE:
>> create = dio->op == REQ_OP_WRITE;
>> if (dio->flags & DIO_SKIP_HOLES) {
>> if (fs_startblk <= ((i_size_read(dio->inode) - 1) >>
>> i_blkbits))
>> create = 0;
>> }
>>
>> This patch fixes it.
>>
>> Signed-off-by: Jia Zhu <zhujia13@huawei.com>> ---
>
> It will be better to add simple change logs here to indicate how you modify your
> patch comparing to previous one, please keep that rule for your next patch. ;)
>
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>
> Thanks,
>
>> fs/f2fs/data.c | 5 +++++
>> fs/f2fs/file.c | 4 +++-
>> 2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index aa8843a..7226300 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -1052,6 +1052,10 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
>> end = pgofs + maxblocks;
>>
>> if (!create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
>> + if (test_opt(sbi, LFS) && flag == F2FS_GET_BLOCK_DIO &&
>> + map->m_may_create)
>> + goto next_dnode;
>> +
>> map->m_pblk = ei.blk + pgofs - ei.fofs;
>> map->m_len = min((pgoff_t)maxblocks, ei.fofs + ei.len - pgofs);
>> map->m_flags = F2FS_MAP_MAPPED;
>> @@ -1261,6 +1265,7 @@ bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len)
>> map.m_next_pgofs = NULL;
>> map.m_next_extent = NULL;
>> map.m_seg_type = NO_CHECK_TYPE;
>> + map.m_may_create = false;
>> last_lblk = F2FS_BLK_ALIGN(pos + len);
>>
>> while (map.m_lblk < last_lblk) {
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 3271830..ff82350 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -2201,7 +2201,8 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
>> {
>> struct inode *inode = file_inode(filp);
>> struct f2fs_map_blocks map = { .m_next_extent = NULL,
>> - .m_seg_type = NO_CHECK_TYPE };
>> + .m_seg_type = NO_CHECK_TYPE ,
>> + .m_may_create = false };
>> struct extent_info ei = {0, 0, 0};
>> pgoff_t pg_start, pg_end, next_pgofs;
>> unsigned int blk_per_seg = sbi->blocks_per_seg;
>> @@ -2935,6 +2936,7 @@ int f2fs_precache_extents(struct inode *inode)
>> map.m_next_pgofs = NULL;
>> map.m_next_extent = &m_next_extent;
>> map.m_seg_type = NO_CHECK_TYPE;
>> + map.m_may_create = false;
>> end = F2FS_I_SB(inode)->max_file_blocks;
>>
>> while (map.m_lblk < end) {
>>
>
> .
>
prev parent reply other threads:[~2018-11-27 3:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 19:41 [PATCH] f2fs: fix m_may_create to make OPU DIO write correctly Jia Zhu
2018-11-19 6:24 ` Chao Yu
2018-11-19 20:29 ` [PATCH v2] " Jia Zhu
2018-11-20 11:58 ` Chao Yu
2018-11-27 3:15 ` Chao Yu [this message]
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=fcd92bd8-23fe-a254-bf14-85cfbec5330a@huawei.com \
--to=yuchao0@huawei.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=jaizhu.zj@gmail.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=zhujia13@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).