linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Arne Jansen <sensille@gmx.net>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v4 2/7] btrfs: add READAHEAD extent buffer flag
Date: Wed, 29 Jun 2011 16:55:34 -0400	[thread overview]
Message-ID: <4E0B9146.1000100@redhat.com> (raw)
In-Reply-To: <0584fc4d0deca47bd788aaab26ed9e02b4816227.1309375866.git.sensille@gmx.net>

On 06/29/2011 04:10 PM, Arne Jansen wrote:
> Add a READAHEAD extent buffer flag.
> Add a function to trigger a read with this flag set.
> 
> Changes v2:
>  - use extent buffer flags instead of extent state flags
> 
> Signed-off-by: Arne Jansen <sensille@gmx.net>
> ---
>  fs/btrfs/disk-io.c   |   32 ++++++++++++++++++++++++++++++++
>  fs/btrfs/disk-io.h   |    2 ++
>  fs/btrfs/extent_io.h |    1 +
>  3 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index cff882c..20edd2d 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -945,6 +945,38 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize,
>  	return ret;
>  }
>  
> +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize,
> +			 int mirror_num, struct extent_buffer **eb)
> +{
> +	struct extent_buffer *buf = NULL;
> +	struct inode *btree_inode = root->fs_info->btree_inode;
> +	struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree;
> +	int ret;
> +
> +	buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
> +	if (!buf)
> +		return 0;
> +
> +	set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
> +
> +	ret = read_extent_buffer_pages(io_tree, buf, 0, 0, 1, btree_get_extent,
> +				 mirror_num);
> +	if (ret) {
> +		free_extent_buffer(buf);
> +		return ret;
> +	}
> +
> +	if (test_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags)) {
> +		*eb = buf;
> +		return -EIO;

Why are you returning buf here when if you get an error from
read_extent_buffer_pages you free it?  Instead free the extent buffer
and return EIO to be consistent.  Thanks,

Josef

  reply	other threads:[~2011-06-29 20:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 20:10 [PATCH v4 0/6] btrfs: generic readeahead interface Arne Jansen
2011-06-29 20:10 ` [PATCH v4 1/7] btrfs: add an extra wait mode to read_extent_buffer_pages Arne Jansen
2011-06-29 20:50   ` Josef Bacik
2011-06-29 20:10 ` [PATCH v4 2/7] btrfs: add READAHEAD extent buffer flag Arne Jansen
2011-06-29 20:55   ` Josef Bacik [this message]
2011-06-29 20:10 ` [PATCH v4 3/7] btrfs: state information for readahead Arne Jansen
2011-06-29 20:58   ` Josef Bacik
2011-06-29 20:10 ` [PATCH v4 4/7] btrfs: initial readahead code and prototypes Arne Jansen
2011-06-29 21:49   ` Josef Bacik
2011-06-30  7:37     ` Arne Jansen
2011-06-30 12:49       ` Josef Bacik
2011-06-30 14:01         ` Arne Jansen
2011-06-29 20:10 ` [PATCH v4 5/7] btrfs: hooks for readahead Arne Jansen
2011-06-29 20:10 ` [PATCH v4 6/7] btrfs: test ioctl " Arne Jansen
2011-06-29 20:10 ` [PATCH v4 7/7] btrfs: use readahead API for scrub Arne Jansen

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=4E0B9146.1000100@redhat.com \
    --to=josef@redhat.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    /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;
as well as URLs for NNTP newsgroup(s).