mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 21:21:09 +00:00
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:
parent
0414efae79
commit
33345d0152
13 changed files with 208 additions and 182 deletions
|
@ -166,6 +166,15 @@ static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
|
|||
return container_of(inode, struct btrfs_inode, vfs_inode);
|
||||
}
|
||||
|
||||
static inline u64 btrfs_ino(struct inode *inode)
|
||||
{
|
||||
u64 ino = BTRFS_I(inode)->location.objectid;
|
||||
|
||||
if (ino <= BTRFS_FIRST_FREE_OBJECTID)
|
||||
ino = inode->i_ino;
|
||||
return ino;
|
||||
}
|
||||
|
||||
static inline void btrfs_i_size_write(struct inode *inode, u64 size)
|
||||
{
|
||||
i_size_write(inode, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue