From: Eric Biggers <ebiggers@kernel.org>
To: zhangshida <starzhangzsd@gmail.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.com,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
zhangshida@kylinos.cn, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 1/2] ext4: hoist ext4_block_write_begin and replace the __block_write_begin
Date: Thu, 29 Aug 2024 00:03:46 +0000 [thread overview]
Message-ID: <20240829000346.GC558903@google.com> (raw)
In-Reply-To: <20240823013329.1996741-2-zhangshida@kylinos.cn>
On Fri, Aug 23, 2024 at 09:33:28AM +0800, zhangshida wrote:
> From: Shida Zhang <zhangshida@kylinos.cn>
>
> Using __block_write_begin() make it inconvenient to journal the
> user data dirty process. We can't tell the block layer maintainer,
> ‘Hey, we want to trace the dirty user data in ext4, can we add some
> special code for ext4 in __block_write_begin?’:P
>
> So use ext4_block_write_begin() instead.
>
> The two functions are basically doing the same thing except for the
> fscrypt related code. Narrow the scope of CONFIG_FS_ENCRYPTION so as
> to allow ext4_block_write_begin() to function like __block_write_begin
> when the config is disabled.
> And hoist the ext4_block_write_begin so that it can be used in other
> files.
>
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
> ---
> fs/ext4/ext4.h | 2 ++
> fs/ext4/inline.c | 10 +++++-----
> fs/ext4/inode.c | 23 ++++++-----------------
> 3 files changed, 13 insertions(+), 22 deletions(-)
Thanks for cleaning this up.
There are still some comments in fs/ext4/inode.c that reference
__block_write_begin. Can you update them too?
One more thing below.
> @@ -1119,7 +1118,9 @@ static int ext4_block_write_begin(struct folio *folio, loff_t pos, unsigned len,
> }
> if (unlikely(err)) {
> folio_zero_new_buffers(folio, from, to);
> - } else if (fscrypt_inode_uses_fs_layer_crypto(inode)) {
> + }
> +#ifdef CONFIG_FS_ENCRYPTION
> + else if (fscrypt_inode_uses_fs_layer_crypto(inode)) {
> for (i = 0; i < nr_wait; i++) {
> int err2;
>
> @@ -1131,10 +1132,10 @@ static int ext4_block_write_begin(struct folio *folio, loff_t pos, unsigned len,
> }
> }
> }
> +#endif
This #ifdef isn't necessary since fscrypt_inode_uses_fs_layer_crypto() returns
false (and it's known at compile time) when !CONFIG_FS_ENCRYPTION.
- Eric
next prev parent reply other threads:[~2024-08-29 0:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 1:33 [PATCH v4 0/2] Fix an error caused by improperly dirtied buffer zhangshida
2024-08-23 1:33 ` [PATCH 1/2] ext4: hoist ext4_block_write_begin and replace the __block_write_begin zhangshida
2024-08-28 11:04 ` Jan Kara
2024-08-29 0:03 ` Eric Biggers [this message]
2024-08-29 1:28 ` Stephen Zhang
2024-08-23 1:33 ` [PATCH 2/2] ext4: fix a potential assertion failure due to improperly dirtied buffer zhangshida
2024-08-28 11:45 ` Jan Kara
2024-08-29 1:50 ` Stephen Zhang
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=20240829000346.GC558903@google.com \
--to=ebiggers@kernel.org \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=starzhangzsd@gmail.com \
--cc=tytso@mit.edu \
--cc=zhangshida@kylinos.cn \
/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