All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy.lists@gmail.com>
To: Jim Rees <rees@umich.edu>
Cc: linux-nfs@vger.kernel.org, peter honeyman <honey@citi.umich.edu>
Subject: Re: [PATCH 05/34] pnfs: ask for layout_blksize and save it in nfs_server
Date: Tue, 14 Jun 2011 11:01:49 -0400	[thread overview]
Message-ID: <4DF777DD.9010201@gmail.com> (raw)
In-Reply-To: <6064dfa19fbddca8b7b53fc1602dd9f0dd51284d.1307921137.git.rees@umich.edu>

On 2011-06-12 19:43, Jim Rees wrote:
> From: Peng Tao <bergwolf@gmail.com>

Jim, please revise the authorshop of the different patches.
This for example, was originally authored by
Fred Isaman <iisaman@citi.umich.edu> (see commit 5c5a76f)

Benny

> 
> Block layout needs it to determine IO size.
> 
> Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
> Signed-off-by: Tao Guo <glorioustao@gmail.com>
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  fs/nfs/client.c           |    1 +
>  fs/nfs/nfs4_fs.h          |    2 +-
>  fs/nfs/nfs4proc.c         |    5 +-
>  fs/nfs/nfs4xdr.c          |  101 +++++++++++++++++++++++++++++++++++++--------
>  include/linux/nfs_fs_sb.h |    4 +-
>  include/linux/nfs_xdr.h   |    3 +-
>  6 files changed, 93 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 6bdb7da0..b2c6920 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -937,6 +937,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fh *mntf
>  	if (server->wsize > NFS_MAX_FILE_IO_SIZE)
>  		server->wsize = NFS_MAX_FILE_IO_SIZE;
>  	server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
> +	server->pnfs_blksize = fsinfo->blksize;
>  	set_pnfs_layoutdriver(server, mntfh, fsinfo->layouttype);
>  
>  	server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL);
> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
> index c4a6983..5725a7e 100644
> --- a/fs/nfs/nfs4_fs.h
> +++ b/fs/nfs/nfs4_fs.h
> @@ -315,7 +315,7 @@ extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];
>  extern const u32 nfs4_fattr_bitmap[2];
>  extern const u32 nfs4_statfs_bitmap[2];
>  extern const u32 nfs4_pathconf_bitmap[2];
> -extern const u32 nfs4_fsinfo_bitmap[2];
> +extern const u32 nfs4_fsinfo_bitmap[3];
>  extern const u32 nfs4_fs_locations_bitmap[2];
>  
>  /* nfs4renewd.c */
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 4a5ad93..5246db8 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -137,12 +137,13 @@ const u32 nfs4_pathconf_bitmap[2] = {
>  	0
>  };
>  
> -const u32 nfs4_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE
> +const u32 nfs4_fsinfo_bitmap[3] = { FATTR4_WORD0_MAXFILESIZE
>  			| FATTR4_WORD0_MAXREAD
>  			| FATTR4_WORD0_MAXWRITE
>  			| FATTR4_WORD0_LEASE_TIME,
>  			FATTR4_WORD1_TIME_DELTA
> -			| FATTR4_WORD1_FS_LAYOUT_TYPES
> +			| FATTR4_WORD1_FS_LAYOUT_TYPES,
> +			FATTR4_WORD2_LAYOUT_BLKSIZE
>  };
>  
>  const u32 nfs4_fs_locations_bitmap[2] = {
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index 3620c45..fdcbd8f 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -91,7 +91,7 @@ static int nfs4_stat_to_errno(int);
>  #define encode_getfh_maxsz      (op_encode_hdr_maxsz)
>  #define decode_getfh_maxsz      (op_decode_hdr_maxsz + 1 + \
>  				((3+NFS4_FHSIZE) >> 2))
> -#define nfs4_fattr_bitmap_maxsz 3
> +#define nfs4_fattr_bitmap_maxsz 4
>  #define encode_getattr_maxsz    (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz)
>  #define nfs4_name_maxsz		(1 + ((3 + NFS4_MAXNAMLEN) >> 2))
>  #define nfs4_path_maxsz		(1 + ((3 + NFS4_MAXPATHLEN) >> 2))
> @@ -113,7 +113,11 @@ static int nfs4_stat_to_errno(int);
>  #define encode_restorefh_maxsz  (op_encode_hdr_maxsz)
>  #define decode_restorefh_maxsz  (op_decode_hdr_maxsz)
>  #define encode_fsinfo_maxsz	(encode_getattr_maxsz)
> -#define decode_fsinfo_maxsz	(op_decode_hdr_maxsz + 15)
> +/* The 5 accounts for the PNFS attributes, and assumes that at most three
> + * layout types will be returned.
> + */
> +#define decode_fsinfo_maxsz	(op_decode_hdr_maxsz + \
> +				 nfs4_fattr_bitmap_maxsz + 4 + 8 + 5)
>  #define encode_renew_maxsz	(op_encode_hdr_maxsz + 3)
>  #define decode_renew_maxsz	(op_decode_hdr_maxsz)
>  #define encode_setclientid_maxsz \
> @@ -1095,6 +1099,35 @@ static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm
>  	hdr->replen += decode_getattr_maxsz;
>  }
>  
> +static void
> +encode_getattr_three(struct xdr_stream *xdr,
> +		     uint32_t bm0, uint32_t bm1, uint32_t bm2,
> +		     struct compound_hdr *hdr)
> +{
> +	__be32 *p;
> +
> +	p = reserve_space(xdr, 4);
> +	*p = cpu_to_be32(OP_GETATTR);
> +	if (bm2) {
> +		p = reserve_space(xdr, 16);
> +		*p++ = cpu_to_be32(3);
> +		*p++ = cpu_to_be32(bm0);
> +		*p++ = cpu_to_be32(bm1);
> +		*p = cpu_to_be32(bm2);
> +	} else if (bm1) {
> +		p = reserve_space(xdr, 12);
> +		*p++ = cpu_to_be32(2);
> +		*p++ = cpu_to_be32(bm0);
> +		*p = cpu_to_be32(bm1);
> +	} else {
> +		p = reserve_space(xdr, 8);
> +		*p++ = cpu_to_be32(1);
> +		*p = cpu_to_be32(bm0);
> +	}
> +	hdr->nops++;
> +	hdr->replen += decode_getattr_maxsz;
> +}
> +
>  static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr)
>  {
>  	encode_getattr_two(xdr, bitmask[0] & nfs4_fattr_bitmap[0],
> @@ -1103,8 +1136,11 @@ static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct c
>  
>  static void encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr)
>  {
> -	encode_getattr_two(xdr, bitmask[0] & nfs4_fsinfo_bitmap[0],
> -			   bitmask[1] & nfs4_fsinfo_bitmap[1], hdr);
> +	encode_getattr_three(xdr,
> +			     bitmask[0] & nfs4_fsinfo_bitmap[0],
> +			     bitmask[1] & nfs4_fsinfo_bitmap[1],
> +			     bitmask[2] & nfs4_fsinfo_bitmap[2],
> +			     hdr);
>  }
>  
>  static void encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr)
> @@ -2575,7 +2611,7 @@ static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req,
>  	struct compound_hdr hdr = {
>  		.nops	= 0,
>  	};
> -	const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 };
> +	const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>  
>  	encode_compound_hdr(xdr, req, &hdr);
>  	encode_setclientid_confirm(xdr, arg, &hdr);
> @@ -2719,7 +2755,7 @@ static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req,
>  	struct compound_hdr hdr = {
>  		.minorversion = nfs4_xdr_minorversion(&args->la_seq_args),
>  	};
> -	const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 };
> +	const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>  
>  	encode_compound_hdr(xdr, req, &hdr);
>  	encode_sequence(xdr, &args->la_seq_args, &hdr);
> @@ -2947,14 +2983,17 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
>  		goto out_overflow;
>  	bmlen = be32_to_cpup(p);
>  
> -	bitmap[0] = bitmap[1] = 0;
> +	bitmap[0] = bitmap[1] = bitmap[2] = 0;
>  	p = xdr_inline_decode(xdr, (bmlen << 2));
>  	if (unlikely(!p))
>  		goto out_overflow;
>  	if (bmlen > 0) {
>  		bitmap[0] = be32_to_cpup(p++);
> -		if (bmlen > 1)
> -			bitmap[1] = be32_to_cpup(p);
> +		if (bmlen > 1) {
> +			bitmap[1] = be32_to_cpup(p++);
> +			if (bmlen > 2)
> +				bitmap[2] = be32_to_cpup(p);
> +		}
>  	}
>  	return 0;
>  out_overflow:
> @@ -2986,8 +3025,9 @@ static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint3
>  			return ret;
>  		bitmap[0] &= ~FATTR4_WORD0_SUPPORTED_ATTRS;
>  	} else
> -		bitmask[0] = bitmask[1] = 0;
> -	dprintk("%s: bitmask=%08x:%08x\n", __func__, bitmask[0], bitmask[1]);
> +		bitmask[0] = bitmask[1] = bitmask[2] = 0;
> +	dprintk("%s: bitmask=%08x:%08x:%08x\n", __func__,
> +		bitmask[0], bitmask[1], bitmask[2]);
>  	return 0;
>  }
>  
> @@ -4041,7 +4081,7 @@ out_overflow:
>  static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res)
>  {
>  	__be32 *savep;
> -	uint32_t attrlen, bitmap[2] = {0};
> +	uint32_t attrlen, bitmap[3] = {0};
>  	int status;
>  
>  	if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
> @@ -4067,7 +4107,7 @@ xdr_error:
>  static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat)
>  {
>  	__be32 *savep;
> -	uint32_t attrlen, bitmap[2] = {0};
> +	uint32_t attrlen, bitmap[3] = {0};
>  	int status;
>  
>  	if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
> @@ -4099,7 +4139,7 @@ xdr_error:
>  static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf)
>  {
>  	__be32 *savep;
> -	uint32_t attrlen, bitmap[2] = {0};
> +	uint32_t attrlen, bitmap[3] = {0};
>  	int status;
>  
>  	if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
> @@ -4239,7 +4279,7 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fat
>  {
>  	__be32 *savep;
>  	uint32_t attrlen,
> -		 bitmap[2] = {0};
> +		 bitmap[3] = {0};
>  	int status;
>  
>  	status = decode_op_hdr(xdr, OP_GETATTR);
> @@ -4325,10 +4365,32 @@ static int decode_attr_pnfstype(struct xdr_stream *xdr, uint32_t *bitmap,
>  	return status;
>  }
>  
> +/*
> + * The prefered block size for layout directed io
> + */
> +static int decode_attr_layout_blksize(struct xdr_stream *xdr, uint32_t *bitmap,
> +				      uint32_t *res)
> +{
> +	__be32 *p;
> +
> +	dprintk("%s: bitmap is %x\n", __func__, bitmap[2]);
> +	*res = 0;
> +	if (bitmap[2] & FATTR4_WORD2_LAYOUT_BLKSIZE) {
> +		p = xdr_inline_decode(xdr, 4);
> +		if (unlikely(!p)) {
> +			print_overflow_msg(__func__, xdr);
> +			return -EIO;
> +		}
> +		*res = be32_to_cpup(p);
> +		bitmap[2] &= ~FATTR4_WORD2_LAYOUT_BLKSIZE;
> +	}
> +	return 0;
> +}
> +
>  static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
>  {
>  	__be32 *savep;
> -	uint32_t attrlen, bitmap[2];
> +	uint32_t attrlen, bitmap[3];
>  	int status;
>  
>  	if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
> @@ -4356,6 +4418,9 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
>  	status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype);
>  	if (status != 0)
>  		goto xdr_error;
> +	status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize);
> +	if (status)
> +		goto xdr_error;
>  
>  	status = verify_attr_len(xdr, savep, attrlen);
>  xdr_error:
> @@ -4775,7 +4840,7 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
>  {
>  	__be32 *savep;
>  	uint32_t attrlen,
> -		 bitmap[2] = {0};
> +		 bitmap[3] = {0};
>  	struct kvec *iov = req->rq_rcv_buf.head;
>  	int status;
>  
> @@ -6605,7 +6670,7 @@ out:
>  int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
>  		       int plus)
>  {
> -	uint32_t bitmap[2] = {0};
> +	uint32_t bitmap[3] = {0};
>  	uint32_t len;
>  	__be32 *p = xdr_inline_decode(xdr, 4);
>  	if (unlikely(!p))
> diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
> index 87694ca..79cc4ca 100644
> --- a/include/linux/nfs_fs_sb.h
> +++ b/include/linux/nfs_fs_sb.h
> @@ -130,7 +130,7 @@ struct nfs_server {
>  #endif
>  
>  #ifdef CONFIG_NFS_V4
> -	u32			attr_bitmask[2];/* V4 bitmask representing the set
> +	u32			attr_bitmask[3];/* V4 bitmask representing the set
>  						   of attributes supported on this
>  						   filesystem */
>  	u32			cache_consistency_bitmask[2];
> @@ -143,6 +143,8 @@ struct nfs_server {
>  						   filesystem */
>  	struct pnfs_layoutdriver_type  *pnfs_curr_ld; /* Active layout driver */
>  	struct rpc_wait_queue	roc_rpcwaitq;
> +	void			*pnfs_ld_data; /* per mount point data */
> +	u32			pnfs_blksize; /* layout_blksize attr */
>  
>  	/* the following fields are protected by nfs_client->cl_lock */
>  	struct rb_root		state_owners;
> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
> index 00442f5..a9c43ba 100644
> --- a/include/linux/nfs_xdr.h
> +++ b/include/linux/nfs_xdr.h
> @@ -122,6 +122,7 @@ struct nfs_fsinfo {
>  	struct timespec		time_delta; /* server time granularity */
>  	__u32			lease_time; /* in seconds */
>  	__u32			layouttype; /* supported pnfs layout driver */
> +	__u32			blksize; /* preferred pnfs io block size */
>  };
>  
>  struct nfs_fsstat {
> @@ -954,7 +955,7 @@ struct nfs4_server_caps_arg {
>  };
>  
>  struct nfs4_server_caps_res {
> -	u32				attr_bitmask[2];
> +	u32				attr_bitmask[3];
>  	u32				acl_bitmask;
>  	u32				has_links;
>  	u32				has_symlinks;

  reply	other threads:[~2011-06-14 15:01 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-12 23:43 [PATCH 00/34] pnfs block layout driver based on v3.0-rc2 Jim Rees
2011-06-12 23:43 ` [PATCH 01/34] pnfs: GETDEVICELIST Jim Rees
2011-06-12 23:43 ` [PATCH 02/34] pnfs: add set-clear layoutdriver interface Jim Rees
2011-06-12 23:43 ` [PATCH 03/34] pnfs: let layoutcommit code handle multiple segments Jim Rees
2011-06-13 14:36   ` Fred Isaman
2011-06-14 10:40     ` tao.peng
2011-06-14 13:58       ` Fred Isaman
2011-06-14 14:28       ` Benny Halevy
2011-06-12 23:43 ` [PATCH 04/34] pnfs: hook nfs_write_begin/end to allow layout driver manipulation Jim Rees
2011-06-13 14:44   ` Fred Isaman
2011-06-14 11:01     ` tao.peng
2011-06-14 14:05       ` Fred Isaman
2011-06-14 15:53         ` Peng Tao
2011-06-14 16:02           ` Fred Isaman
2011-06-12 23:43 ` [PATCH 05/34] pnfs: ask for layout_blksize and save it in nfs_server Jim Rees
2011-06-14 15:01   ` Benny Halevy [this message]
2011-06-14 15:08     ` Peng Tao
2011-06-12 23:44 ` [PATCH 06/34] pnfs: cleanup_layoutcommit Jim Rees
2011-06-13 21:19   ` Benny Halevy
2011-06-14 15:16     ` Peng Tao
2011-06-14 15:10   ` Benny Halevy
2011-06-14 15:21     ` Peng Tao
2011-06-14 15:19   ` Benny Halevy
2011-06-12 23:44 ` [PATCH 07/34] pnfsblock: define PNFS_BLOCK Kconfig option Jim Rees
2011-06-14 15:13   ` Benny Halevy
2011-06-12 23:44 ` [PATCH 08/34] pnfsblock: blocklayout stub Jim Rees
2011-06-12 23:44 ` [PATCH 09/34] pnfsblock: layout alloc and free Jim Rees
2011-06-12 23:44 ` [PATCH 10/34] Add support for simple rpc pipefs Jim Rees
2011-06-12 23:44 ` [PATCH 11/34] pnfs-block: Add block device discovery pipe Jim Rees
2011-06-12 23:44 ` [PATCH 12/34] pnfsblock: basic extent code Jim Rees
2011-06-12 23:44 ` [PATCH 13/34] pnfsblock: add device operations Jim Rees
2011-06-12 23:44 ` [PATCH 14/34] pnfsblock: remove " Jim Rees
2011-06-12 23:44 ` [PATCH 15/34] pnfsblock: lseg alloc and free Jim Rees
2011-06-12 23:44 ` [PATCH 16/34] pnfsblock: merge extents Jim Rees
2011-06-12 23:44 ` [PATCH 17/34] pnfsblock: call and parse getdevicelist Jim Rees
2011-06-14 15:36   ` Benny Halevy
2011-06-12 23:44 ` [PATCH 18/34] pnfsblock: allow use of PG_owner_priv_1 flag Jim Rees
2011-06-13 15:56   ` Fred Isaman
2011-06-12 23:44 ` [PATCH 19/34] pnfsblock: xdr decode pnfs_block_layout4 Jim Rees
2011-06-12 23:44 ` [PATCH 20/34] pnfsblock: find_get_extent Jim Rees
2011-06-12 23:44 ` [PATCH 21/34] pnfsblock: SPLITME: add extent manipulation functions Jim Rees
2011-06-14 15:40   ` Benny Halevy
2011-06-12 23:44 ` [PATCH 22/34] pnfsblock: merge rw extents Jim Rees
2011-06-12 23:44 ` [PATCH 23/34] pnfsblock: encode_layoutcommit Jim Rees
2011-06-14 15:44   ` Benny Halevy
2011-06-12 23:44 ` [PATCH 24/34] pnfsblock: cleanup_layoutcommit Jim Rees
2011-06-12 23:44 ` [PATCH 25/34] pnfsblock: bl_read_pagelist Jim Rees
2011-06-12 23:44 ` [PATCH 26/34] pnfsblock: write_begin Jim Rees
2011-06-12 23:44 ` [PATCH 27/34] pnfsblock: write_end Jim Rees
2011-06-12 23:44 ` [PATCH 28/34] pnfsblock: write_end_cleanup Jim Rees
2011-06-12 23:45 ` [PATCH 29/34] pnfsblock: bl_write_pagelist support functions Jim Rees
2011-06-12 23:45 ` [PATCH 30/34] pnfsblock: bl_write_pagelist Jim Rees
2011-06-12 23:45 ` [PATCH 31/34] pnfsblock: note written INVAL areas for layoutcommit Jim Rees
2011-06-12 23:45 ` [PATCH 32/34] pnfsblock: Implement release_inval_marks Jim Rees
2011-06-12 23:45 ` [PATCH 33/34] Add configurable prefetch size for layoutget Jim Rees
2011-06-12 23:45 ` [PATCH 34/34] NFS41: do not update isize if inode needs layoutcommit Jim Rees
2011-06-14 16:15   ` Benny Halevy
2011-06-14 16:22     ` Fred Isaman

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=4DF777DD.9010201@gmail.com \
    --to=bhalevy.lists@gmail.com \
    --cc=honey@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rees@umich.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.