* [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
@ 2024-04-26 10:35 Chao Yu
2024-04-26 11:30 ` [f2fs-dev] " Zhiguo Niu
2024-04-26 14:14 ` Daeho Jeong
0 siblings, 2 replies; 6+ messages in thread
From: Chao Yu @ 2024-04-26 10:35 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, Daeho Jeong
Otherwise, it breaks pinfile's sematics.
Cc: Daeho Jeong <daeho43@gmail.com>
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index bee1e45f76b8..e29000d83d52 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
/* use out-place-update for direct IO under LFS mode */
if (map->m_may_create &&
- (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
+ (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
+ (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
if (unlikely(f2fs_cp_error(sbi))) {
err = -EIO;
goto sync_out;
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
2024-04-26 10:35 [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO Chao Yu
@ 2024-04-26 11:30 ` Zhiguo Niu
2024-04-27 1:50 ` Chao Yu
2024-04-26 14:14 ` Daeho Jeong
1 sibling, 1 reply; 6+ messages in thread
From: Zhiguo Niu @ 2024-04-26 11:30 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
Dear Chao,
On Fri, Apr 26, 2024 at 6:37 PM Chao Yu <chao@kernel.org> wrote:
>
> Otherwise, it breaks pinfile's sematics.
>
> Cc: Daeho Jeong <daeho43@gmail.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index bee1e45f76b8..e29000d83d52 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
>
> /* use out-place-update for direct IO under LFS mode */
> if (map->m_may_create &&
> - (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
> + (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
> + (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
Excuse me I a little question, should pin files not be written in OPU
mode regardless of device type(conventional or zone)?
thanks!
> if (unlikely(f2fs_cp_error(sbi))) {
> err = -EIO;
> goto sync_out;
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
2024-04-26 10:35 [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO Chao Yu
2024-04-26 11:30 ` [f2fs-dev] " Zhiguo Niu
@ 2024-04-26 14:14 ` Daeho Jeong
2024-04-27 1:49 ` Chao Yu
1 sibling, 1 reply; 6+ messages in thread
From: Daeho Jeong @ 2024-04-26 14:14 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
On Fri, Apr 26, 2024 at 3:35 AM Chao Yu <chao@kernel.org> wrote:
>
> Otherwise, it breaks pinfile's sematics.
>
> Cc: Daeho Jeong <daeho43@gmail.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index bee1e45f76b8..e29000d83d52 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
>
> /* use out-place-update for direct IO under LFS mode */
> if (map->m_may_create &&
> - (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
> + (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
> + (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
> if (unlikely(f2fs_cp_error(sbi))) {
> err = -EIO;
> goto sync_out;
> --
> 2.40.1
So, we block overwrite io for the pinfile here.
static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
...
if (f2fs_is_pinned_file(inode) &&
!f2fs_overwrite_io(inode, pos, count)) {
ret = -EIO;
goto out_unlock;
}
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
2024-04-26 14:14 ` Daeho Jeong
@ 2024-04-27 1:49 ` Chao Yu
2024-04-27 19:50 ` Daeho Jeong
0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2024-04-27 1:49 UTC (permalink / raw)
To: Daeho Jeong; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
On 2024/4/26 22:14, Daeho Jeong wrote:
> On Fri, Apr 26, 2024 at 3:35 AM Chao Yu <chao@kernel.org> wrote:
>>
>> Otherwise, it breaks pinfile's sematics.
>>
>> Cc: Daeho Jeong <daeho43@gmail.com>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>> fs/f2fs/data.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index bee1e45f76b8..e29000d83d52 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
>>
>> /* use out-place-update for direct IO under LFS mode */
>> if (map->m_may_create &&
>> - (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
>> + (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
>> + (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
>> if (unlikely(f2fs_cp_error(sbi))) {
>> err = -EIO;
>> goto sync_out;
>> --
>> 2.40.1
>
> So, we block overwrite io for the pinfile here.
I guess you mean we blocked append write for pinfile, right?
>
> static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>
> {
> ...
> if (f2fs_is_pinned_file(inode) &&
> !f2fs_overwrite_io(inode, pos, count)) {
If !f2fs_overwrite_io() is true, it means it may trigger append write on
pinfile?
Thanks,
> ret = -EIO;
> goto out_unlock;
> }
>
>
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
2024-04-26 11:30 ` [f2fs-dev] " Zhiguo Niu
@ 2024-04-27 1:50 ` Chao Yu
0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2024-04-27 1:50 UTC (permalink / raw)
To: Zhiguo Niu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
On 2024/4/26 19:30, Zhiguo Niu wrote:
> Dear Chao,
>
> On Fri, Apr 26, 2024 at 6:37 PM Chao Yu <chao@kernel.org> wrote:
>>
>> Otherwise, it breaks pinfile's sematics.
>>
>> Cc: Daeho Jeong <daeho43@gmail.com>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>> fs/f2fs/data.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index bee1e45f76b8..e29000d83d52 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
>>
>> /* use out-place-update for direct IO under LFS mode */
>> if (map->m_may_create &&
>> - (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
>> + (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
>> + (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
> Excuse me I a little question, should pin files not be written in OPU
> mode regardless of device type(conventional or zone)?
Agreed, so it looks we need remove !f2fs_sb_has_blkzoned condition here...
Thanks,
> thanks!
>> if (unlikely(f2fs_cp_error(sbi))) {
>> err = -EIO;
>> goto sync_out;
>> --
>> 2.40.1
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO
2024-04-27 1:49 ` Chao Yu
@ 2024-04-27 19:50 ` Daeho Jeong
0 siblings, 0 replies; 6+ messages in thread
From: Daeho Jeong @ 2024-04-27 19:50 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
On Fri, Apr 26, 2024 at 6:49 PM Chao Yu <chao@kernel.org> wrote:
>
> On 2024/4/26 22:14, Daeho Jeong wrote:
> > On Fri, Apr 26, 2024 at 3:35 AM Chao Yu <chao@kernel.org> wrote:
> >>
> >> Otherwise, it breaks pinfile's sematics.
> >>
> >> Cc: Daeho Jeong <daeho43@gmail.com>
> >> Signed-off-by: Chao Yu <chao@kernel.org>
> >> ---
> >> fs/f2fs/data.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >> index bee1e45f76b8..e29000d83d52 100644
> >> --- a/fs/f2fs/data.c
> >> +++ b/fs/f2fs/data.c
> >> @@ -1596,7 +1596,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
> >>
> >> /* use out-place-update for direct IO under LFS mode */
> >> if (map->m_may_create &&
> >> - (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
> >> + (is_hole || (flag == F2FS_GET_BLOCK_DIO && (f2fs_lfs_mode(sbi) &&
> >> + (!f2fs_sb_has_blkzoned(sbi) || !f2fs_is_pinned_file(inode)))))) {
> >> if (unlikely(f2fs_cp_error(sbi))) {
> >> err = -EIO;
> >> goto sync_out;
> >> --
> >> 2.40.1
> >
> > So, we block overwrite io for the pinfile here.
>
> I guess you mean we blocked append write for pinfile, right?
>
> >
> > static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
> >
> > {
> > ...
> > if (f2fs_is_pinned_file(inode) &&
> > !f2fs_overwrite_io(inode, pos, count)) {
>
> If !f2fs_overwrite_io() is true, it means it may trigger append write on
> pinfile?
Yes, I missed it. Thanks~
>
> Thanks,
>
> > ret = -EIO;
> > goto out_unlock;
> > }
> >
> >
> >>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-27 19:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 10:35 [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO Chao Yu
2024-04-26 11:30 ` [f2fs-dev] " Zhiguo Niu
2024-04-27 1:50 ` Chao Yu
2024-04-26 14:14 ` Daeho Jeong
2024-04-27 1:49 ` Chao Yu
2024-04-27 19:50 ` Daeho Jeong
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).