linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: liubo <liubo2009@cn.fujitsu.com>
To: Arne Jansen <sensille@gmx.net>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v1 2/5] btrfs: state information for readahead
Date: Wed, 25 May 2011 01:22:40 -0400	[thread overview]
Message-ID: <4DDC9220.7070303@cn.fujitsu.com> (raw)
In-Reply-To: <43c351ed5260538ec63c6799d5fd3eac8916d2b7.1306154794.git.sensille@gmx.net>

On 05/23/2011 08:59 AM, Arne Jansen wrote:
> Add state information for readahead to btrfs_fs_info and btrfs_device
> 
> Signed-off-by: Arne Jansen <sensille@gmx.net>
> ---
>  fs/btrfs/ctree.h   |    4 ++++
>  fs/btrfs/disk-io.c |    4 ++++
>  fs/btrfs/volumes.c |    8 ++++++++
>  fs/btrfs/volumes.h |    8 ++++++++
>  4 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 2e61fe1..4a33e30 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -1079,6 +1079,10 @@ struct btrfs_fs_info {
>  
>  	/* filesystem state */
>  	u64 fs_state;
> +
> +	/* readahead tree */
> +	spinlock_t reada_lock;
> +	struct radix_tree_root reada_tree;
>  };
>  
>  /*
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 7753eb9..3d4f9c5 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1803,6 +1803,10 @@ struct btrfs_root *open_ctree(struct super_block *sb,
>  	fs_info->max_inline = 8192 * 1024;
>  	fs_info->metadata_ratio = 0;
>  
> +	/* readahead state */
> +	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS);
> +	spin_lock_init(&fs_info->reada_lock);
> +
>  	fs_info->thread_pool_size = min_t(unsigned long,
>  					  num_online_cpus() + 2, 8);
>  
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 8b9fb8c..800e670 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -396,6 +396,14 @@ static noinline int device_list_add(const char *path,
>  		}
>  		INIT_LIST_HEAD(&device->dev_alloc_list);
>  
> +		/* init readahead state */
> +		spin_lock_init(&device->reada_lock);
> +		device->reada_curr_zone = NULL;
> +		atomic_set(&device->reada_in_flight, 0);
> +		device->reada_next = 0;
> +		INIT_RADIX_TREE(&device->reada_zones, GFP_NOFS);
> +		INIT_RADIX_TREE(&device->reada_extents, GFP_NOFS);
> +
>  		mutex_lock(&fs_devices->device_list_mutex);
>  		list_add(&device->dev_list, &fs_devices->devices);
>  		mutex_unlock(&fs_devices->device_list_mutex);
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index cc2eada..33acd4e 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -86,6 +86,14 @@ struct btrfs_device {
>  	u8 uuid[BTRFS_UUID_SIZE];
>  
>  	struct btrfs_work work;
> +
> +	/* readahead state */
> +	spinlock_t reada_lock;
> +	atomic_t reada_in_flight;
> +	u64 reada_next;
> +	struct reada_zone *reada_curr_zone;

struct reada_zone has not been defined yet...

thanks,
liubo

> +	struct radix_tree_root reada_zones;
> +	struct radix_tree_root reada_extents;
>  };
>  
>  struct btrfs_fs_devices {


  reply	other threads:[~2011-05-25  5:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 12:59 [PATCH v1 0/5] btrfs: generic readeahead interface Arne Jansen
2011-05-23 12:59 ` [PATCH v1 1/5] btrfs: add READAHEAD extent state Arne Jansen
2011-05-23 12:59 ` [PATCH v1 2/5] btrfs: state information for readahead Arne Jansen
2011-05-25  5:22   ` liubo [this message]
2011-05-24  6:48     ` Arne Jansen
2011-05-23 12:59 ` [PATCH v1 3/5] btrfs: initial readahead code and prototypes Arne Jansen
2011-05-26 10:14   ` David Sterba
2011-05-26 10:47     ` Miao Xie
2011-05-26 11:02       ` Arne Jansen
2011-05-23 12:59 ` [PATCH v1 4/5] btrfs: hooks for readahead Arne Jansen
2011-05-23 12:59 ` [PATCH v1 5/5] btrfs: test ioctl " 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=4DDC9220.7070303@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.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).