diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-12-03 10:31:19 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-12-16 20:46:23 -0500 |
commit | b493968096944a11422c4d80fb87af537ca1cac7 (patch) | |
tree | e1ab00ec2a527615c2f17c2665e6597fc3b81c7d /fs/btrfs/file.c | |
parent | b812ce28796f746f14ba6cc451250c422db447b2 (diff) |
Btrfs: keep track of the extents original block length
If we've written to a prealloc extent we need to know the original block len
for the extent. We can't figure this out currently since ->block_len is
just set to the extent length. So introduce ->orig_block_len so that we
know how many bytes were in the original extent for proper extent logging
that future patches will need. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7f4654a15207..6810145f4e97 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -588,6 +588,8 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
588 | split->block_len = em->block_len; | 588 | split->block_len = em->block_len; |
589 | else | 589 | else |
590 | split->block_len = split->len; | 590 | split->block_len = split->len; |
591 | split->orig_block_len = max(split->block_len, | ||
592 | em->orig_block_len); | ||
591 | split->generation = gen; | 593 | split->generation = gen; |
592 | split->bdev = em->bdev; | 594 | split->bdev = em->bdev; |
593 | split->flags = flags; | 595 | split->flags = flags; |
@@ -609,6 +611,8 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
609 | split->flags = flags; | 611 | split->flags = flags; |
610 | split->compress_type = em->compress_type; | 612 | split->compress_type = em->compress_type; |
611 | split->generation = gen; | 613 | split->generation = gen; |
614 | split->orig_block_len = max(em->block_len, | ||
615 | em->orig_block_len); | ||
612 | 616 | ||
613 | if (compressed) { | 617 | if (compressed) { |
614 | split->block_len = em->block_len; | 618 | split->block_len = em->block_len; |
@@ -1838,6 +1842,7 @@ out: | |||
1838 | 1842 | ||
1839 | hole_em->block_start = EXTENT_MAP_HOLE; | 1843 | hole_em->block_start = EXTENT_MAP_HOLE; |
1840 | hole_em->block_len = 0; | 1844 | hole_em->block_len = 0; |
1845 | hole_em->orig_block_len = 0; | ||
1841 | hole_em->bdev = root->fs_info->fs_devices->latest_bdev; | 1846 | hole_em->bdev = root->fs_info->fs_devices->latest_bdev; |
1842 | hole_em->compress_type = BTRFS_COMPRESS_NONE; | 1847 | hole_em->compress_type = BTRFS_COMPRESS_NONE; |
1843 | hole_em->generation = trans->transid; | 1848 | hole_em->generation = trans->transid; |