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/btrfs_inode.h | |
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/btrfs_inode.h')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 57c3bb2884ce..8842a4195f91 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -166,6 +166,15 @@ static inline struct btrfs_inode *BTRFS_I(struct inode *inode) | |||
166 | return container_of(inode, struct btrfs_inode, vfs_inode); | 166 | return container_of(inode, struct btrfs_inode, vfs_inode); |
167 | } | 167 | } |
168 | 168 | ||
169 | static inline u64 btrfs_ino(struct inode *inode) | ||
170 | { | ||
171 | u64 ino = BTRFS_I(inode)->location.objectid; | ||
172 | |||
173 | if (ino <= BTRFS_FIRST_FREE_OBJECTID) | ||
174 | ino = inode->i_ino; | ||
175 | return ino; | ||
176 | } | ||
177 | |||
169 | static inline void btrfs_i_size_write(struct inode *inode, u64 size) | 178 | static inline void btrfs_i_size_write(struct inode *inode, u64 size) |
170 | { | 179 | { |
171 | i_size_write(inode, size); | 180 | i_size_write(inode, size); |