* [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot
@ 2010-02-11 7:43 Shaohua Li
2010-02-11 7:50 ` Yan, Zheng
0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2010-02-11 7:43 UTC (permalink / raw)
To: chris.mason, linux-btrfs; +Cc: zheng.yan
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>
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9d08096..6ed434a 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -720,13 +720,15 @@ again:
inode->i_ino, orig_offset);
BUG_ON(ret);
}
- fi = btrfs_item_ptr(leaf, path->slots[0],
- struct btrfs_file_extent_item);
if (del_nr == 0) {
+ fi = btrfs_item_ptr(leaf, path->slots[0],
+ struct btrfs_file_extent_item);
btrfs_set_file_extent_type(leaf, fi,
BTRFS_FILE_EXTENT_REG);
btrfs_mark_buffer_dirty(leaf);
} else {
+ fi = btrfs_item_ptr(leaf, del_slot - 1,
+ struct btrfs_file_extent_item);
btrfs_set_file_extent_type(leaf, fi,
BTRFS_FILE_EXTENT_REG);
btrfs_set_file_extent_num_bytes(leaf, fi,
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot
2010-02-11 7:43 [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot Shaohua Li
@ 2010-02-11 7:50 ` Yan, Zheng
0 siblings, 0 replies; 2+ messages in thread
From: Yan, Zheng @ 2010-02-11 7:50 UTC (permalink / raw)
To: Shaohua Li; +Cc: chris.mason, linux-btrfs
On 02/11/2010 03:43 PM, Shaohua Li wrote:
> 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>
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 9d08096..6ed434a 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -720,13 +720,15 @@ again:
> inode->i_ino, orig_offset);
> BUG_ON(ret);
> }
> - fi = btrfs_item_ptr(leaf, path->slots[0],
> - struct btrfs_file_extent_item);
> if (del_nr == 0) {
> + fi = btrfs_item_ptr(leaf, path->slots[0],
> + struct btrfs_file_extent_item);
> btrfs_set_file_extent_type(leaf, fi,
> BTRFS_FILE_EXTENT_REG);
> btrfs_mark_buffer_dirty(leaf);
> } else {
> + fi = btrfs_item_ptr(leaf, del_slot - 1,
> + struct btrfs_file_extent_item);
> btrfs_set_file_extent_type(leaf, fi,
> BTRFS_FILE_EXTENT_REG);
> btrfs_set_file_extent_num_bytes(leaf, fi,
Acked-by: Yan Zheng <zheng.yan@oracle.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-11 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11 7:43 [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot Shaohua Li
2010-02-11 7:50 ` Yan, Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox