diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-04-19 22:31:50 -0400 |
---|---|---|
committer | Li Zefan <lizf@cn.fujitsu.com> | 2011-04-25 04:46:09 -0400 |
commit | 33345d01522f8152f99dc84a3e7a1a45707f387f (patch) | |
tree | 6a978702dc4421768e63501fa15bc8fedd5bff32 /fs/btrfs/extent-tree.c | |
parent | 0414efae7989a2183fb2cc000ab285c4c2836a00 (diff) |
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>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 904eae10ec65..a0e818cb0401 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7009,8 +7009,8 @@ static noinline int get_new_locations(struct inode *reloc_inode, | |||
7009 | 7009 | ||
7010 | cur_pos = extent_key->objectid - offset; | 7010 | cur_pos = extent_key->objectid - offset; |
7011 | last_byte = extent_key->objectid + extent_key->offset; | 7011 | last_byte = extent_key->objectid + extent_key->offset; |
7012 | ret = btrfs_lookup_file_extent(NULL, root, path, reloc_inode->i_ino, | 7012 | ret = btrfs_lookup_file_extent(NULL, root, path, |
7013 | cur_pos, 0); | 7013 | btrfs_ino(reloc_inode), cur_pos, 0); |
7014 | if (ret < 0) | 7014 | if (ret < 0) |
7015 | goto out; | 7015 | goto out; |
7016 | if (ret > 0) { | 7016 | if (ret > 0) { |
@@ -7033,7 +7033,7 @@ static noinline int get_new_locations(struct inode *reloc_inode, | |||
7033 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); | 7033 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); |
7034 | if (found_key.offset != cur_pos || | 7034 | if (found_key.offset != cur_pos || |
7035 | found_key.type != BTRFS_EXTENT_DATA_KEY || | 7035 | found_key.type != BTRFS_EXTENT_DATA_KEY || |
7036 | found_key.objectid != reloc_inode->i_ino) | 7036 | found_key.objectid != btrfs_ino(reloc_inode)) |
7037 | break; | 7037 | break; |
7038 | 7038 | ||
7039 | fi = btrfs_item_ptr(leaf, path->slots[0], | 7039 | fi = btrfs_item_ptr(leaf, path->slots[0], |
@@ -7179,7 +7179,7 @@ next: | |||
7179 | break; | 7179 | break; |
7180 | } | 7180 | } |
7181 | 7181 | ||
7182 | if (inode && key.objectid != inode->i_ino) { | 7182 | if (inode && key.objectid != btrfs_ino(inode)) { |
7183 | BUG_ON(extent_locked); | 7183 | BUG_ON(extent_locked); |
7184 | btrfs_release_path(root, path); | 7184 | btrfs_release_path(root, path); |
7185 | mutex_unlock(&inode->i_mutex); | 7185 | mutex_unlock(&inode->i_mutex); |
@@ -7488,7 +7488,7 @@ static noinline int invalidate_extent_cache(struct btrfs_root *root, | |||
7488 | continue; | 7488 | continue; |
7489 | if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0) | 7489 | if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0) |
7490 | continue; | 7490 | continue; |
7491 | if (!inode || inode->i_ino != key.objectid) { | 7491 | if (!inode || btrfs_ino(inode) != key.objectid) { |
7492 | iput(inode); | 7492 | iput(inode); |
7493 | inode = btrfs_ilookup(target_root->fs_info->sb, | 7493 | inode = btrfs_ilookup(target_root->fs_info->sb, |
7494 | key.objectid, target_root, 1); | 7494 | key.objectid, target_root, 1); |