diff options
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 52d7eca8c7b..d9f99a16edd 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -34,6 +34,9 @@ struct btrfs_inode { | |||
34 | */ | 34 | */ |
35 | struct btrfs_key location; | 35 | struct btrfs_key location; |
36 | 36 | ||
37 | /* Lock for counters */ | ||
38 | spinlock_t lock; | ||
39 | |||
37 | /* the extent_tree has caches of all the extent mappings to disk */ | 40 | /* the extent_tree has caches of all the extent mappings to disk */ |
38 | struct extent_map_tree extent_tree; | 41 | struct extent_map_tree extent_tree; |
39 | 42 | ||
@@ -134,8 +137,8 @@ struct btrfs_inode { | |||
134 | * items we think we'll end up using, and reserved_extents is the number | 137 | * items we think we'll end up using, and reserved_extents is the number |
135 | * of extent items we've reserved metadata for. | 138 | * of extent items we've reserved metadata for. |
136 | */ | 139 | */ |
137 | atomic_t outstanding_extents; | 140 | unsigned outstanding_extents; |
138 | atomic_t reserved_extents; | 141 | unsigned reserved_extents; |
139 | 142 | ||
140 | /* | 143 | /* |
141 | * ordered_data_close is set by truncate when a file that used | 144 | * ordered_data_close is set by truncate when a file that used |
@@ -173,7 +176,11 @@ static inline u64 btrfs_ino(struct inode *inode) | |||
173 | { | 176 | { |
174 | u64 ino = BTRFS_I(inode)->location.objectid; | 177 | u64 ino = BTRFS_I(inode)->location.objectid; |
175 | 178 | ||
176 | if (ino <= BTRFS_FIRST_FREE_OBJECTID) | 179 | /* |
180 | * !ino: btree_inode | ||
181 | * type == BTRFS_ROOT_ITEM_KEY: subvol dir | ||
182 | */ | ||
183 | if (!ino || BTRFS_I(inode)->location.type == BTRFS_ROOT_ITEM_KEY) | ||
177 | ino = inode->i_ino; | 184 | ino = inode->i_ino; |
178 | return ino; | 185 | return ino; |
179 | } | 186 | } |
@@ -184,4 +191,13 @@ static inline void btrfs_i_size_write(struct inode *inode, u64 size) | |||
184 | BTRFS_I(inode)->disk_i_size = size; | 191 | BTRFS_I(inode)->disk_i_size = size; |
185 | } | 192 | } |
186 | 193 | ||
194 | static inline bool btrfs_is_free_space_inode(struct btrfs_root *root, | ||
195 | struct inode *inode) | ||
196 | { | ||
197 | if (root == root->fs_info->tree_root || | ||
198 | BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID) | ||
199 | return true; | ||
200 | return false; | ||
201 | } | ||
202 | |||
187 | #endif | 203 | #endif |