linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Ye Bin <yebin@huaweicloud.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	jack@suse.cz, Ye Bin <yebin10@huawei.com>
Subject: Re: [PATCH v3 1/2] ext4: remove set 'EXT4_STATE_MAY_INLINE_DATA' flag from ext4_find_inline_data_nolock()
Date: Mon, 6 Mar 2023 13:30:09 +0100	[thread overview]
Message-ID: <20230306123009.7qxbavnnl2k4lwgx@quack3> (raw)
In-Reply-To: <20230304025458.4007825-2-yebin@huaweicloud.com>

On Sat 04-03-23 10:54:57, Ye Bin wrote:
> From: Ye Bin <yebin10@huawei.com>
> 
> As only ext4_iget_extra_inode() call ext4_find_inline_data_nolock() need
> to set 'EXT4_STATE_MAY_INLINE_DATA' flag. The call in
> ext4_write_inline_data_end() is there only need to update i_inline_off.
> So move set 'EXT4_STATE_MAY_INLINE_DATA' flag from
> ext4_find_inline_data_nolock() to ext4_iget_extra_inode().

I'd just rephrase the changelog to be more comprehensible:

The only caller of ext4_find_inline_data_nolock() that needs setting of
EXT4_STATE_MAY_INLINE_DATA flag is ext4_iget_extra_inode(). In
ext4_write_inline_data_end() we just need to update inode->i_inline_off.
Since we are going to add one more caller that does not need to set
EXT4_STATE_MAY_INLINE_DATA, just move setting of EXT4_STATE_MAY_INLINE_DATA
out to ext4_iget_extra_inode().

Otherwise feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> 
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  fs/ext4/inline.c | 1 -
>  fs/ext4/inode.c  | 7 ++++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index 2b42ececa46d..1602d74b5eeb 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -159,7 +159,6 @@ int ext4_find_inline_data_nolock(struct inode *inode)
>  					(void *)ext4_raw_inode(&is.iloc));
>  		EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE +
>  				le32_to_cpu(is.s.here->e_value_size);
> -		ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
>  	}
>  out:
>  	brelse(is.iloc.bh);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d251d705c276..bf0b7dea4900 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4797,8 +4797,13 @@ static inline int ext4_iget_extra_inode(struct inode *inode,
>  
>  	if (EXT4_INODE_HAS_XATTR_SPACE(inode)  &&
>  	    *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
> +		int err;
> +
>  		ext4_set_inode_state(inode, EXT4_STATE_XATTR);
> -		return ext4_find_inline_data_nolock(inode);
> +		err = ext4_find_inline_data_nolock(inode);
> +		if (!err && ext4_has_inline_data(inode))
> +			ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
> +		return err;
>  	} else
>  		EXT4_I(inode)->i_inline_off = 0;
>  	return 0;
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-03-06 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04  2:54 [PATCH v3 0/2] ext4: fix WARNING in ext4_update_inline_data Ye Bin
2023-03-04  2:54 ` [PATCH v3 1/2] ext4: remove set 'EXT4_STATE_MAY_INLINE_DATA' flag from ext4_find_inline_data_nolock() Ye Bin
2023-03-06 12:30   ` Jan Kara [this message]
2023-03-04  2:54 ` [PATCH v3 2/2] ext4: fix WARNING in ext4_update_inline_data Ye Bin
2023-03-06 12:30   ` Jan Kara

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=20230306123009.7qxbavnnl2k4lwgx@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yebin10@huawei.com \
    --cc=yebin@huaweicloud.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).