From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: daejun7.park@samsung.com, "jaegeuk@kernel.org" <jaegeuk@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH] f2fs: don't break allocation when crossing contiguous sections
Date: Wed, 30 Jul 2025 15:39:37 +0800 [thread overview]
Message-ID: <ae41b064-f45b-4410-9854-f4c07ea1d0bf@kernel.org> (raw)
In-Reply-To: <20250730015357epcms2p63d8a9d98265a526f959e33fa2d7c610b@epcms2p6>
Hi Daejun
Thanks for the comments.
On 7/30/25 09:53, Daejun Park wrote:
> Hi Chao Yu,
>
>> + lfs_dio_write = (flag == F2FS_GET_BLOCK_DIO && f2fs_lfs_mode(sbi) &&
>> + map->m_may_create);
>> +
>
> Consider moving the lfs_dio_write assignment to just after the if (!map->m_may_create …) check
> so it isn’t evaluated when creation isn’t allowed.
Correct.
It's too late to clean up the code as it is near to the merge window.
>
>> @@ -4171,6 +4172,10 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>> map.m_next_pgofs = &next_pgofs;
>> map.m_seg_type = f2fs_rw_hint_to_seg_type(F2FS_I_SB(inode),
>> inode->i_write_hint);
>> + if (flags & IOMAP_WRITE && iomap->private) {
>
> Since iomap->private is only set on the LFS DIO path, you can drop the flags & IOMAP_WRITE and
> test the pointer directly.
Well, that's right, but I still want to check this condition explicitly
to avoid any missing case or further misunderstanding on the code. :)
Thanks,
>
>> + map.m_last_pblk = (unsigned long)iomap->private;
>> + iomap->private = NULL;
>> + }
>>
>> /*
>> * If the blocks being overwritten are already allocated,
>> @@ -4209,6 +4214,9 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>> iomap->flags = IOMAP_F_MERGED;
>> iomap->bdev = map.m_bdev;
>> iomap->addr = F2FS_BLK_TO_BYTES(map.m_pblk);
>> +
>> + if (flags & IOMAP_WRITE && map.m_last_pblk)
>> + iomap->private = (void *)map.m_last_pblk;
>
> Likewise, checking only map.m_last_pblk is sufficient for restoring.
>
> Reviewed-by: Daejun Park <daejun7.park@samsung.com>
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2025-07-30 7:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 2:02 [f2fs-dev] [PATCH] f2fs: don't break allocation when crossing contiguous sections Chao Yu via Linux-f2fs-devel
2025-07-24 20:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
[not found] ` <CGME20250721020241epcas2p1481962181d9f81f127e122736923fe20@epcms2p6>
2025-07-30 1:53 ` Daejun Park
2025-07-30 7:39 ` Chao Yu via Linux-f2fs-devel [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=ae41b064-f45b-4410-9854-f4c07ea1d0bf@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=daejun7.park@samsung.com \
--cc=jaegeuk@kernel.org \
--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).