mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
treewide: change inode->i_ino from unsigned long to u64
On 32-bit architectures, unsigned long is only 32 bits wide, which causes 64-bit inode numbers to be silently truncated. Several filesystems (NFS, XFS, BTRFS, etc.) can generate inode numbers that exceed 32 bits, and this truncation can lead to inode number collisions and other subtle bugs on 32-bit systems. Change the type of inode->i_ino from unsigned long to u64 to ensure that inode numbers are always represented as 64-bit values regardless of architecture. Update all format specifiers treewide from %lu/%lx to %llu/%llx to match the new type, along with corresponding local variable types. This is the bulk treewide conversion. Earlier patches in this series handled trace events separately to allow trace field reordering for better struct packing on 32-bit. Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260304-iino-u64-v3-12-2257ad83d372@kernel.org Acked-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
d84c70c6ea
commit
0b2600f81c
@@ -420,21 +420,21 @@ static int mext_check_validity(struct inode *orig_inode,
|
||||
|
||||
/* origin and donor should be different inodes */
|
||||
if (orig_inode == donor_inode) {
|
||||
ext4_debug("ext4 move extent: The argument files should not be same inode [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: The argument files should not be same inode [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* origin and donor should belone to the same filesystem */
|
||||
if (orig_inode->i_sb != donor_inode->i_sb) {
|
||||
ext4_debug("ext4 move extent: The argument files should be in same FS [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: The argument files should be in same FS [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Regular file check */
|
||||
if (!S_ISREG(orig_inode->i_mode) || !S_ISREG(donor_inode->i_mode)) {
|
||||
ext4_debug("ext4 move extent: The argument files should be regular file [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: The argument files should be regular file [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -477,26 +477,26 @@ static int mext_check_validity(struct inode *orig_inode,
|
||||
}
|
||||
|
||||
if (donor_inode->i_mode & (S_ISUID|S_ISGID)) {
|
||||
ext4_debug("ext4 move extent: suid or sgid is set to donor file [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: suid or sgid is set to donor file [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode)) {
|
||||
ext4_debug("ext4 move extent: donor should not be immutable or append file [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: donor should not be immutable or append file [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
/* Ext4 move extent does not support swap files */
|
||||
if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
|
||||
ext4_debug("ext4 move extent: The argument files should not be swap files [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: The argument files should not be swap files [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -ETXTBSY;
|
||||
}
|
||||
|
||||
if (ext4_is_quota_file(orig_inode) || ext4_is_quota_file(donor_inode)) {
|
||||
ext4_debug("ext4 move extent: The argument files should not be quota files [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: The argument files should not be quota files [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ static int mext_check_adjust_range(struct inode *orig_inode,
|
||||
/* Start offset should be same */
|
||||
if ((orig_start & ~(PAGE_MASK >> orig_inode->i_blkbits)) !=
|
||||
(donor_start & ~(PAGE_MASK >> orig_inode->i_blkbits))) {
|
||||
ext4_debug("ext4 move extent: orig and donor's start offsets are not aligned [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: orig and donor's start offsets are not aligned [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ static int mext_check_adjust_range(struct inode *orig_inode,
|
||||
(*len > EXT_MAX_BLOCKS) ||
|
||||
(donor_start + *len >= EXT_MAX_BLOCKS) ||
|
||||
(orig_start + *len >= EXT_MAX_BLOCKS)) {
|
||||
ext4_debug("ext4 move extent: Can't handle over [%u] blocks [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: Can't handle over [%u] blocks [ino:orig %llu, donor %llu]\n",
|
||||
EXT_MAX_BLOCKS,
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
@@ -550,7 +550,7 @@ static int mext_check_adjust_range(struct inode *orig_inode,
|
||||
else if (donor_eof < donor_start + *len - 1)
|
||||
*len = donor_eof - donor_start;
|
||||
if (!*len) {
|
||||
ext4_debug("ext4 move extent: len should not be 0 [ino:orig %lu, donor %lu]\n",
|
||||
ext4_debug("ext4 move extent: len should not be 0 [ino:orig %llu, donor %llu]\n",
|
||||
orig_inode->i_ino, donor_inode->i_ino);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user