Btrfs: Always use 64bit inode number
There's a potential problem in 32bit system when we exhaust 32bit inode numbers and start to allocate big inode numbers, because btrfs uses inode->i_ino in many places. So here we always use BTRFS_I(inode)->location.objectid, which is an u64 variable. There are 2 exceptions that BTRFS_I(inode)->location.objectid != inode->i_ino: the btree inode (0 vs 1) and empty subvol dirs (256 vs 2), and inode->i_ino will be used in those cases. Another reason to make this change is I'm going to use a special inode to save free ino cache, and the inode number must be > (u64)-256. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
This commit is contained in:
@@ -3030,7 +3030,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
* because there might be preallocation past i_size
|
||||
*/
|
||||
ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root,
|
||||
path, inode->i_ino, -1, 0);
|
||||
path, btrfs_ino(inode), -1, 0);
|
||||
if (ret < 0) {
|
||||
btrfs_free_path(path);
|
||||
return ret;
|
||||
@@ -3043,7 +3043,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
found_type = btrfs_key_type(&found_key);
|
||||
|
||||
/* No extents, but there might be delalloc bits */
|
||||
if (found_key.objectid != inode->i_ino ||
|
||||
if (found_key.objectid != btrfs_ino(inode) ||
|
||||
found_type != BTRFS_EXTENT_DATA_KEY) {
|
||||
/* have to trust i_size as the end */
|
||||
last = (u64)-1;
|
||||
|
Reference in New Issue
Block a user