diff options
42 files changed, 1212 insertions, 1243 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8299601a3549..7699e16784d3 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
| @@ -956,8 +956,7 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq, | |||
| 956 | /* | 956 | /* |
| 957 | * add all inline backrefs for bytenr to the list | 957 | * add all inline backrefs for bytenr to the list |
| 958 | */ | 958 | */ |
| 959 | static int __add_inline_refs(struct btrfs_fs_info *fs_info, | 959 | static int __add_inline_refs(struct btrfs_path *path, u64 bytenr, |
| 960 | struct btrfs_path *path, u64 bytenr, | ||
| 961 | int *info_level, struct list_head *prefs, | 960 | int *info_level, struct list_head *prefs, |
| 962 | struct ref_root *ref_tree, | 961 | struct ref_root *ref_tree, |
| 963 | u64 *total_refs, u64 inum) | 962 | u64 *total_refs, u64 inum) |
| @@ -1284,7 +1283,7 @@ again: | |||
| 1284 | */ | 1283 | */ |
| 1285 | delayed_refs = &trans->transaction->delayed_refs; | 1284 | delayed_refs = &trans->transaction->delayed_refs; |
| 1286 | spin_lock(&delayed_refs->lock); | 1285 | spin_lock(&delayed_refs->lock); |
| 1287 | head = btrfs_find_delayed_ref_head(trans, bytenr); | 1286 | head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); |
| 1288 | if (head) { | 1287 | if (head) { |
| 1289 | if (!mutex_trylock(&head->mutex)) { | 1288 | if (!mutex_trylock(&head->mutex)) { |
| 1290 | atomic_inc(&head->node.refs); | 1289 | atomic_inc(&head->node.refs); |
| @@ -1354,7 +1353,7 @@ again: | |||
| 1354 | if (key.objectid == bytenr && | 1353 | if (key.objectid == bytenr && |
| 1355 | (key.type == BTRFS_EXTENT_ITEM_KEY || | 1354 | (key.type == BTRFS_EXTENT_ITEM_KEY || |
| 1356 | key.type == BTRFS_METADATA_ITEM_KEY)) { | 1355 | key.type == BTRFS_METADATA_ITEM_KEY)) { |
| 1357 | ret = __add_inline_refs(fs_info, path, bytenr, | 1356 | ret = __add_inline_refs(path, bytenr, |
| 1358 | &info_level, &prefs, | 1357 | &info_level, &prefs, |
| 1359 | ref_tree, &total_refs, | 1358 | ref_tree, &total_refs, |
| 1360 | inum); | 1359 | inum); |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 1a8fa46ff87e..819a6d27218a 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -224,16 +224,16 @@ static inline void btrfs_insert_inode_hash(struct inode *inode) | |||
| 224 | __insert_inode_hash(inode, h); | 224 | __insert_inode_hash(inode, h); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static inline u64 btrfs_ino(struct inode *inode) | 227 | static inline u64 btrfs_ino(struct btrfs_inode *inode) |
| 228 | { | 228 | { |
| 229 | u64 ino = BTRFS_I(inode)->location.objectid; | 229 | u64 ino = inode->location.objectid; |
| 230 | 230 | ||
| 231 | /* | 231 | /* |
| 232 | * !ino: btree_inode | 232 | * !ino: btree_inode |
| 233 | * type == BTRFS_ROOT_ITEM_KEY: subvol dir | 233 | * type == BTRFS_ROOT_ITEM_KEY: subvol dir |
| 234 | */ | 234 | */ |
| 235 | if (!ino || BTRFS_I(inode)->location.type == BTRFS_ROOT_ITEM_KEY) | 235 | if (!ino || inode->location.type == BTRFS_ROOT_ITEM_KEY) |
| 236 | ino = inode->i_ino; | 236 | ino = inode->vfs_inode.i_ino; |
| 237 | return ino; | 237 | return ino; |
| 238 | } | 238 | } |
| 239 | 239 | ||
| @@ -248,23 +248,21 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode) | |||
| 248 | struct btrfs_root *root = BTRFS_I(inode)->root; | 248 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 249 | 249 | ||
| 250 | if (root == root->fs_info->tree_root && | 250 | if (root == root->fs_info->tree_root && |
| 251 | btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID) | 251 | btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID) |
| 252 | return true; | 252 | return true; |
| 253 | if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID) | 253 | if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID) |
| 254 | return true; | 254 | return true; |
| 255 | return false; | 255 | return false; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | 258 | static inline int btrfs_inode_in_log(struct btrfs_inode *inode, u64 generation) |
| 259 | { | 259 | { |
| 260 | int ret = 0; | 260 | int ret = 0; |
| 261 | 261 | ||
| 262 | spin_lock(&BTRFS_I(inode)->lock); | 262 | spin_lock(&inode->lock); |
| 263 | if (BTRFS_I(inode)->logged_trans == generation && | 263 | if (inode->logged_trans == generation && |
| 264 | BTRFS_I(inode)->last_sub_trans <= | 264 | inode->last_sub_trans <= inode->last_log_commit && |
| 265 | BTRFS_I(inode)->last_log_commit && | 265 | inode->last_sub_trans <= inode->root->last_log_commit) { |
| 266 | BTRFS_I(inode)->last_sub_trans <= | ||
| 267 | BTRFS_I(inode)->root->last_log_commit) { | ||
| 268 | /* | 266 | /* |
| 269 | * After a ranged fsync we might have left some extent maps | 267 | * After a ranged fsync we might have left some extent maps |
| 270 | * (that fall outside the fsync's range). So return false | 268 | * (that fall outside the fsync's range). So return false |
| @@ -272,10 +270,10 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | |||
| 272 | * will be called and process those extent maps. | 270 | * will be called and process those extent maps. |
| 273 | */ | 271 | */ |
| 274 | smp_mb(); | 272 | smp_mb(); |
| 275 | if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents)) | 273 | if (list_empty(&inode->extent_tree.modified_extents)) |
| 276 | ret = 1; | 274 | ret = 1; |
| 277 | } | 275 | } |
| 278 | spin_unlock(&BTRFS_I(inode)->lock); | 276 | spin_unlock(&inode->lock); |
| 279 | return ret; | 277 | return ret; |
| 280 | } | 278 | } |
| 281 | 279 | ||
| @@ -326,6 +324,24 @@ static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) | |||
| 326 | &BTRFS_I(inode)->runtime_flags); | 324 | &BTRFS_I(inode)->runtime_flags); |
| 327 | } | 325 | } |
| 328 | 326 | ||
| 327 | static inline void btrfs_print_data_csum_error(struct inode *inode, | ||
| 328 | u64 logical_start, u32 csum, u32 csum_expected, int mirror_num) | ||
| 329 | { | ||
| 330 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 331 | |||
| 332 | /* Output minus objectid, which is more meaningful */ | ||
| 333 | if (root->objectid >= BTRFS_LAST_FREE_OBJECTID) | ||
| 334 | btrfs_warn_rl(root->fs_info, | ||
| 335 | "csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d", | ||
| 336 | root->objectid, btrfs_ino(BTRFS_I(inode)), | ||
| 337 | logical_start, csum, csum_expected, mirror_num); | ||
| 338 | else | ||
| 339 | btrfs_warn_rl(root->fs_info, | ||
| 340 | "csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d", | ||
| 341 | root->objectid, btrfs_ino(BTRFS_I(inode)), | ||
| 342 | logical_start, csum, csum_expected, mirror_num); | ||
| 343 | } | ||
| 344 | |||
| 329 | bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end); | 345 | bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end); |
| 330 | 346 | ||
| 331 | #endif | 347 | #endif |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index c4444d6f439f..903c32c9eb22 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -124,10 +124,8 @@ static int check_compressed_csum(struct inode *inode, | |||
| 124 | kunmap_atomic(kaddr); | 124 | kunmap_atomic(kaddr); |
| 125 | 125 | ||
| 126 | |||
