public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.yan@oracle.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot
Date: Thu, 11 Feb 2010 15:50:43 +0800	[thread overview]
Message-ID: <4B73B6D3.4070901@oracle.com> (raw)
In-Reply-To: <20100211074300.GA7469@sli10-desk.sh.intel.com>

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>

      reply	other threads:[~2010-02-11  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11  7:43 [PATCH] btrfs: btrfs_mark_extent_written writes correctly slot Shaohua Li
2010-02-11  7:50 ` Yan, Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B73B6D3.4070901@oracle.com \
    --to=zheng.yan@oracle.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=shaohua.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox