浏览代码

NFSv4.1: Send lseg down into nfs_write_rpcsetup

We grab the lseg sent in from the doio function and attach it to
each struct nfs_write_data created.  This is how the lseg will be
sent to the layout driver.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Fred Isaman 14 年之前
父节点
当前提交
5053aa568d
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 5 2
      fs/nfs/write.c
  2. 1 0
      include/linux/nfs_xdr.h

+ 5 - 2
fs/nfs/write.c

@@ -97,6 +97,7 @@ void nfs_writedata_free(struct nfs_write_data *p)
 
 
 static void nfs_writedata_release(struct nfs_write_data *wdata)
 static void nfs_writedata_release(struct nfs_write_data *wdata)
 {
 {
+	put_lseg(wdata->lseg);
 	put_nfs_open_context(wdata->args.context);
 	put_nfs_open_context(wdata->args.context);
 	nfs_writedata_free(wdata);
 	nfs_writedata_free(wdata);
 }
 }
@@ -840,6 +841,7 @@ static int nfs_write_rpcsetup(struct nfs_page *req,
 		struct nfs_write_data *data,
 		struct nfs_write_data *data,
 		const struct rpc_call_ops *call_ops,
 		const struct rpc_call_ops *call_ops,
 		unsigned int count, unsigned int offset,
 		unsigned int count, unsigned int offset,
+		struct pnfs_layout_segment *lseg,
 		int how)
 		int how)
 {
 {
 	struct inode *inode = req->wb_context->path.dentry->d_inode;
 	struct inode *inode = req->wb_context->path.dentry->d_inode;
@@ -850,6 +852,7 @@ static int nfs_write_rpcsetup(struct nfs_page *req,
 	data->req = req;
 	data->req = req;
 	data->inode = inode = req->wb_context->path.dentry->d_inode;
 	data->inode = inode = req->wb_context->path.dentry->d_inode;
 	data->cred = req->wb_context->cred;
 	data->cred = req->wb_context->cred;
+	data->lseg = get_lseg(lseg);
 
 
 	data->args.fh     = NFS_FH(inode);
 	data->args.fh     = NFS_FH(inode);
 	data->args.offset = req_offset(req) + offset;
 	data->args.offset = req_offset(req) + offset;
@@ -930,7 +933,7 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, unsigned
 		if (nbytes < wsize)
 		if (nbytes < wsize)
 			wsize = nbytes;
 			wsize = nbytes;
 		ret2 = nfs_write_rpcsetup(req, data, &nfs_write_partial_ops,
 		ret2 = nfs_write_rpcsetup(req, data, &nfs_write_partial_ops,
-				   wsize, offset, how);
+					  wsize, offset, lseg, how);
 		if (ret == 0)
 		if (ret == 0)
 			ret = ret2;
 			ret = ret2;
 		offset += wsize;
 		offset += wsize;
@@ -978,7 +981,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i
 	req = nfs_list_entry(data->pages.next);
 	req = nfs_list_entry(data->pages.next);
 
 
 	/* Set up the argument struct */
 	/* Set up the argument struct */
-	return nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, how);
+	return nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, lseg, how);
  out_bad:
  out_bad:
 	while (!list_empty(head)) {
 	while (!list_empty(head)) {
 		req = nfs_list_entry(head->next);
 		req = nfs_list_entry(head->next);

+ 1 - 0
include/linux/nfs_xdr.h

@@ -1038,6 +1038,7 @@ struct nfs_write_data {
 	unsigned int		npages;		/* Max length of pagevec */
 	unsigned int		npages;		/* Max length of pagevec */
 	struct nfs_writeargs	args;		/* argument struct */
 	struct nfs_writeargs	args;		/* argument struct */
 	struct nfs_writeres	res;		/* result struct */
 	struct nfs_writeres	res;		/* result struct */
+	struct pnfs_layout_segment *lseg;
 	int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
 	int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
 #ifdef CONFIG_NFS_V4
 #ifdef CONFIG_NFS_V4
 	unsigned long		timestamp;	/* For lease renewal */
 	unsigned long		timestamp;	/* For lease renewal */