From: Chao Yu <chao@kernel.org>
To: Yangtao Li <frank.li@vivo.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Qi Han <hanqi@vivo.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: compress: don't force buffered io when in COMPR_MODE_USER mode
Date: Mon, 19 Jun 2023 08:54:33 +0800 [thread overview]
Message-ID: <7ab6b6f9-37fa-9bf2-69ce-7b1b1944d9f3@kernel.org> (raw)
In-Reply-To: <dde6972a-e98c-8a6e-493b-9aff5668101d@vivo.com>
On 2023/6/13 12:14, Yangtao Li wrote:
>
> On 2023/6/12 22:38, Chao Yu wrote:
>> On 2023/6/9 21:15, Yangtao Li wrote:
>>> It is observed that when in user compression mode
>>> (compress_extension=*),
>>> even though the file is not compressed, the file is still forced to use
>>> buffer io, which makes the AndroBench sequential read and write drop
>>> significantly. In fact, when the file is not compressed, we don't need
>>> to force it to buffer io.
>>>
>>> | w/o patch | w/ patch |
>>> seq read (MB/s) | 1320.068 | 3696.154 |
>>> seq write (MB/s) | 617.996 | 2978.478 |
>>>
>>> Fixes: 4c8ff7095bef ("f2fs: support data compression")
>>> Signed-off-by: Qi Han <hanqi@vivo.com>
>>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>>> ---
>>> fs/f2fs/f2fs.h | 14 ++++++++++++++
>>> fs/f2fs/file.c | 2 +-
>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>> index 1efcfd9e5a99..7f5472525310 100644
>>> --- a/fs/f2fs/f2fs.h
>>> +++ b/fs/f2fs/f2fs.h
>>> @@ -3168,6 +3168,20 @@ static inline int f2fs_compressed_file(struct
>>> inode *inode)
>>> is_inode_flag_set(inode, FI_COMPRESSED_FILE);
>>> }
>>> +static inline bool f2fs_is_compressed_file(struct inode *inode)
>>> +{
>>> + int compress_mode = F2FS_OPTION(F2FS_I_SB(inode)).compress_mode;
>>> +
>>> + if (compress_mode == COMPR_MODE_FS)
>>> + return f2fs_compressed_file(inode);
>>> + else if (atomic_read(&F2FS_I(inode)->i_compr_blocks) ||
>>
>> Should check dirty page as well? i_compr_blocks may increase after
>> data writeback.
>>
> IIUC, in COMPR_MODE_USER mode, i_compr_blocks will only be updated when
> FI_ENABLE_COMPRESS is enabled.
>
> If FI_ENABLE_COMPRESS is not enabled, i_compr_blocks will never be
> updated after data writeback.
>
> So there is no need to additionally judge whether there is a dirty page?
Oh, user mode, that's correct.
If we allow dio/aio on compress file, it needs to consider race case in
between aio and ioc_compress_file.
Thanks,
>
>
> Thanks,
>
>> Thanks,
>>
>>> + is_inode_flag_set(inode, FI_COMPRESS_RELEASED) ||
>>> + is_inode_flag_set(inode, FI_ENABLE_COMPRESS))
>>> + return true;
>>> +
>>> + return false;
>>> +}
>>> +
>>> static inline bool f2fs_need_compress_data(struct inode *inode)
>>> {
>>> int compress_mode = F2FS_OPTION(F2FS_I_SB(inode)).compress_mode;
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index 74ecc9e20619..0698129b2165 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -821,7 +821,7 @@ static bool f2fs_force_buffered_io(struct inode
>>> *inode, int rw)
>>> return true;
>>> if (fsverity_active(inode))
>>> return true;
>>> - if (f2fs_compressed_file(inode))
>>> + if (f2fs_is_compressed_file(inode))
>>> return true;
>>> /* disallow direct IO if any of devices has unaligned blksize */
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-06-19 0:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 13:15 [f2fs-dev] [PATCH] f2fs: compress: don't force buffered io when in COMPR_MODE_USER mode Yangtao Li via Linux-f2fs-devel
2023-06-12 14:38 ` Chao Yu
2023-06-13 4:14 ` Yangtao Li via Linux-f2fs-devel
2023-06-19 0:54 ` Chao Yu [this message]
2023-06-19 3:11 ` Yangtao Li via Linux-f2fs-devel
2023-06-19 4:04 ` Chao Yu
2023-06-19 9:31 ` Yangtao Li via Linux-f2fs-devel
2023-06-19 14:13 ` 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=7ab6b6f9-37fa-9bf2-69ce-7b1b1944d9f3@kernel.org \
--to=chao@kernel.org \
--cc=frank.li@vivo.com \
--cc=hanqi@vivo.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).