aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-04-04 14:31:27 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:54:33 -0400
commitcc95bef635a649d595cf8d1cd4fcff5b6bf13023 (patch)
treedbe8e6b5953648dbef4ce26e45f522ed73103238 /fs/btrfs/file.c
parent98ad69cfd2ca8e27250af839bacda1639a7dc3a4 (diff)
Btrfs: log ram bytes properly
When logging changed extents I was logging ram_bytes as the current length, which isn't correct, it's supposed to be the ram bytes of the original extent. This is for compression where even if we split the extent we need to know the ram bytes so when we uncompress the extent we know how big it will be. This was still working out right with compression for some reason but I think we were getting lucky. It was definitely off for prealloc which is why I noticed it, btrfsck was complaining about it. With this patch btrfsck no longer complains after a log replay. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index ade03e6f7bd2..e81e428a8840 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -607,6 +607,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
607 split->block_len = em->block_len; 607 split->block_len = em->block_len;
608 else 608 else
609 split->block_len = split->len; 609 split->block_len = split->len;
610 split->ram_bytes = em->ram_bytes;
610 split->orig_block_len = max(split->block_len, 611 split->orig_block_len = max(split->block_len,
611 em->orig_block_len); 612 em->orig_block_len);
612 split->generation = gen; 613 split->generation = gen;
@@ -632,6 +633,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
632 split->generation = gen; 633 split->generation = gen;
633 split->orig_block_len = max(em->block_len, 634 split->orig_block_len = max(em->block_len,
634 em->orig_block_len); 635 em->orig_block_len);
636 split->ram_bytes = em->ram_bytes;
635 637
636 if (compressed) { 638 if (compressed) {
637 split->block_len = em->block_len; 639 split->block_len = em->block_len;
@@ -1915,6 +1917,7 @@ out:
1915 } else { 1917 } else {
1916 hole_em->start = offset; 1918 hole_em->start = offset;
1917 hole_em->len = end - offset; 1919 hole_em->len = end - offset;
1920 hole_em->ram_bytes = hole_em->len;
1918 hole_em->orig_start = offset; 1921 hole_em->orig_start = offset;
1919 1922
1920 hole_em->block_start = EXTENT_MAP_HOLE; 1923 hole_em->block_start = EXTENT_MAP_HOLE;