All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Some pnfs-submit love
@ 2010-07-06 13:51 Boaz Harrosh
  2010-07-06 13:56 ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 13:51 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, NFS list, Fred Isaman

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
@ 2010-07-06 13:56 ` Boaz Harrosh
  2010-07-06 13:57 ` [PATCH 2/6] SQUASME pnfs-submit: Collapse pnfs_try_to_read_data " Boaz Harrosh
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 13:56 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

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.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/pnfs.c  |   40 ++++++++++++++++------------------------
 fs/nfs/pnfs.h  |   20 +-------------------
 fs/nfs/write.c |    3 ++-
 3 files changed, 19 insertions(+), 44 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index c78e39c..b7b1738 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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)
 {
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 940ca68..91e892b 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f61c861..fd20fd5 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -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);
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] SQUASME pnfs-submit: Collapse pnfs_try_to_read_data code path and avoid big fat inlines
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
  2010-07-06 13:56 ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
@ 2010-07-06 13:57 ` Boaz Harrosh
  2010-07-06 14:05 ` [PATCH 3/6] SQUASME pnfs-submit: Collapse pnfs_try_to_commit " Boaz Harrosh
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 13:57 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

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

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/pnfs.c |   29 +++++++++++------------------
 fs/nfs/pnfs.h |   19 +------------------
 fs/nfs/read.c |    3 ++-
 3 files changed, 14 insertions(+), 37 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b7b1738..d9c7a6b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 91e892b..20ebe3f 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 204d738..1bcab47 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -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);
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] SQUASME pnfs-submit: Collapse pnfs_try_to_commit code path and avoid big fat inlines
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
  2010-07-06 13:56 ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
  2010-07-06 13:57 ` [PATCH 2/6] SQUASME pnfs-submit: Collapse pnfs_try_to_read_data " Boaz Harrosh
@ 2010-07-06 14:05 ` Boaz Harrosh
  2010-07-06 14:06 ` [PATCH 4/6] SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c Boaz Harrosh
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 14:05 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

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

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/pnfs.c |   26 +++++++++++---------------
 fs/nfs/pnfs.h |   23 +----------------------
 2 files changed, 12 insertions(+), 37 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d9c7a6b..a30a8c3 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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;
 }
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 20ebe3f..1a320f6 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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,
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
                   ` (2 preceding siblings ...)
  2010-07-06 14:05 ` [PATCH 3/6] SQUASME pnfs-submit: Collapse pnfs_try_to_commit " Boaz Harrosh
@ 2010-07-06 14:06 ` Boaz Harrosh
  2010-07-06 14:07 ` [PATCH 5/6] SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode Boaz Harrosh
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 14:06 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

No longer needed at header (and inline)

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/pnfs.c |   10 ++++++++++
 fs/nfs/pnfs.h |   10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a30a8c3..6ff8d63 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 1a320f6..55f3028 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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)
 {
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
                   ` (3 preceding siblings ...)
  2010-07-06 14:06 ` [PATCH 4/6] SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c Boaz Harrosh
@ 2010-07-06 14:07 ` Boaz Harrosh
  2010-07-06 14:08 ` [PATCH 6/6] SQUASHME: pnfs-submit: pnfs_return_layout remove surrounding #ifdef CONFIG_NFS_V4_1 Boaz Harrosh
       [not found] ` <1278424509-22230-1-git-send-email-bharrosh@panasas.com>
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 14:07 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

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

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/inode.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7989dea..916d6d0 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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
 
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] SQUASHME: pnfs-submit: pnfs_return_layout remove surrounding #ifdef CONFIG_NFS_V4_1
  2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
                   ` (4 preceding siblings ...)
  2010-07-06 14:07 ` [PATCH 5/6] SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode Boaz Harrosh
@ 2010-07-06 14:08 ` Boaz Harrosh
       [not found] ` <1278424509-22230-1-git-send-email-bharrosh@panasas.com>
  6 siblings, 0 replies; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 14:08 UTC (permalink / raw)
  To: Benny Halevy, Andy Adamson, Fred Isaman, NFS list

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.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 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(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 916d6d0..ee792ca 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6a80053..1f4fc77 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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);
 	
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index bfe679b..8734688 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -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);
 	}
 }
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 55f3028..2b46e38 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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)
 {
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index f097e59..e9d822d 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -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;
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines
       [not found]   ` <264D5500-73A1-4315-9182-D21A6D2141FD@netapp.com>
@ 2010-07-06 14:46     ` Boaz Harrosh
  2010-07-06 14:57       ` Fred Isaman
  0 siblings, 1 reply; 9+ messages in thread
From: Boaz Harrosh @ 2010-07-06 14:46 UTC (permalink / raw)
  To: Fred Isaman; +Cc: Benny Halevy, Andy Adamson, pNFS Mailing List, NFS list

On 07/06/2010 05:31 PM, Fred Isaman wrote:
> 
> On Jul 6, 2010, at 9:55 AM, Boaz Harrosh wrote:
> 
<snip>
>> @@ -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.
> 
> 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?

> Fred
> 

Boaz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines
  2010-07-06 14:46     ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
@ 2010-07-06 14:57       ` Fred Isaman
  0 siblings, 0 replies; 9+ messages in thread
From: Fred Isaman @ 2010-07-06 14:57 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: Benny Halevy, Andy Adamson, pNFS Mailing List, NFS list


On Jul 6, 2010, at 10:46 AM, Boaz Harrosh wrote:

> On 07/06/2010 05:31 PM, Fred Isaman wrote:
>> 
>> On Jul 6, 2010, at 9:55 AM, Boaz Harrosh wrote:
>> 
> <snip>
>>> @@ -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.
>> 
>> 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

> 
>> Fred
>> 
> 
> Boaz


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-07-06 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06 13:51 [PATCH 0/6] Some pnfs-submit love Boaz Harrosh
2010-07-06 13:56 ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
2010-07-06 13:57 ` [PATCH 2/6] SQUASME pnfs-submit: Collapse pnfs_try_to_read_data " Boaz Harrosh
2010-07-06 14:05 ` [PATCH 3/6] SQUASME pnfs-submit: Collapse pnfs_try_to_commit " Boaz Harrosh
2010-07-06 14:06 ` [PATCH 4/6] SQUASHME: pnfs-submit: Move _pnfs_clear_lseg_from_pages to pnfs.c Boaz Harrosh
2010-07-06 14:07 ` [PATCH 5/6] SQUASHME: pnfs-commit: Fix scariness in nfs4_clear_inode Boaz Harrosh
2010-07-06 14:08 ` [PATCH 6/6] SQUASHME: pnfs-submit: pnfs_return_layout remove surrounding #ifdef CONFIG_NFS_V4_1 Boaz Harrosh
     [not found] ` <1278424509-22230-1-git-send-email-bharrosh@panasas.com>
     [not found]   ` <264D5500-73A1-4315-9182-D21A6D2141FD@netapp.com>
2010-07-06 14:46     ` [PATCH 1/6] SQUASME pnfs-submit: Collapse pnfs_try_to_write_data code path and avoid big fat inlines Boaz Harrosh
2010-07-06 14:57       ` Fred Isaman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.