Re: [PATCH 05/34] pnfs: ask for layout_blksize and save it in nfs_server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 14, 2011 at 11:01 PM, Benny Halevy <bhalevy.lists@xxxxxxxxx> wrote:
> On 2011-06-12 19:43, Jim Rees wrote:
>> From: Peng Tao <bergwolf@xxxxxxxxx>
>
> Jim, please revise the authorshop of the different patches.
> This for example, was originally authored by
> Fred Isaman <iisaman@xxxxxxxxxxxxxx> (see commit 5c5a76f)
Sorry, I kind of messed it up when squashing the patchset by hand...

Jim, please also revise the following patches' author. They are not
written by me...
 pnfs: hook nfs_write_begin/end to allow layout driver manipulation
 pnfs: ask for layout_blksize and save it in nfs_server
 pnfs: cleanup_layoutcommit

Thanks,
Tao

>
> Benny
>
>>
>> Block layout needs it to determine IO size.
>>
>> Signed-off-by: Fred Isaman <iisaman@xxxxxxxxxxxxxx>
>> Signed-off-by: Tao Guo <glorioustao@xxxxxxxxx>
>> Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
>> Signed-off-by: Peng Tao <bergwolf@xxxxxxxxx>
>> ---
>> Â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;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux