linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anna Schumaker <schumaker.anna@gmail.com>
To: Weston Andros Adamson <dros@primarydata.com>,
	trond.myklebust@primarydata.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 13/17] nfs: remove list of [rw]data from pgio header
Date: Wed, 23 Apr 2014 10:16:57 -0400	[thread overview]
Message-ID: <5357CB59.9060704@gmail.com> (raw)
In-Reply-To: <1398202165-78897-14-git-send-email-dros@primarydata.com>

On 04/22/2014 05:29 PM, Weston Andros Adamson wrote:
> Since the ability to split pages into subpage requests has been added,
> nfs_pgio_header->rpc_list only ever has one wdata/rdata.
>
> Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
> ---
>  fs/nfs/pnfs.c           | 41 +++++++++++++++--------------------------
>  fs/nfs/read.c           | 35 +++++------------------------------
>  fs/nfs/write.c          | 38 +++++++-------------------------------
>  include/linux/nfs_xdr.h | 35 ++++++++++++++++++-----------------
>  4 files changed, 45 insertions(+), 104 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 7c89385..3b3ec46 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1600,23 +1600,18 @@ pnfs_try_to_write_data(struct nfs_write_data *wdata,
>  }
>  
>  static void
> -pnfs_do_multiple_writes(struct nfs_pageio_descriptor *desc, struct list_head *head, int how)
> +pnfs_do_write(struct nfs_pageio_descriptor *desc,
> +	      struct nfs_pgio_header *hdr, int how)
>  {
> -	struct nfs_write_data *data;
> +	struct nfs_write_data *data = hdr->data.write;
>  	const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
>  	struct pnfs_layout_segment *lseg = desc->pg_lseg;
> +	enum pnfs_try_status trypnfs;
>  
>  	desc->pg_lseg = NULL;
> -	while (!list_empty(head)) {
> -		enum pnfs_try_status trypnfs;
> -
> -		data = list_first_entry(head, struct nfs_write_data, list);
> -		list_del_init(&data->list);
> -
> -		trypnfs = pnfs_try_to_write_data(data, call_ops, lseg, how);
> -		if (trypnfs == PNFS_NOT_ATTEMPTED)
> -			pnfs_write_through_mds(desc, data);
> -	}
> +	trypnfs = pnfs_try_to_write_data(data, call_ops, lseg, how);
> +	if (trypnfs == PNFS_NOT_ATTEMPTED)
> +		pnfs_write_through_mds(desc, data);
>  	pnfs_put_lseg(lseg);
>  }
>  
> @@ -1650,7 +1645,7 @@ pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
>  		pnfs_put_lseg(desc->pg_lseg);
>  		desc->pg_lseg = NULL;
>  	} else
> -		pnfs_do_multiple_writes(desc, &hdr->rpc_list, desc->pg_ioflags);
> +		pnfs_do_write(desc, hdr, desc->pg_ioflags);
>  	if (atomic_dec_and_test(&hdr->refcnt))
>  		hdr->completion_ops->completion(hdr);
>  	return ret;
> @@ -1758,23 +1753,17 @@ pnfs_try_to_read_data(struct nfs_read_data *rdata,
>  }
>  
>  static void
> -pnfs_do_multiple_reads(struct nfs_pageio_descriptor *desc, struct list_head *head)
> +pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr)
>  {
> -	struct nfs_read_data *data;
> +	struct nfs_read_data *data = hdr->data.read;
>  	const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
>  	struct pnfs_layout_segment *lseg = desc->pg_lseg;
> +	enum pnfs_try_status trypnfs;
>  
>  	desc->pg_lseg = NULL;
> -	while (!list_empty(head)) {
> -		enum pnfs_try_status trypnfs;
> -
> -		data = list_first_entry(head, struct nfs_read_data, list);
> -		list_del_init(&data->list);
> -
> -		trypnfs = pnfs_try_to_read_data(data, call_ops, lseg);
> -		if (trypnfs == PNFS_NOT_ATTEMPTED)
> -			pnfs_read_through_mds(desc, data);
> -	}
> +	trypnfs = pnfs_try_to_read_data(data, call_ops, lseg);
> +	if (trypnfs == PNFS_NOT_ATTEMPTED)
> +		pnfs_read_through_mds(desc, data);
>  	pnfs_put_lseg(lseg);
>  }
>  
> @@ -1809,7 +1798,7 @@ pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
>  		pnfs_put_lseg(desc->pg_lseg);
>  		desc->pg_lseg = NULL;
>  	} else
> -		pnfs_do_multiple_reads(desc, &hdr->rpc_list);
> +		pnfs_do_read(desc, hdr);
>  	if (atomic_dec_and_test(&hdr->refcnt))
>  		hdr->completion_ops->completion(hdr);
>  	return ret;
> diff --git a/fs/nfs/read.c b/fs/nfs/read.c
> index daeff0c..c6b7dd0 100644
> --- a/fs/nfs/read.c
> +++ b/fs/nfs/read.c
> @@ -42,7 +42,6 @@ struct nfs_read_header *nfs_readhdr_alloc(void)
>  		struct nfs_pgio_header *hdr = &rhdr->header;
>  
>  		INIT_LIST_HEAD(&hdr->pages);
> -		INIT_LIST_HEAD(&hdr->rpc_list);
>  		spin_lock_init(&hdr->lock);
>  		atomic_set(&hdr->refcnt, 0);
>  	}
> @@ -286,26 +285,6 @@ static int nfs_do_read(struct nfs_read_data *data,
>  	return nfs_initiate_read(NFS_CLIENT(inode), data, call_ops, 0);
>  }
>  
> -static int
> -nfs_do_multiple_reads(struct list_head *head,
> -		const struct rpc_call_ops *call_ops)
> -{
> -	struct nfs_read_data *data;
> -	int ret = 0;
> -
> -	while (!list_empty(head)) {
> -		int ret2;
> -
> -		data = list_first_entry(head, struct nfs_read_data, list);
> -		list_del_init(&data->list);
> -
> -		ret2 = nfs_do_read(data, call_ops);
> -		if (ret == 0)
> -			ret = ret2;
> -	}
> -	return ret;
> -}
> -
>  static void
>  nfs_async_read_error(struct list_head *head)
>  {
> @@ -327,12 +306,8 @@ static void nfs_pagein_error(struct nfs_pageio_descriptor *desc,
>  		struct nfs_pgio_header *hdr)
>  {
>  	set_bit(NFS_IOHDR_REDO, &hdr->flags);
> -	while (!list_empty(&hdr->rpc_list)) {
> -		struct nfs_read_data *data = list_first_entry(&hdr->rpc_list,
> -				struct nfs_read_data, list);
> -		list_del(&data->list);
> -		nfs_readdata_release(data);
> -	}
> +	nfs_readdata_release(hdr->data.read);
> +	hdr->data.read = NULL;
>  	desc->pg_completion_ops->error_cleanup(&desc->pg_list);
>  }
>  
> @@ -364,7 +339,8 @@ int nfs_generic_pagein(struct nfs_pageio_descriptor *desc,
>  	}
>  
>  	nfs_read_rpcsetup(data, desc->pg_count, 0);
> -	list_add(&data->list, &hdr->rpc_list);
> +	WARN_ON_ONCE(hdr->data.read);
> +	hdr->data.read = data;
>  	desc->pg_rpc_callops = &nfs_read_common_ops;
>  	return 0;
>  }
> @@ -386,8 +362,7 @@ static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
>  	atomic_inc(&hdr->refcnt);
>  	ret = nfs_generic_pagein(desc, hdr);
>  	if (ret == 0)
> -		ret = nfs_do_multiple_reads(&hdr->rpc_list,
> -					    desc->pg_rpc_callops);
> +		ret = nfs_do_read(hdr->data.read, desc->pg_rpc_callops);
>  	if (atomic_dec_and_test(&hdr->refcnt))
>  		hdr->completion_ops->completion(hdr);
>  	return ret;
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index f40db93..cd24a14 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -79,7 +79,6 @@ struct nfs_write_header *nfs_writehdr_alloc(void)
>  
>  		memset(p, 0, sizeof(*p));
>  		INIT_LIST_HEAD(&hdr->pages);
> -		INIT_LIST_HEAD(&hdr->rpc_list);
>  		spin_lock_init(&hdr->lock);
>  		atomic_set(&hdr->refcnt, 0);
>  		hdr->verf = &p->verf;
> @@ -1171,26 +1170,6 @@ static int nfs_do_write(struct nfs_write_data *data,
>  	return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0);
>  }
>  
> -static int nfs_do_multiple_writes(struct list_head *head,
> -		const struct rpc_call_ops *call_ops,
> -		int how)
> -{
> -	struct nfs_write_data *data;
> -	int ret = 0;
> -
> -	while (!list_empty(head)) {
> -		int ret2;
> -
> -		data = list_first_entry(head, struct nfs_write_data, list);
> -		list_del_init(&data->list);
> -		
> -		ret2 = nfs_do_write(data, call_ops, how);
> -		 if (ret == 0)
> -			 ret = ret2;
> -	}
> -	return ret;
> -}
> -
>  /* If a nfs_flush_* function fails, it should remove reqs from @head and
>   * call this on each, which will prepare them to be retried on next
>   * writeback using standard nfs.
> @@ -1223,12 +1202,8 @@ static void nfs_flush_error(struct nfs_pageio_descriptor *desc,
>  		struct nfs_pgio_header *hdr)
>  {
>  	set_bit(NFS_IOHDR_REDO, &hdr->flags);
> -	while (!list_empty(&hdr->rpc_list)) {
> -		struct nfs_write_data *data = list_first_entry(&hdr->rpc_list,
> -				struct nfs_write_data, list);
> -		list_del(&data->list);
> -		nfs_writedata_release(data);
> -	}
> +	nfs_writedata_release(hdr->data.write);
> +	hdr->data.write = NULL;
>  	desc->pg_completion_ops->error_cleanup(&desc->pg_list);
>  }
>  
> @@ -1275,7 +1250,8 @@ int nfs_generic_flush(struct nfs_pageio_descriptor *desc,
>  
>  	/* Set up the argument struct */
>  	nfs_write_rpcsetup(data, desc->pg_count, 0, desc->pg_ioflags, &cinfo);
> -	list_add(&data->list, &hdr->rpc_list);
> +	WARN_ON_ONCE(hdr->data.write);
> +	hdr->data.write = data;
>  	desc->pg_rpc_callops = &nfs_write_common_ops;
>  	return 0;
>  }
> @@ -1297,9 +1273,9 @@ static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
>  	atomic_inc(&hdr->refcnt);
>  	ret = nfs_generic_flush(desc, hdr);
>  	if (ret == 0)
> -		ret = nfs_do_multiple_writes(&hdr->rpc_list,
> -					     desc->pg_rpc_callops,
> -					     desc->pg_ioflags);
> +		ret = nfs_do_write(hdr->data.write,
> +				   desc->pg_rpc_callops,
> +				   desc->pg_ioflags);
>  	if (atomic_dec_and_test(&hdr->refcnt))
>  		hdr->completion_ops->completion(hdr);
>  	return ret;
> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
> index 6fb5b23..239274d 100644
> --- a/include/linux/nfs_xdr.h
> +++ b/include/linux/nfs_xdr.h
> @@ -1266,7 +1266,6 @@ struct nfs_page_array {
>  
>  struct nfs_read_data {
>  	struct nfs_pgio_header	*header;
> -	struct list_head	list;
>  	struct rpc_task		task;
>  	struct nfs_fattr	fattr;	/* fattr storage */
>  	struct nfs_readargs args;
> @@ -1278,6 +1277,20 @@ struct nfs_read_data {
>  	struct nfs_client	*ds_clp;	/* pNFS data server */
>  };
>  
> +struct nfs_write_data {
> +	struct nfs_pgio_header	*header;
> +	struct rpc_task		task;
> +	struct nfs_fattr	fattr;
> +	struct nfs_writeverf	verf;
> +	struct nfs_writeargs	args;		/* argument struct */
> +	struct nfs_writeres	res;		/* result struct */
> +	unsigned long		timestamp;	/* For lease renewal */
> +	int (*write_done_cb)(struct rpc_task *, struct nfs_write_data *);
> +	__u64			mds_offset;	/* Filelayout dense stripe */
> +	struct nfs_page_array	pages;
> +	struct nfs_client	*ds_clp;	/* pNFS data server */
> +};
> +
>  /* used as flag bits in nfs_pgio_header */
>  enum {
>  	NFS_IOHDR_ERROR = 0,
> @@ -1291,7 +1304,10 @@ struct nfs_pgio_header {
>  	struct inode		*inode;
>  	struct rpc_cred		*cred;
>  	struct list_head	pages;
> -	struct list_head	rpc_list;
> +	union {
> +		struct nfs_read_data *read;
> +		struct nfs_write_data *write;
> +	}			data;

The first 5 patches in my series makes it so we can share all of these structs.  Would it be useful to put those in first?

Anna

>  	atomic_t		refcnt;
>  	struct nfs_page		*req;
>  	struct nfs_writeverf	*verf;
> @@ -1315,21 +1331,6 @@ struct nfs_read_header {
>  	struct nfs_read_data	rpc_data;
>  };
>  
> -struct nfs_write_data {
> -	struct nfs_pgio_header	*header;
> -	struct list_head	list;
> -	struct rpc_task		task;
> -	struct nfs_fattr	fattr;
> -	struct nfs_writeverf	verf;
> -	struct nfs_writeargs	args;		/* argument struct */
> -	struct nfs_writeres	res;		/* result struct */
> -	unsigned long		timestamp;	/* For lease renewal */
> -	int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
> -	__u64			mds_offset;	/* Filelayout dense stripe */
> -	struct nfs_page_array	pages;
> -	struct nfs_client	*ds_clp;	/* pNFS data server */
> -};
> -
>  struct nfs_write_header {
>  	struct nfs_pgio_header	header;
>  	struct nfs_write_data	rpc_data;


  reply	other threads:[~2014-04-23 14:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 21:29 [PATCH 00/17] nfs: support multiple requests per page Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 01/17] nfs: clean up PG_* flags Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 02/17] nfs: remove unused arg from nfs_create_request Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 03/17] nfs: modify pg_test interface to return size_t Weston Andros Adamson
2014-04-23 12:30   ` Boaz Harrosh
2014-04-22 21:29 ` [PATCH 04/17] nfs: call nfs_can_coalesce_requests for every req Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 05/17] nfs: add support for multiple nfs reqs per page Weston Andros Adamson
2014-04-22 21:40   ` Weston Andros Adamson
2014-04-23 14:40     ` Weston Andros Adamson
2014-04-24 14:50   ` Jeff Layton
2014-04-24 15:23     ` Weston Andros Adamson
2014-04-24 15:45       ` Jeff Layton
2014-04-24 16:15         ` Weston Andros Adamson
2014-04-24 16:52           ` Jeff Layton
2014-04-24 17:23             ` Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 06/17] nfs: page group syncing in read path Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 07/17] nfs: page group syncing in write path Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 08/17] nfs: page group support in nfs_mark_uptodate Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 09/17] pnfs: clean up filelayout_alloc_commit_info Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 10/17] nfs: allow coalescing of subpage requests Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 11/17] nfs: chain calls to pg_test Weston Andros Adamson
2014-04-23 12:20   ` Boaz Harrosh
2014-04-23 13:37     ` Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 12/17] nfs: use > 1 request to handle bsize < PAGE_SIZE Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 13/17] nfs: remove list of [rw]data from pgio header Weston Andros Adamson
2014-04-23 14:16   ` Anna Schumaker [this message]
2014-04-23 14:31     ` Weston Andros Adamson
2014-04-23 14:36       ` Anna Schumaker
2014-04-23 17:44         ` Weston Andros Adamson
2014-04-23 17:51           ` Anna Schumaker
2014-04-24 11:55             ` Boaz Harrosh
2014-04-22 21:29 ` [PATCH 14/17] pnfs: support multiple verfs per direct req Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 15/17] pnfs: allow non page aligned pnfs layout segments Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 16/17] pnfs: filelayout: support non page aligned layouts Weston Andros Adamson
2014-04-22 21:29 ` [PATCH 17/17] nfs: support page groups in nfs_read_completion Weston Andros Adamson

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=5357CB59.9060704@gmail.com \
    --to=schumaker.anna@gmail.com \
    --cc=dros@primarydata.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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;
as well as URLs for NNTP newsgroup(s).