diff options
author | Shaohua Li <shaohua.li@intel.com> | 2010-02-11 02:43:00 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-02-12 16:47:19 -0500 |
commit | 3f6fae9559225741c91f1320090b285da1413290 (patch) | |
tree | 94c1a90aaed740d80cfa701b8c4abad5bbb699df /fs/btrfs/file.c | |
parent | 23b5c50945f2294add0137799400329c0ebba290 (diff) |
Btrfs: btrfs_mark_extent_written uses the wrong slot
My test do: fallocate a big file and do write. The file is 512M, but
after file write is done btrfs-debug-tree shows:
item 6 key (257 EXTENT_DATA 0) itemoff 3516 itemsize 53
extent data disk byte 1103101952 nr 536870912
extent data offset 0 nr 399634432 ram 536870912
extent compression 0
Looks like a regression introducted by
6c7d54ac87f338c479d9729e8392eca3f76e11e1, where we set wrong slot.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 413a30dafcda..a7fd9f3a750a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -720,13 +720,15 @@ again: | |||
720 | inode->i_ino, orig_offset); | 720 | inode->i_ino, orig_offset); |
721 | BUG_ON(ret); | 721 | BUG_ON(ret); |
722 | } | 722 | } |
723 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
724 | struct btrfs_file_extent_item); | ||
725 | if (del_nr == 0) { | 723 | if (del_nr == 0) { |
724 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
725 | struct btrfs_file_extent_item); | ||
726 | btrfs_set_file_extent_type(leaf, fi, | 726 | btrfs_set_file_extent_type(leaf, fi, |
727 | BTRFS_FILE_EXTENT_REG); | 727 | BTRFS_FILE_EXTENT_REG); |
728 | btrfs_mark_buffer_dirty(leaf); | 728 | btrfs_mark_buffer_dirty(leaf); |
729 | } else { | 729 | } else { |
730 | fi = btrfs_item_ptr(leaf, del_slot - 1, | ||
731 | struct btrfs_file_extent_item); | ||
730 | btrfs_set_file_extent_type(leaf, fi, | 732 | btrfs_set_file_extent_type(leaf, fi, |
731 | BTRFS_FILE_EXTENT_REG); | 733 | BTRFS_FILE_EXTENT_REG); |
732 | btrfs_set_file_extent_num_bytes(leaf, fi, | 734 | btrfs_set_file_extent_num_bytes(leaf, fi, |