nfs41: add range to layoutreturn args
authorPeng Tao <tao.peng@primarydata.com>
Mon, 17 Nov 2014 01:30:36 +0000 (09:30 +0800)
committerTom Haynes <loghyr@primarydata.com>
Tue, 3 Feb 2015 19:06:49 +0000 (11:06 -0800)
So that callers can specify which range to return.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
fs/nfs/nfs4xdr.c
fs/nfs/pnfs.c
include/linux/nfs_xdr.h

index 3c3ff633dd171e150db918ea24f630e679a38112..56d4c91a48f3de058f93f4f7e72d574b06f96c46 100644 (file)
@@ -2012,11 +2012,11 @@ encode_layoutreturn(struct xdr_stream *xdr,
        p = reserve_space(xdr, 16);
        *p++ = cpu_to_be32(0);          /* reclaim. always 0 for now */
        *p++ = cpu_to_be32(args->layout_type);
-       *p++ = cpu_to_be32(args->iomode);
+       *p++ = cpu_to_be32(args->range.iomode);
        *p = cpu_to_be32(RETURN_FILE);
        p = reserve_space(xdr, 16);
-       p = xdr_encode_hyper(p, 0);
-       p = xdr_encode_hyper(p, NFS4_MAX_UINT64);
+       p = xdr_encode_hyper(p, args->range.offset);
+       p = xdr_encode_hyper(p, args->range.length);
        spin_lock(&args->inode->i_lock);
        encode_nfs4_stateid(xdr, &args->stateid);
        spin_unlock(&args->inode->i_lock);
index 685af4fb39cabd1f1d0c2f0187e0a495aab68844..9549b89e494bb28a790e8472f45e3d8dab2ac189 100644 (file)
@@ -916,7 +916,9 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid,
        lrp->args.stateid = stateid;
        lrp->args.layout_type = NFS_SERVER(ino)->pnfs_curr_ld->id;
        lrp->args.inode = ino;
-       lrp->args.iomode = iomode;
+       lrp->args.range.iomode = iomode;
+       lrp->args.range.offset = 0;
+       lrp->args.range.length = NFS4_MAX_UINT64;
        lrp->args.layout = lo;
        lrp->clp = NFS_SERVER(ino)->nfs_client;
        lrp->cred = lo->plh_lc_cred;
index 6400a1e01aa49fb1ba410fcb9d08466939a22640..363792356d25a47aa19c93407770a9e484a5097b 100644 (file)
@@ -293,7 +293,7 @@ struct nfs4_layoutreturn_args {
        struct nfs4_sequence_args seq_args;
        struct pnfs_layout_hdr *layout;
        struct inode *inode;
-       enum pnfs_iomode iomode;
+       struct pnfs_layout_range range;
        nfs4_stateid stateid;
        __u32   layout_type;
 };