[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <iz4x2yurkqxd6fzqw3ppf6pevyrzfxg4z3wwbufdwb7vtj6ndt@tnh5k2yts4nv>
Date: Wed, 8 Oct 2025 13:45:30 +0200
From: Jan Kara <jack@...e.cz>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
yi.zhang@...wei.com, libaokun1@...wei.com, yukuai3@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH v2 06/13] ext4: use EXT4_B_TO_LBLK() in
mext_check_arguments()
On Thu 25-09-25 17:26:02, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
>
> Switch to using EXT4_B_TO_LBLK() to calculate the EOF position of the
> origin and donor inodes, instead of using open-coded calculations.
>
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/ext4/move_extent.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> index 0f4b7c89edd3..6175906c7119 100644
> --- a/fs/ext4/move_extent.c
> +++ b/fs/ext4/move_extent.c
> @@ -461,12 +461,6 @@ mext_check_arguments(struct inode *orig_inode,
> __u64 donor_start, __u64 *len)
> {
> __u64 orig_eof, donor_eof;
> - unsigned int blkbits = orig_inode->i_blkbits;
> - unsigned int blocksize = 1 << blkbits;
> -
> - orig_eof = (i_size_read(orig_inode) + blocksize - 1) >> blkbits;
> - donor_eof = (i_size_read(donor_inode) + blocksize - 1) >> blkbits;
> -
>
> if (donor_inode->i_mode & (S_ISUID|S_ISGID)) {
> ext4_debug("ext4 move extent: suid or sgid is set"
> @@ -526,6 +520,9 @@ mext_check_arguments(struct inode *orig_inode,
> orig_inode->i_ino, donor_inode->i_ino);
> return -EINVAL;
> }
> +
> + orig_eof = EXT4_B_TO_LBLK(orig_inode, i_size_read(orig_inode));
> + donor_eof = EXT4_B_TO_LBLK(donor_inode, i_size_read(donor_inode));
> if (orig_eof <= orig_start)
> *len = 0;
> else if (orig_eof < orig_start + *len - 1)
> --
> 2.46.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists