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:
Li Zefan
2011-04-20 10:31:50 +08:00
parent 0414efae79
commit 33345d0152
13 changed files with 208 additions and 182 deletions

View File

@ -7009,8 +7009,8 @@ static noinline int get_new_locations(struct inode *reloc_inode,
cur_pos = extent_key->objectid - offset;
last_byte = extent_key->objectid + extent_key->offset;
ret = btrfs_lookup_file_extent(NULL, root, path, reloc_inode->i_ino,
cur_pos, 0);
ret = btrfs_lookup_file_extent(NULL, root, path,
btrfs_ino(reloc_inode), cur_pos, 0);
if (ret < 0)
goto out;
if (ret > 0) {
@ -7033,7 +7033,7 @@ static noinline int get_new_locations(struct inode *reloc_inode,
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
if (found_key.offset != cur_pos ||
found_key.type != BTRFS_EXTENT_DATA_KEY ||
found_key.objectid != reloc_inode->i_ino)
found_key.objectid != btrfs_ino(reloc_inode))
break;
fi = btrfs_item_ptr(leaf, path->slots[0],
@ -7179,7 +7179,7 @@ next:
break;
}
if (inode && key.objectid != inode->i_ino) {
if (inode && key.objectid != btrfs_ino(inode)) {
BUG_ON(extent_locked);
btrfs_release_path(root, path);
mutex_unlock(&inode->i_mutex);
@ -7488,7 +7488,7 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root,
continue;
if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0)
continue;
if (!inode || inode->i_ino != key.objectid) {
if (!inode || btrfs_ino(inode) != key.objectid) {
iput(inode);
inode = btrfs_ilookup(target_root->fs_info->sb,
key.objectid, target_root, 1);