diff options
Diffstat (limited to 'fs/btrfs/file.c')
| -rw-r--r-- | fs/btrfs/file.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 238a8e215eb..0c8cc35a8b9 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -368,8 +368,8 @@ int noinline btrfs_drop_extents(struct btrfs_trans_handle *trans, | |||
| 368 | u64 search_start = start; | 368 | u64 search_start = start; |
| 369 | u64 leaf_start; | 369 | u64 leaf_start; |
| 370 | u64 ram_bytes = 0; | 370 | u64 ram_bytes = 0; |
| 371 | u8 compression = 0; | 371 | u8 compression; |
| 372 | u8 encryption = 0; | 372 | u8 encryption; |
| 373 | u16 other_encoding = 0; | 373 | u16 other_encoding = 0; |
| 374 | u64 root_gen; | 374 | u64 root_gen; |
| 375 | u64 root_owner; | 375 | u64 root_owner; |
| @@ -415,6 +415,8 @@ next_slot: | |||
| 415 | leaf_start = 0; | 415 | leaf_start = 0; |
| 416 | root_gen = 0; | 416 | root_gen = 0; |
| 417 | root_owner = 0; | 417 | root_owner = 0; |
| 418 | compression = 0; | ||
| 419 | encryption = 0; | ||
| 418 | extent = NULL; | 420 | extent = NULL; |
| 419 | leaf = path->nodes[0]; | 421 | leaf = path->nodes[0]; |
| 420 | slot = path->slots[0]; | 422 | slot = path->slots[0]; |
| @@ -546,8 +548,12 @@ next_slot: | |||
| 546 | inline_limit - key.offset); | 548 | inline_limit - key.offset); |
| 547 | inode_sub_bytes(inode, extent_end - | 549 | inode_sub_bytes(inode, extent_end - |
| 548 | inline_limit); | 550 | inline_limit); |
| 549 | btrfs_truncate_item(trans, root, path, | 551 | btrfs_set_file_extent_ram_bytes(leaf, extent, |
| 550 | new_size, 1); | 552 | new_size); |
| 553 | if (!compression && !encryption) { | ||
| 554 | btrfs_truncate_item(trans, root, path, | ||
| 555 | new_size, 1); | ||
| 556 | } | ||
| 551 | } | 557 | } |
| 552 | } | 558 | } |
| 553 | /* delete the entire extent */ | 559 | /* delete the entire extent */ |
| @@ -567,8 +573,11 @@ next_slot: | |||
| 567 | new_size = btrfs_file_extent_calc_inline_size( | 573 | new_size = btrfs_file_extent_calc_inline_size( |
| 568 | extent_end - end); | 574 | extent_end - end); |
| 569 | inode_sub_bytes(inode, end - key.offset); | 575 | inode_sub_bytes(inode, end - key.offset); |
| 570 | ret = btrfs_truncate_item(trans, root, path, | 576 | btrfs_set_file_extent_ram_bytes(leaf, extent, |
| 571 | new_size, 0); | 577 | new_size); |
| 578 | if (!compression && !encryption) | ||
| 579 | ret = btrfs_truncate_item(trans, root, path, | ||
| 580 | new_size, 0); | ||
| 572 | BUG_ON(ret); | 581 | BUG_ON(ret); |
| 573 | } | 582 | } |
| 574 | /* create bookend, splitting the extent in two */ | 583 | /* create bookend, splitting the extent in two */ |
