Skip to contentSkip to conversation

Some pnfs-submit love

PATCH In review Boaz Harrosh 2 participants 9 messages Jul 6, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Some pnfs-submit love

Some cleanup love to pnfs code.

Andy this would conflict with your dropped:
[PATCH 03/10] SQUASHME pnfs-submit: clear page lseg on partial i/o

I redone them based on Current Benny's tree.

[PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines [PATCH 2/6] SQUASME pnfs-submit: Collapse pnfs_try_to_read_data code path and avoid big fat inlines [PATCH 3/6] SQUASME pnfs-submit: Collapse pnfs_try_to_commit code path and avoid big fat inlines [PATCH 4/6] SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c
[PATCH 5/6] SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode
[PATCH 6/6] SQUASHME: pnfs-submit: pnfs_return_layout remove surrounding #ifdef CONFIG_NFS_V4_1

Please review?
Boaz

#1 lore raw

PATCH 1/6 SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines

There is no need to stutter, just say what you want in one simple sentence.

The thing that triggered this marvellous cleanup was that I did not like the un-necessary pnfs_try_to_write_data inline. It appears that much more was at stake.

---
 fs/nfs/pnfs.c  |   40 ++++++++++++++++------------------------
 fs/nfs/pnfs.h  |   20 +-------------------
 fs/nfs/write.c |    3 ++-
 3 files changed, 19 insertions(+), 44 deletions(-)
fs/nfs/pnfs.c +16 -24
index c78e39c..b7b1738 100644
@@ -1522,24 +1522,25 @@ pnfs_writeback_done(struct nfs_write_data *data)
  * in data->res.verf->committed.  Do we need this ability
  * for non-file layout drivers?
  */
-static enum pnfs_try_status
-pnfs_writepages(struct nfs_write_data *wdata, int how)
+enum pnfs_try_status
+pnfs_try_to_write_data(struct nfs_write_data *wdata,
+			const struct rpc_call_ops *call_ops, int how)
 {
 	struct nfs_writeargs *args = &wdata->args;
 	struct inode *inode = wdata->inode;
-	int numpages;
 	enum pnfs_try_status trypnfs;
 	struct nfs_server *nfss = NFS_SERVER(inode);
 	struct nfs_inode *nfsi = NFS_I(inode);
-	struct pnfs_layout_segment *lseg;
+	struct pnfs_layout_segment *lseg = wdata->req->wb_lseg;
+	int numpages;
 
-	dprintk("%s: Writing ino:%lu %u@%llu\n",
-		__func__,
-		inode->i_ino,
-		args->count,
-		args->offset);
+	wdata->pdata.call_ops = call_ops;
+	wdata->pdata.pnfs_error = 0;
+	wdata->pdata.how = how;
+
+	dprintk("%s: Writing ino:%lu %u@%llu\n", __func__,
+		inode->i_ino, args->count, args->offset);
 
-	lseg = wdata->req->wb_lseg;
 	get_lseg(lseg);
 
 	/* Determine number of pages
@@ -1547,9 +1548,8 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 	numpages = nfs_page_array_len(args->pgbase, args->count);
 
 	dprintk("%s: Calling layout driver (how %d) write with %d pages\n",
-		__func__,
-		how,
-		numpages);
+		__func__, how, numpages);
+
 	if (!pnfs_use_rpc(nfss))
 		wdata->pdata.pnfsflags |= PNFS_NO_RPC;
 	wdata->pdata.lseg = lseg;
@@ -1567,6 +1567,9 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 		wdata->pdata.pnfsflags &= ~PNFS_NO_RPC;
 		wdata->pdata.lseg = NULL;
 		put_lseg(lseg);
+		_pnfs_clear_lseg_from_pages(&wdata->pages);
+	} else {
+		nfs_inc_stats(inode, NFSIOS_PNFS_WRITE);
 	}
 	dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs);
 	return trypnfs;
@@ -1720,17 +1723,6 @@ int _pnfs_write_end(struct inode *inode, struct page *page,
 }
 
 enum pnfs_try_status
-_pnfs_try_to_write_data(struct nfs_write_data *data,
-			const struct rpc_call_ops *call_ops, int how)
-{
-	dprintk("--> %s\n", __func__);
-	data->pdata.call_ops = call_ops;
-	data->pdata.pnfs_error = 0;
-	data->pdata.how = how;
-	return pnfs_writepages(data, how);
-}
-
-enum pnfs_try_status
 _pnfs_try_to_commit(struct nfs_write_data *data,
 		    const struct rpc_call_ops *call_ops, int how)
 {
fs/nfs/pnfs.h +1 -19
index 940ca68..91e892b 100644
@@ -44,7 +44,7 @@ int _pnfs_return_layout(struct inode *, struct nfs4_pnfs_layout_segment *,
 			enum pnfs_layoutreturn_type, bool wait);
 void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *mntfh, u32 id);
 void unmount_pnfs_layoutdriver(struct nfs_server *);
-enum pnfs_try_status _pnfs_try_to_write_data(struct nfs_write_data *,
+enum pnfs_try_status pnfs_try_to_write_data(struct nfs_write_data *,
 					     const struct rpc_call_ops *, int);
 enum pnfs_try_status _pnfs_try_to_read_data(struct nfs_read_data *,
 					    const struct rpc_call_ops *);
@@ -135,24 +135,6 @@ pnfs_try_to_read_data(struct nfs_read_data *data,
 }
 
 static inline enum pnfs_try_status
-pnfs_try_to_write_data(struct nfs_write_data *data,
-		       const struct rpc_call_ops *call_ops,
-		       int how)
-{
-	struct inode *inode = data->inode;
-	enum pnfs_try_status ret;
-
-	if (!data->req->wb_lseg)
-		return PNFS_NOT_ATTEMPTED;
-	ret = _pnfs_try_to_write_data(data, call_ops, how);
-	if (ret == PNFS_ATTEMPTED)
-		nfs_inc_stats(inode, NFSIOS_PNFS_WRITE);
-	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
-	return ret;
-}
-
-static inline enum pnfs_try_status
 pnfs_try_to_commit(struct nfs_write_data *data,
 		   const struct rpc_call_ops *call_ops,
 		   int how)
fs/nfs/write.c +2 -1
index f61c861..fd20fd5 100644
@@ -852,7 +852,8 @@ int pnfs_initiate_write(struct nfs_write_data *data,
 			const struct rpc_call_ops *call_ops,
 			int how)
 {
-	if (pnfs_try_to_write_data(data, call_ops, how) == PNFS_ATTEMPTED)
+	if (data->req->wb_lseg &&
+	    (pnfs_try_to_write_data(data, call_ops, how) == PNFS_ATTEMPTED))
 		return pnfs_get_write_status(data);
 
 	return nfs_initiate_write(data, clnt, call_ops, how);
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 2/6 SQUASME pnfs-submit: Collapse pnfs_try_to_read_data code path and avoid big fat inlines

In reply to Boaz Harrosh

Collapse the intire pnfs_try_to_read_data call chain into a single function call.

---
 fs/nfs/pnfs.c |   29 +++++++++++------------------
 fs/nfs/pnfs.h |   19 +------------------
 fs/nfs/read.c |    3 ++-
 3 files changed, 14 insertions(+), 37 deletions(-)
fs/nfs/pnfs.c +11 -18
index b7b1738..d9c7a6b 100644
@@ -1614,24 +1614,24 @@ pnfs_read_done(struct nfs_read_data *data)
  * If no I/O device driver exists, or one does match the returned
  * fstype, then return a positive status for regular NFS processing.
  */
-static enum pnfs_try_status
-pnfs_readpages(struct nfs_read_data *rdata)
+enum pnfs_try_status
+pnfs_try_to_read_data(struct nfs_read_data *rdata,
+		       const struct rpc_call_ops *call_ops)
 {
 	struct nfs_readargs *args = &rdata->args;
 	struct inode *inode = rdata->inode;
 	int numpages, pgcount, temp;
 	struct nfs_server *nfss = NFS_SERVER(inode);
 	struct nfs_inode *nfsi = NFS_I(inode);
-	struct pnfs_layout_segment *lseg;
+	struct pnfs_layout_segment *lseg = rdata->req->wb_lseg;
 	enum pnfs_try_status trypnfs;
 
+	rdata->pdata.call_ops = call_ops;
+	rdata->pdata.pnfs_error = 0;
+
 	dprintk("%s: Reading ino:%lu %u@%llu\n",
-		__func__,
-		inode->i_ino,
-		args->count,
-		args->offset);
+		__func__, inode->i_ino, args->count, args->offset);
 
-	lseg = rdata->req->wb_lseg;
 	get_lseg(lseg);
 
 	/* Determine number of pages. */
@@ -1658,21 +1658,14 @@ pnfs_readpages(struct nfs_read_data *rdata)
 		rdata->pdata.pnfsflags &= ~PNFS_NO_RPC;
 		rdata->pdata.lseg = NULL;
 		put_lseg(lseg);
+		_pnfs_clear_lseg_from_pages(&rdata->pages);
+	} else {
+		nfs_inc_stats(inode, NFSIOS_PNFS_READ);
 	}
 	dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs);
 	return trypnfs;
 }
 
-enum pnfs_try_status
-_pnfs_try_to_read_data(struct nfs_read_data *data,
-		       const struct rpc_call_ops *call_ops)
-{
-	dprintk("%s: Utilizing pNFS I/O\n", __func__);
-	data->pdata.call_ops = call_ops;
-	data->pdata.pnfs_error = 0;
-	return pnfs_readpages(data);
-}
-
 /*
  * This gives the layout driver an opportunity to read in page "around"
  * the data to be written.  It returns 0 on success, otherwise an error code
fs/nfs/pnfs.h +1 -18
index 91e892b..20ebe3f 100644
@@ -46,7 +46,7 @@ void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *mntfh, u32
 void unmount_pnfs_layoutdriver(struct nfs_server *);
 enum pnfs_try_status pnfs_try_to_write_data(struct nfs_write_data *,
 					     const struct rpc_call_ops *, int);
-enum pnfs_try_status _pnfs_try_to_read_data(struct nfs_read_data *,
+enum pnfs_try_status pnfs_try_to_read_data(struct nfs_read_data *,
 					    const struct rpc_call_ops *);
 int pnfs_initialize(void);
 void pnfs_uninitialize(void);
@@ -118,23 +118,6 @@ static inline int pnfs_grow_ok(struct pnfs_layout_segment *lseg,
 }
 
 static inline enum pnfs_try_status
-pnfs_try_to_read_data(struct nfs_read_data *data,
-		      const struct rpc_call_ops *call_ops)
-{
-	struct inode *inode = data->inode;
-	enum pnfs_try_status ret;
-
-	if (!data->req->wb_lseg)
-		return PNFS_NOT_ATTEMPTED;
-	ret = _pnfs_try_to_read_data(data, call_ops);
-	if (ret == PNFS_ATTEMPTED)
-		nfs_inc_stats(inode, NFSIOS_PNFS_READ);
-	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
-	return ret;
-}
-
-static inline enum pnfs_try_status
 pnfs_try_to_commit(struct nfs_write_data *data,
 		   const struct rpc_call_ops *call_ops,
 		   int how)
fs/nfs/read.c +2 -1
index 204d738..1bcab47 100644
@@ -204,7 +204,8 @@ EXPORT_SYMBOL(nfs_initiate_read);
 int pnfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
 		       const struct rpc_call_ops *call_ops)
 {
-	if (pnfs_try_to_read_data(data, call_ops) == PNFS_ATTEMPTED)
+	if (data->req->wb_lseg &&
+	    (pnfs_try_to_read_data(data, call_ops) == PNFS_ATTEMPTED))
 		return pnfs_get_read_status(data);
 
 	return nfs_initiate_read(data, clnt, call_ops);
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 3/6 SQUASME pnfs-submit: Collapse pnfs_try_to_commit code path and avoid big fat inlines

In reply to Boaz Harrosh

Collapse the intire pnfs_try_to_commit call chain into a single function call.

---
 fs/nfs/pnfs.c |   26 +++++++++++---------------
 fs/nfs/pnfs.h |   23 +----------------------
 2 files changed, 12 insertions(+), 37 deletions(-)
fs/nfs/pnfs.c +11 -15
index d9c7a6b..a30a8c3 100644
@@ -59,7 +59,6 @@ static int pnfs_initialized;
 
 static void pnfs_free_layout(struct pnfs_layout_type *lo,
 			     struct nfs4_pnfs_layout_segment *range);
-static enum pnfs_try_status pnfs_commit(struct nfs_write_data *data, int sync);
 static inline void get_layout(struct pnfs_layout_type *lo);
 
 /* Locking:
@@ -1715,17 +1714,6 @@ int _pnfs_write_end(struct inode *inode, struct page *page,
 	return status;
 }
 
-enum pnfs_try_status
-_pnfs_try_to_commit(struct nfs_write_data *data,
-		    const struct rpc_call_ops *call_ops, int how)
-{
-	dprintk("%s: Utilizing pNFS I/O\n", __func__);
-	data->pdata.call_ops = call_ops;
-	data->pdata.pnfs_error = 0;
-	data->pdata.how = how;
-	return pnfs_commit(data, how);
-}
-
 /* pNFS Commit callback function for all layout drivers */
 static void
 pnfs_commit_done(struct nfs_write_data *data)
@@ -1748,8 +1736,9 @@ pnfs_commit_done(struct nfs_write_data *data)
 	}
 }
 
-static enum pnfs_try_status
-pnfs_commit(struct nfs_write_data *data, int sync)
+enum pnfs_try_status
+pnfs_try_to_commit(struct nfs_write_data *data,
+		    const struct rpc_call_ops *call_ops, int sync)
 {
 	struct nfs_inode *nfsi = NFS_I(data->inode);
 	struct nfs_server *nfss = NFS_SERVER(data->inode);
@@ -1764,13 +1753,20 @@ pnfs_commit(struct nfs_write_data *data, int sync)
 	 * We still have to account for the possibility of some being NULL.
 	 * This will be done by passing the buck to the layout driver.
 	 */
+	data->pdata.call_ops = call_ops;
+	data->pdata.pnfs_error = 0;
+	data->pdata.how = sync;
 	data->pdata.lseg = NULL;
 	if (!pnfs_use_rpc(nfss))
 		data->pdata.pnfsflags |= PNFS_NO_RPC;
 	trypnfs = nfss->pnfs_curr_ld->ld_io_ops->commit(&nfsi->layout,
 							sync, data);
-	if (trypnfs == PNFS_NOT_ATTEMPTED)
+	if (trypnfs == PNFS_NOT_ATTEMPTED) {
 		data->pdata.pnfsflags &= ~PNFS_NO_RPC;
+		_pnfs_clear_lseg_from_pages(&data->pages);
+	} else {
+		nfs_inc_stats(data->inode, NFSIOS_PNFS_COMMIT);
+	}
 	dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs);
 	return trypnfs;
 }
fs/nfs/pnfs.h +1 -22
index 20ebe3f..1a320f6 100644
@@ -57,7 +57,7 @@ void pnfs_update_last_write(struct nfs_inode *nfsi, loff_t offset, size_t extent
 void pnfs_need_layoutcommit(struct nfs_inode *nfsi, struct nfs_open_context *ctx);
 unsigned int pnfs_getiosize(struct nfs_server *server);
 void pnfs_set_ds_iosize(struct nfs_server *server);
-enum pnfs_try_status _pnfs_try_to_commit(struct nfs_write_data *,
+enum pnfs_try_status pnfs_try_to_commit(struct nfs_write_data *,
 					 const struct rpc_call_ops *, int);
 void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *,
 			   struct nfs_open_context *, struct list_head *,
@@ -117,27 +117,6 @@ static inline int pnfs_grow_ok(struct pnfs_layout_segment *lseg,
 		!fsdata->bypass_eof;
 }
 
-static inline enum pnfs_try_status
-pnfs_try_to_commit(struct nfs_write_data *data,
-		   const struct rpc_call_ops *call_ops,
-		   int how)
-{
-	struct inode *inode = data->inode;
-	enum pnfs_try_status ret;
-
-	/* Unlike in pnfs_try_to_write_data and pnfs_try_to_read_data,
-	 * we have no guarantee that all nfs_pages point to the same
-	 * lseg.  However, if we reach here, we are guaranteed that at
-	 * least one points to some lseg.
-	 */
-	ret = _pnfs_try_to_commit(data, call_ops, how);
-	if (ret == PNFS_ATTEMPTED)
-		nfs_inc_stats(inode, NFSIOS_PNFS_COMMIT);
-	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
-	return ret;
-}
-
 static inline int pnfs_write_begin(struct file *filp, struct page *page,
 				   loff_t pos, unsigned len,
 				   struct pnfs_layout_segment *lseg,
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH 4/6 SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c

In reply to Boaz Harrosh

No longer needed at header (and inline)

---
 fs/nfs/pnfs.c |   10 ++++++++++
 fs/nfs/pnfs.h |   10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)
fs/nfs/pnfs.c +10 -0
index a30a8c3..6ff8d63 100644
@@ -1510,6 +1510,16 @@ pnfs_writeback_done(struct nfs_write_data *data)
 	}
 }
 
+static void _pnfs_clear_lseg_from_pages(struct list_head *head)
+{
+	struct nfs_page *req;
+
+	list_for_each_entry(req, head, wb_list) {
+		put_lseg(req->wb_lseg);
+		req->wb_lseg = NULL;
+	}
+}
+
 /*
  * Call the appropriate parallel I/O subsystem write function.
  * If no I/O device driver exists, or one does match the returned
fs/nfs/pnfs.h +0 -10
index 1a320f6..55f3028 100644
@@ -100,16 +100,6 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 	return nfss->pnfs_curr_ld != NULL;
 }
 
-static inline void _pnfs_clear_lseg_from_pages(struct list_head *head)
-{
-	struct nfs_page *req;
-
-	list_for_each_entry(req, head, wb_list) {
-		put_lseg(req->wb_lseg);
-		req->wb_lseg = NULL;
-	}
-}
-
 static inline int pnfs_grow_ok(struct pnfs_layout_segment *lseg,
 			       struct pnfs_fsdata *fsdata)
 {
Signature · 1 line
1.6.6.1
#5 lore raw

PATCH 5/6 SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode

In reply to Boaz Harrosh

It does not look right to clear out basic nfs RPC resources before calling layout_return.

Also, for me a layout is an inner resource to delegation, the delegation is acquired during open, a layout later. So it's proper to return the layout before the delegation

---
 fs/nfs/inode.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/nfs/inode.c +3 -4
index 7989dea..916d6d0 100644
@@ -1351,13 +1351,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
  */
 void nfs4_clear_inode(struct inode *inode)
 {
-	/* If we are holding a delegation, return it! */
-	nfs_inode_return_delegation_noreclaim(inode);
-	/* First call standard NFS clear_inode() code */
-	nfs_clear_inode(inode);
 #ifdef CONFIG_NFS_V4_1
 	pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
 #endif /* CONFIG_NFS_V4_1 */
+	/* If we are holding a delegation, return it! */
+	nfs_inode_return_delegation_noreclaim(inode);
+	nfs_clear_inode(inode);
 }
 #endif
 
Signature · 1 line
1.6.6.1
#6 lore raw

PATCH 6/6 SQUASHME: pnfs-submit: pnfs_return_layout remove surrounding #ifdef CONFIG_NFS_V4_1

In reply to Boaz Harrosh

Define empty do nothing pnfs_return_layout(), pnfs_ld_layoutret_on_setattr() & a new pnfs_layout_roc_iomode() in the !CONFIG_NFS_V4_1 case. Now they can be used regardless.

---
 fs/nfs/inode.c            |    3 +--
 fs/nfs/nfs4proc.c         |   15 ++-------------
 fs/nfs/nfs4state.c        |   17 ++++++++---------
 fs/nfs/pnfs.h             |   38 ++++++++++++++++++++++++++++++++++++++
 include/linux/nfs4_pnfs.h |    8 --------
 5 files changed, 49 insertions(+), 32 deletions(-)
fs/nfs/inode.c +1 -2
index 916d6d0..ee792ca 100644
@@ -1351,9 +1351,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
  */
 void nfs4_clear_inode(struct inode *inode)
 {
-#ifdef CONFIG_NFS_V4_1
 	pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
-#endif /* CONFIG_NFS_V4_1 */
+
 	/* If we are holding a delegation, return it! */
 	nfs_inode_return_delegation_noreclaim(inode);
 	nfs_clear_inode(inode);
fs/nfs/nfs4proc.c +2 -13
index 6a80053..1f4fc77 100644
@@ -2333,18 +2333,6 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 	return err;
 }
 
-static void
-pnfs4_return_layout_on_setattr(struct inode *inode)
-{
-#ifdef CONFIG_NFS_V4_1
-	struct nfs_server *server = NFS_SERVER(inode);
-	struct nfs_inode *nfsi = NFS_I(inode);
-
-	if (has_layout(nfsi) && pnfs_ld_layoutret_on_setattr(server->pnfs_curr_ld))
-		pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
-#endif /* CONFIG_NFS_V4_1 */
-}
-
 /* 
  * The file is not closed if it is opened due to the a request to change
  * the size of the file. The open call will not be needed once the
@@ -2371,7 +2359,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 	struct nfs4_state *state = NULL;
 	int status;
 
-	pnfs4_return_layout_on_setattr(inode);
+	if (pnfs_ld_layoutret_on_setattr(inode))
+		pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
 
 	nfs_fattr_init(fattr);
 	
fs/nfs/nfs4state.c +8 -9
index bfe679b..8734688 100644
@@ -594,19 +594,18 @@ static void __nfs4_close(struct path *path, struct nfs4_state *state,
 		nfs4_put_open_state(state);
 		nfs4_put_state_owner(owner);
 	} else {
-#ifdef CONFIG_NFS_V4_1
-		struct nfs_inode *nfsi = NFS_I(state->inode);
-
-		if (has_layout(nfsi) && nfsi->layout.roc_iomode) {
-			struct nfs4_pnfs_layout_segment range;
+		u32 roc_iomode = pnfs_layout_roc_iomode(NFS_I(state->inode));
+		if (roc_iomode) {
+			struct nfs4_pnfs_layout_segment range = {
+				.iomode = roc_iomode,
+				.offset = 0,
+				.length = NFS4_MAX_UINT64,
+			};
 
-			range.iomode = nfsi->layout.roc_iomode;
-			range.offset = 0;
-			range.length = NFS4_MAX_UINT64;
 			pnfs_return_layout(state->inode, &range, NULL,
 					   RETURN_FILE, wait);
 		}
-#endif /* CONFIG_NFS_V4_1 */
+
 		nfs4_do_close(path, state, gfp_mask, wait);
 	}
 }
fs/nfs/pnfs.h +38 -0
index 55f3028..2b46e38 100644
@@ -148,6 +148,23 @@ static inline void pnfs_write_end_cleanup(struct file *filp, void *fsdata)
 	}
 }
 
+/* Should the pNFS client commit and return the layout upon a setattr
+ */
+static inline int
+pnfs_ld_layoutret_on_setattr(struct inode *inode)
+{
+	return NFS_SERVER(inode)->pnfs_curr_ld->ld_policy_ops->flags &
+		PNFS_LAYOUTRET_ON_SETATTR;
+}
+
+/* Should the pNFS client commit and return the layout on close
+ */
+static inline int
+pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
+{
+	return nfsi->layout.roc_iomode;
+}
+
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct nfs4_pnfs_layout_segment *lseg,
 				     const nfs4_stateid *stateid, /* optional */
@@ -294,6 +311,27 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, int sync)
 	return 0;
 }
 
+static inline int
+pnfs_ld_layoutret_on_setattr(struct inode *inode)
+{
+	return false;
+}
+
+static inline int
+pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
+{
+	return 0;
+}
+
+static inline int pnfs_return_layout(struct inode *ino,
+				     struct nfs4_pnfs_layout_segment *lseg,
+				     const nfs4_stateid *stateid, /* optional */
+				     enum pnfs_layoutreturn_type type,
+				     bool wait)
+{
+	return 0;
+}
+
 static inline struct pnfs_layout_segment *
 nfs4_pull_lseg_from_fsdata(struct file *filp, void *fsdata)
 {
include/linux/nfs4_pnfs.h +0 -8
index f097e59..e9d822d 100644
@@ -234,14 +234,6 @@ pnfs_ld_gather_across_stripes(struct pnfs_layoutdriver_type *ld)
 	return ld->ld_policy_ops->flags & PNFS_GATHER_ACROSS_STRIPES;
 }
 
-/* Should the pNFS client commit and return the layout upon a setattr
- */
-static inline int
-pnfs_ld_layoutret_on_setattr(struct pnfs_layoutdriver_type *ld)
-{
-	return ld->ld_policy_ops->flags & PNFS_LAYOUTRET_ON_SETATTR;
-}
-
 struct pnfs_device {
 	struct pnfs_deviceid dev_id;
 	unsigned int  layout_type;
Signature · 1 line
1.6.6.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines

Quoted 3 lines · Fred Isaman

On Jul 6, 2010, at 9:55 AM, Boaz Harrosh wrote:

<snip>

Quoted 14 lines

Review pnfs_writepages(struct nfs_write_data *wdata, int how) · line 1554

Quoted 11 lines
(quoted diff) +2 -3
@@ -1547,9 +1548,8 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 	numpages = nfs_page_array_len(args->pgbase, args->count);
 
 	dprintk("%s: Calling layout driver (how %d) write with %d pages\n",
-		__func__,
-		how,
-		numpages);
+		__func__, how, numpages);
+
 	if (!pnfs_use_rpc(nfss))
 		wdata->pdata.pnfsflags |= PNFS_NO_RPC;

Just curious, what branch is this based on? The above code was removed in the pnfs-submit branches a while ago.

Quoted 2 lines

Other than that, looks good.

It's over pnfs-all-latest because for me I need the bigger tree for actually testing my code. So more work for Benny when squashing to sort out the hunks.

But if it was removed what patch brings it back, this is odd. Benny?

Quoted 2 lines

Fred

Boaz

#10 lore raw

Re: [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines

Quoted 19 lines · Boaz Harrosh
Quoted 3 lines · Fred Isaman

On Jul 6, 2010, at 9:55 AM, Boaz Harrosh wrote:

<snip>

Quoted 14 lines

Review pnfs_writepages(struct nfs_write_data *wdata, int how) · line 1554

Quoted 11 lines
(quoted diff) +2 -3
@@ -1547,9 +1548,8 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 	numpages = nfs_page_array_len(args->pgbase, args->count);
 
 	dprintk("%s: Calling layout driver (how %d) write with %d pages\n",
-		__func__,
-		how,
-		numpages);
+		__func__, how, numpages);
+
 	if (!pnfs_use_rpc(nfss))
 		wdata->pdata.pnfsflags |= PNFS_NO_RPC;

Just curious, what branch is this based on? The above code was removed in the pnfs-submit branches a while ago.

Quoted 7 lines
Quoted 2 lines

Other than that, looks good.

It's over pnfs-all-latest because for me I need the bigger tree for actually testing my code. So more work for Benny when squashing to sort out the hunks.

But if it was removed what patch brings it back, this is odd. Benny?

No, that makes sense then. It is removed in pnfs-submit, then the removal patch is immediately reverted.

Fred

Quoted 5 lines
Quoted 3 lines

Fred

Boaz