[pnfs] [PATCH 2/7] nfs4_pnfs_layout_segment: use for layoutget
Benny Halevy
bhalevy at panasas.com
Thu Aug 30 09:13:09 EDT 2007
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
fs/nfs/nfs4xdr.c | 24 ++++++++++++------------
fs/nfs/pnfs.c | 22 +++++++++++-----------
include/linux/pnfs_xdr.h | 8 ++------
3 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index dfcbc4b..24d8764 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1638,18 +1638,18 @@ static int encode_pnfs_layoutget(struct xdr_stream *xdr, const struct nfs4_pnfs_
WRITE32(OP_LAYOUTGET);
WRITE32(0); /* Signal layout available */
WRITE32(args->type);
- WRITE32(args->iomode);
- WRITE64(args->offset);
- WRITE64(args->length);
+ WRITE32(args->lseg.iomode);
+ WRITE64(args->lseg.offset);
+ WRITE64(args->lseg.length);
WRITE64(args->minlength);
WRITE32(args->maxcount);
dprintk("%s: 1st type:%d iomode:%d off:%lu len:%lu mc:%d\n",
__FUNCTION__,
args->type,
- args->iomode,
- (unsigned long)args->offset,
- (unsigned long)args->length,
+ args->lseg.iomode,
+ (unsigned long)args->lseg.offset,
+ (unsigned long)args->lseg.length,
args->maxcount);
return 0;
}
@@ -5186,17 +5186,17 @@ static int decode_pnfs_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req, s
return status;
READ_BUF(32);
READ32(res->return_on_close);
- READ64(res->offset);
- READ64(res->length);
- READ32(res->iomode);
+ READ64(res->lseg.offset);
+ READ64(res->lseg.length);
+ READ32(res->lseg.iomode);
READ32(res->type);
READ32(res->layout.len);
dprintk("%s roff:%lu rlen:%lu riomode:%d, lo_type:%d, lo.len:%d\n",
__FUNCTION__,
- (unsigned long)res->offset,
- (unsigned long)res->length,
- res->iomode,
+ (unsigned long)res->lseg.offset,
+ (unsigned long)res->lseg.length,
+ res->lseg.iomode,
res->type,
res->layout.len);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ada5cfd..a286cbc 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -324,8 +324,6 @@ pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *ld_type)
static int
get_layout(struct inode* ino,
struct nfs_open_context* ctx,
- size_t count, loff_t pos,
- enum pnfs_iomode iomode,
struct nfs4_pnfs_layoutget_arg* arg,
struct nfs4_pnfs_layoutget_res* res)
{
@@ -338,10 +336,7 @@ get_layout(struct inode* ino,
dprintk("%s:Begin\n",__FUNCTION__);
arg->type = server->pnfs_curr_ld->id;
- arg->iomode = iomode;
- arg->offset = 0;
- arg->length = (__u64)~0;
- arg->minlength = count;
+ arg->minlength = arg->lseg.length;
arg->maxcount = PNFS_LAYOUT_MAXSIZE;
arg->inode = ino;
arg->ctx = ctx;
@@ -463,16 +458,21 @@ virtual_update_layout(struct inode* ino,
*return(nfss->pnfs_module->pnfs_io_interface->have_layout(..))
*/
+ arg.lseg.iomode = iomode;
+ arg.lseg.offset = pos;
+ arg.lseg.length = count;
/* Check to see if the layout for the given range already exists */
if (nfsi->current_layout != NULL) {
/* TODO: To make this generic, I would need to compare the extents
* of the existing layout information.
* For now, assume that whole file layouts are always returned.
*/
- dprintk("%s: Using cached layout for %lu@%lu)\n",
+ dprintk("%s: Using cached layout %p for %llu@%llu iomode %d)\n",
__FUNCTION__,
- (unsigned long)count,
- (unsigned long)pos);
+ nfsi->current_layout,
+ arg.lseg.length,
+ arg.lseg.offset,
+ arg.lseg.iomode);
return 0; /* Already have layout information */
}
@@ -491,7 +491,7 @@ virtual_update_layout(struct inode* ino,
goto out;
}
- if ((result = get_layout(ino, ctx, count, pos, iomode, &arg, &res))) {
+ if ((result = get_layout(ino, ctx, &arg, &res))) {
printk("%s: ERROR retrieving layout %d\n", __FUNCTION__, result);
switch (result) {
@@ -532,7 +532,7 @@ virtual_update_layout(struct inode* ino,
}
if (res.return_on_close) {
- layout_new->roc_iomode = res.iomode;
+ layout_new->roc_iomode = res.lseg.iomode;
if (!layout_new->roc_iomode) {
layout_new->roc_iomode = IOMODE_ANY;
}
diff --git a/include/linux/pnfs_xdr.h b/include/linux/pnfs_xdr.h
index 748cdd4..9bcb2b4 100644
--- a/include/linux/pnfs_xdr.h
+++ b/include/linux/pnfs_xdr.h
@@ -30,9 +30,7 @@ struct nfs4_pnfs_layout_segment {
struct nfs4_pnfs_layoutget_arg {
__u32 type;
- __u32 iomode;
- __u64 offset;
- __u64 length;
+ struct nfs4_pnfs_layout_segment lseg;
__u64 minlength;
__u32 maxcount;
struct nfs_open_context* ctx;
@@ -42,9 +40,7 @@ struct nfs4_pnfs_layoutget_arg {
struct nfs4_pnfs_layoutget_res {
__u32 return_on_close;
- __u64 offset;
- __u64 length;
- __u32 iomode;
+ struct nfs4_pnfs_layout_segment lseg;
__u32 type;
struct nfs4_pnfs_layout layout;
void *minorversion_info;
--
1.5.2.5
More information about the pNFS
mailing list