Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: use EXT4_B_TO_LBLK() in mext_check_arguments()

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@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-ID: <20251013015128.499308-6-yi.zhang@huaweicloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Zhang Yi and committed by
Theodore Ts'o
c9570b66 07c440e8

+3 -6
+3 -6
fs/ext4/move_extent.c
··· 461 461 __u64 donor_start, __u64 *len) 462 462 { 463 463 __u64 orig_eof, donor_eof; 464 - unsigned int blkbits = orig_inode->i_blkbits; 465 - unsigned int blocksize = 1 << blkbits; 466 - 467 - orig_eof = (i_size_read(orig_inode) + blocksize - 1) >> blkbits; 468 - donor_eof = (i_size_read(donor_inode) + blocksize - 1) >> blkbits; 469 - 470 464 471 465 if (donor_inode->i_mode & (S_ISUID|S_ISGID)) { 472 466 ext4_debug("ext4 move extent: suid or sgid is set" ··· 520 526 orig_inode->i_ino, donor_inode->i_ino); 521 527 return -EINVAL; 522 528 } 529 + 530 + orig_eof = EXT4_B_TO_LBLK(orig_inode, i_size_read(orig_inode)); 531 + donor_eof = EXT4_B_TO_LBLK(donor_inode, i_size_read(donor_inode)); 523 532 if (orig_eof <= orig_start) 524 533 *len = 0; 525 534 else if (orig_eof < orig_start + *len - 1)