linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout
@ 2010-11-15 19:00 Fred Isaman
  2010-11-15 19:00 ` [PATCH 2/4] pnfs-submit: remove type " Fred Isaman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fred Isaman @ 2010-11-15 19:00 UTC (permalink / raw)
  To: linux-nfs

This is a relic from the old CB_LAYOUTRECALL code.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/inode.c          |    2 +-
 fs/nfs/nfs4proc.c       |    5 -----
 fs/nfs/pnfs.c           |   14 ++------------
 fs/nfs/pnfs.h           |    5 +----
 include/linux/nfs_xdr.h |    1 -
 5 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 8727ade..3bf7a42 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1419,7 +1419,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
  */
 void nfs4_evict_inode(struct inode *inode)
 {
-	pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
+	pnfs_return_layout(inode, NULL, RETURN_FILE, true);
 	truncate_inode_pages(&inode->i_data, 0);
 	end_writeback(inode);
 	pnfs_destroy_layout(NFS_I(inode));
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 55505e4..bd234c4 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5622,11 +5622,6 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
 			return;
 		}
 	}
-	if (lrp->stateid) {
-		/* Forget the layout, without sending the return */
-		rpc_exit(task, 0);
-		return;
-	}
 	if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args,
 				&lrp->res.seq_res, 0, task))
 		return;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 0b7fc1d..a62f518 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -693,7 +693,7 @@ out_nolayout:
 static int
 return_layout(struct inode *ino, struct pnfs_layout_range *range,
 	      enum pnfs_layoutreturn_type type, struct pnfs_layout_hdr *lo,
-	      bool wait, const nfs4_stateid *stateid)
+	      bool wait)
 {
 	struct nfs4_layoutreturn *lrp;
 	struct nfs_server *server = NFS_SERVER(ino);
@@ -714,7 +714,6 @@ return_layout(struct inode *ino, struct pnfs_layout_range *range,
 	lrp->args.return_type = type;
 	lrp->args.range = *range;
 	lrp->args.inode = ino;
-	lrp->stateid = stateid;
 	lrp->clp = server->nfs_client;
 
 	status = nfs4_proc_layoutreturn(lrp, wait);
@@ -725,7 +724,6 @@ out:
 
 int
 _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
-		    const nfs4_stateid *stateid, /* optional */
 		    enum pnfs_layoutreturn_type type,
 		    bool wait)
 {
@@ -766,11 +764,6 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
 		pnfs_free_lseg_list(&tmp_list);
 
 		if (layoutcommit_needed(nfsi)) {
-			if (stateid && !wait) { /* callback */
-				dprintk("%s: layoutcommit pending\n", __func__);
-				status = -EAGAIN;
-				goto out_put;
-			}
 			status = pnfs_layoutcommit_inode(ino, wait);
 			if (status) {
 				/* Return layout even if layoutcommit fails */
@@ -779,14 +772,11 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
 					__func__, status);
 			}
 		}
-		status = return_layout(ino, &arg, type, lo, wait, stateid);
+		status = return_layout(ino, &arg, type, lo, wait);
 	}
 out:
 	dprintk("<-- %s status: %d\n", __func__, status);
 	return status;
-out_put:
-	put_layout_hdr(ino);
-	goto out;
 }
 
 /*
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index c5b4282..46dab34 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -205,7 +205,6 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type);
 bool pnfs_return_layout_barrier(struct nfs_inode *, struct pnfs_layout_range *);
 int _pnfs_return_layout(struct inode *, struct pnfs_layout_range *,
-			const nfs4_stateid *stateid, /* optional */
 			enum pnfs_layoutreturn_type, bool wait);
 void set_pnfs_layoutdriver(struct nfs_server *, u32 id);
 void unset_pnfs_layoutdriver(struct nfs_server *);
@@ -279,7 +278,6 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
 
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct pnfs_layout_range *range,
-				     const nfs4_stateid *stateid, /* optional */
 				     enum pnfs_layoutreturn_type type,
 				     bool wait)
 {
@@ -288,7 +286,7 @@ static inline int pnfs_return_layout(struct inode *ino,
 
 	if (pnfs_enabled_sb(nfss) &&
 	    (type != RETURN_FILE || has_layout(nfsi)))
-		return _pnfs_return_layout(ino, range, stateid, type, wait);
+		return _pnfs_return_layout(ino, range, type, wait);
 
 	return 0;
 }
@@ -383,7 +381,6 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
 
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct pnfs_layout_range *range,
-				     const nfs4_stateid *stateid, /* optional */
 				     enum pnfs_layoutreturn_type type,
 				     bool wait)
 {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index d4c4804..7a19acb 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -276,7 +276,6 @@ struct nfs4_layoutreturn {
 	struct nfs4_layoutreturn_args args;
 	struct nfs4_layoutreturn_res res;
 	struct rpc_cred *cred;
-	const nfs4_stateid *stateid;
 	struct nfs_client *clp;
 	int rpc_status;
 };
-- 
1.7.2.1


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

* [PATCH 2/4] pnfs-submit: remove type argument from pnfs_return_layout
  2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
@ 2010-11-15 19:00 ` Fred Isaman
  2010-11-15 19:00 ` [PATCH 3/4] pnfs-submit: remove has_layout_to_return() Fred Isaman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fred Isaman @ 2010-11-15 19:00 UTC (permalink / raw)
  To: linux-nfs

pnfs_return_layout is only called with type=RETURN_FILE, so remove as argument

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/inode.c |    2 +-
 fs/nfs/pnfs.c  |   76 ++++++++++++++++++++++++-------------------------------
 fs/nfs/pnfs.h  |   10 ++-----
 3 files changed, 37 insertions(+), 51 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 3bf7a42..bbeb337 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1419,7 +1419,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
  */
 void nfs4_evict_inode(struct inode *inode)
 {
-	pnfs_return_layout(inode, NULL, RETURN_FILE, true);
+	pnfs_return_layout(inode, NULL, true);
 	truncate_inode_pages(&inode->i_data, 0);
 	end_writeback(inode);
 	pnfs_destroy_layout(NFS_I(inode));
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a62f518..eefa440 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -691,9 +691,7 @@ out_nolayout:
 }
 
 static int
-return_layout(struct inode *ino, struct pnfs_layout_range *range,
-	      enum pnfs_layoutreturn_type type, struct pnfs_layout_hdr *lo,
-	      bool wait)
+return_layout(struct inode *ino, struct pnfs_layout_range *range, bool wait)
 {
 	struct nfs4_layoutreturn *lrp;
 	struct nfs_server *server = NFS_SERVER(ino);
@@ -701,17 +699,14 @@ return_layout(struct inode *ino, struct pnfs_layout_range *range,
 
 	dprintk("--> %s\n", __func__);
 
-	BUG_ON(type != RETURN_FILE);
-
 	lrp = kzalloc(sizeof(*lrp), GFP_KERNEL);
 	if (lrp == NULL) {
-		if (lo && (type == RETURN_FILE))
-			put_layout_hdr(lo->inode);
+		put_layout_hdr(ino);
 		goto out;
 	}
 	lrp->args.reclaim = 0;
 	lrp->args.layout_type = server->pnfs_curr_ld->id;
-	lrp->args.return_type = type;
+	lrp->args.return_type = RETURN_FILE;
 	lrp->args.range = *range;
 	lrp->args.inode = ino;
 	lrp->clp = server->nfs_client;
@@ -722,58 +717,53 @@ out:
 	return status;
 }
 
+/* Initiates a LAYOUTRETURN(FILE) */
 int
 _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
-		    enum pnfs_layoutreturn_type type,
 		    bool wait)
 {
 	struct pnfs_layout_hdr *lo = NULL;
 	struct nfs_inode *nfsi = NFS_I(ino);
 	struct pnfs_layout_range arg;
+	LIST_HEAD(tmp_list);
+	struct pnfs_layout_segment *lseg, *tmp;
 	int status = 0;
 
-	dprintk("--> %s type %d\n", __func__, type);
-
+	dprintk("--> %s\n", __func__);
 
 	arg.iomode = range ? range->iomode : IOMODE_ANY;
 	arg.offset = 0;
 	arg.length = NFS4_MAX_UINT64;
 
-	/* probably should BUGON if type != RETURN_FILE */
-	if (type == RETURN_FILE) {
-		LIST_HEAD(tmp_list);
-		struct pnfs_layout_segment *lseg, *tmp;
+	spin_lock(&ino->i_lock);
+	lo = nfsi->layout;
+	if (lo && !has_layout_to_return(lo, &arg))
+		lo = NULL;
+	if (!lo) {
+		spin_unlock(&ino->i_lock);
+		dprintk("%s: no layout segments to return\n", __func__);
+		goto out;
+	}
 
-		spin_lock(&ino->i_lock);
-		lo = nfsi->layout;
-		if (lo && !has_layout_to_return(lo, &arg))
-			lo = NULL;
-		if (!lo) {
-			spin_unlock(&ino->i_lock);
-			dprintk("%s: no layout segments to return\n", __func__);
-			goto out;
-		}
+	lo->plh_block_lgets++;
+	list_for_each_entry_safe(lseg, tmp, &lo->segs, fi_list)
+		if (should_free_lseg(&lseg->range, &arg))
+			mark_lseg_invalid(lseg, &tmp_list);
+	/* Reference matched in nfs4_layoutreturn_release */
+	get_layout_hdr(lo);
+	spin_unlock(&ino->i_lock);
+	pnfs_free_lseg_list(&tmp_list);
 
-		lo->plh_block_lgets++;
-		list_for_each_entry_safe(lseg, tmp, &lo->segs, fi_list)
-			if (should_free_lseg(&lseg->range, &arg))
-				mark_lseg_invalid(lseg, &tmp_list);
-		/* Reference matched in nfs4_layoutreturn_release */
-		get_layout_hdr(lo);
-		spin_unlock(&ino->i_lock);
-		pnfs_free_lseg_list(&tmp_list);
-
-		if (layoutcommit_needed(nfsi)) {
-			status = pnfs_layoutcommit_inode(ino, wait);
-			if (status) {
-				/* Return layout even if layoutcommit fails */
-				dprintk("%s: layoutcommit failed, status=%d. "
-					"Returning layout anyway\n",
-					__func__, status);
-			}
+	if (layoutcommit_needed(nfsi)) {
+		status = pnfs_layoutcommit_inode(ino, wait);
+		if (status) {
+			/* Return layout even if layoutcommit fails */
+			dprintk("%s: layoutcommit failed, status=%d. "
+				"Returning layout anyway\n",
+				__func__, status);
 		}
-		status = return_layout(ino, &arg, type, lo, wait);
 	}
+	status = return_layout(ino, &arg, wait);
 out:
 	dprintk("<-- %s status: %d\n", __func__, status);
 	return status;
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 46dab34..a124ad2 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -204,8 +204,7 @@ struct pnfs_layout_segment *
 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type);
 bool pnfs_return_layout_barrier(struct nfs_inode *, struct pnfs_layout_range *);
-int _pnfs_return_layout(struct inode *, struct pnfs_layout_range *,
-			enum pnfs_layoutreturn_type, bool wait);
+int _pnfs_return_layout(struct inode *, struct pnfs_layout_range *, bool wait);
 void set_pnfs_layoutdriver(struct nfs_server *, u32 id);
 void unset_pnfs_layoutdriver(struct nfs_server *);
 enum pnfs_try_status pnfs_try_to_write_data(struct nfs_write_data *,
@@ -278,15 +277,13 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
 
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct pnfs_layout_range *range,
-				     enum pnfs_layoutreturn_type type,
 				     bool wait)
 {
 	struct nfs_inode *nfsi = NFS_I(ino);
 	struct nfs_server *nfss = NFS_SERVER(ino);
 
-	if (pnfs_enabled_sb(nfss) &&
-	    (type != RETURN_FILE || has_layout(nfsi)))
-		return _pnfs_return_layout(ino, range, type, wait);
+	if (pnfs_enabled_sb(nfss) && has_layout(nfsi))
+		return _pnfs_return_layout(ino, range, wait);
 
 	return 0;
 }
@@ -381,7 +378,6 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
 
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct pnfs_layout_range *range,
-				     enum pnfs_layoutreturn_type type,
 				     bool wait)
 {
 	return 0;
-- 
1.7.2.1


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

* [PATCH 3/4] pnfs-submit: remove has_layout_to_return()
  2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
  2010-11-15 19:00 ` [PATCH 2/4] pnfs-submit: remove type " Fred Isaman
@ 2010-11-15 19:00 ` Fred Isaman
  2010-11-15 19:00 ` [PATCH 4/4] pnfs-submit: move get_lseg into pnfs_has_layout, and rename Fred Isaman
  2010-11-17 17:27 ` [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Benny Halevy
  3 siblings, 0 replies; 5+ messages in thread
From: Fred Isaman @ 2010-11-15 19:00 UTC (permalink / raw)
  To: linux-nfs

Refactoring _pnfs_return_layout(), the only caller of
has_layout_to_return(), allows us to remove it entirely in favor of
pnfs_clear_lseg_list().

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pnfs.c |   34 ++++++----------------------------
 fs/nfs/pnfs.h |    2 +-
 2 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index eefa440..d06bf16 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -375,11 +375,13 @@ static void mark_lseg_invalid(struct pnfs_layout_segment *lseg,
 	}
 }
 
-void
+/* Returns false if there was nothing to do, true otherwise */
+bool
 pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo, struct list_head *tmp_list,
 		     struct pnfs_layout_range *range)
 {
 	struct pnfs_layout_segment *lseg, *next;
+	bool rv = false;
 
 	dprintk("%s:Begin lo %p offset %llu length %llu iomode %d\n",
 		__func__, lo, range->offset, range->length, range->iomode);
@@ -392,8 +394,10 @@ pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo, struct list_head *tmp_list,
 				lseg, lseg->range.iomode, lseg->range.offset,
 				lseg->range.length);
 			mark_lseg_invalid(lseg, tmp_list);
+			rv = true;
 		}
 	dprintk("%s:Return\n", __func__);
+	return rv;
 }
 
 void
@@ -566,25 +570,6 @@ send_layoutget(struct pnfs_layout_hdr *lo,
 	return lseg;
 }
 
-static struct pnfs_layout_segment *
-has_layout_to_return(struct pnfs_layout_hdr *lo,
-		     struct pnfs_layout_range *range)
-{
-	struct pnfs_layout_segment *out = NULL, *lseg;
-	dprintk("%s:Begin lo %p offset %llu length %llu iomode %d\n",
-		__func__, lo, range->offset, range->length, range->iomode);
-
-	assert_spin_locked(&lo->inode->i_lock);
-	list_for_each_entry(lseg, &lo->segs, fi_list)
-		if (should_free_lseg(&lseg->range, range)) {
-			out = lseg;
-			break;
-		}
-
-	dprintk("%s:Return lseg=%p\n", __func__, out);
-	return out;
-}
-
 void nfs4_asynch_forget_layouts(struct pnfs_layout_hdr *lo,
 				struct pnfs_layout_range *range,
 				int notify_bit, atomic_t *notify_count,
@@ -726,7 +711,6 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
 	struct nfs_inode *nfsi = NFS_I(ino);
 	struct pnfs_layout_range arg;
 	LIST_HEAD(tmp_list);
-	struct pnfs_layout_segment *lseg, *tmp;
 	int status = 0;
 
 	dprintk("--> %s\n", __func__);
@@ -737,18 +721,12 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
 
 	spin_lock(&ino->i_lock);
 	lo = nfsi->layout;
-	if (lo && !has_layout_to_return(lo, &arg))
-		lo = NULL;
-	if (!lo) {
+	if (!lo || !pnfs_clear_lseg_list(lo, &tmp_list, &arg)) {
 		spin_unlock(&ino->i_lock);
 		dprintk("%s: no layout segments to return\n", __func__);
 		goto out;
 	}
-
 	lo->plh_block_lgets++;
-	list_for_each_entry_safe(lseg, tmp, &lo->segs, fi_list)
-		if (should_free_lseg(&lseg->range, &arg))
-			mark_lseg_invalid(lseg, &tmp_list);
 	/* Reference matched in nfs4_layoutreturn_release */
 	get_layout_hdr(lo);
 	spin_unlock(&ino->i_lock);
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index a124ad2..3314f64 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -222,7 +222,7 @@ void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *,
 void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *);
 bool pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid);
 int pnfs_layout_process(struct nfs4_layoutget *lgp);
-void pnfs_clear_lseg_list(struct pnfs_layout_hdr *, struct list_head *tmp_list,
+bool pnfs_clear_lseg_list(struct pnfs_layout_hdr *, struct list_head *tmp_list,
 			  struct pnfs_layout_range *);
 void pnfs_free_lseg_list(struct list_head *tmp_list);
 void pnfs_destroy_layout(struct nfs_inode *);
-- 
1.7.2.1


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

* [PATCH 4/4] pnfs-submit: move get_lseg into pnfs_has_layout, and rename
  2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
  2010-11-15 19:00 ` [PATCH 2/4] pnfs-submit: remove type " Fred Isaman
  2010-11-15 19:00 ` [PATCH 3/4] pnfs-submit: remove has_layout_to_return() Fred Isaman
@ 2010-11-15 19:00 ` Fred Isaman
  2010-11-17 17:27 ` [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Benny Halevy
  3 siblings, 0 replies; 5+ messages in thread
From: Fred Isaman @ 2010-11-15 19:00 UTC (permalink / raw)
  To: linux-nfs

rename pnfs_has_layout to pnfs_find_lseg, and move get_lseg into
the function, only returning valid lsegs.  Additionally, make the
function static, as it now has only a single caller.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pnfs.c |   26 +++++++-------------------
 fs/nfs/pnfs.h |    2 --
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d06bf16..a21debe 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -860,8 +860,8 @@ is_matching_lseg(struct pnfs_layout_segment *lseg,
 /*
  * lookup range in layout
  */
-struct pnfs_layout_segment *
-pnfs_has_layout(struct pnfs_layout_hdr *lo,
+static struct pnfs_layout_segment *
+pnfs_find_lseg(struct pnfs_layout_hdr *lo,
 		struct pnfs_layout_range *range)
 {
 	struct pnfs_layout_segment *lseg, *ret = NULL;
@@ -870,7 +870,8 @@ pnfs_has_layout(struct pnfs_layout_hdr *lo,
 
 	assert_spin_locked(&lo->inode->i_lock);
 	list_for_each_entry(lseg, &lo->segs, fi_list) {
-		if (is_matching_lseg(lseg, range)) {
+		if (lseg->valid && is_matching_lseg(lseg, range)) {
+			get_lseg(lseg);
 			ret = lseg;
 			break;
 		}
@@ -913,22 +914,9 @@ pnfs_update_layout(struct inode *ino,
 	}
 
 	/* Check to see if the layout for the given range already exists */
-	lseg = pnfs_has_layout(lo, &arg);
-	if (lseg) {
-		if (lseg->valid) {
-			dprintk("%s: Using cached lseg %p for %llu@%llu "
-				"iomode %d)\n",
-				__func__,
-				lseg,
-				arg.length,
-				arg.offset,
-				arg.iomode);
-			get_lseg(lseg);
-			goto out_unlock;
-		}
-		/* someone is cleaning the layout */
-		lseg = NULL;
-	}
+	lseg = pnfs_find_lseg(lo, &arg);
+	if (lseg)
+		goto out_unlock;
 
 	/* if LAYOUTGET already failed once we don't try again */
 	if (test_bit(lo_fail_bit(iomode), &nfsi->layout->plh_flags))
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 3314f64..12fe7ab 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -199,8 +199,6 @@ void put_lseg(struct pnfs_layout_segment *lseg);
 bool should_free_lseg(struct pnfs_layout_range *lseg_range,
 		      struct pnfs_layout_range *recall_range);
 struct pnfs_layout_segment *
-pnfs_has_layout(struct pnfs_layout_hdr *lo, struct pnfs_layout_range *range);
-struct pnfs_layout_segment *
 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type);
 bool pnfs_return_layout_barrier(struct nfs_inode *, struct pnfs_layout_range *);
-- 
1.7.2.1


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

* Re: [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout
  2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
                   ` (2 preceding siblings ...)
  2010-11-15 19:00 ` [PATCH 4/4] pnfs-submit: move get_lseg into pnfs_has_layout, and rename Fred Isaman
@ 2010-11-17 17:27 ` Benny Halevy
  3 siblings, 0 replies; 5+ messages in thread
From: Benny Halevy @ 2010-11-17 17:27 UTC (permalink / raw)
  To: Fred Isaman; +Cc: linux-nfs

Thanks! All 4 patches merged in pnfs-all-2.6.37-rc2-2010-11-17

Benny

On 2010-11-15 21:00, Fred Isaman wrote:
> This is a relic from the old CB_LAYOUTRECALL code.
> 
> Signed-off-by: Fred Isaman <iisaman@netapp.com>
> ---
>  fs/nfs/inode.c          |    2 +-
>  fs/nfs/nfs4proc.c       |    5 -----
>  fs/nfs/pnfs.c           |   14 ++------------
>  fs/nfs/pnfs.h           |    5 +----
>  include/linux/nfs_xdr.h |    1 -
>  5 files changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 8727ade..3bf7a42 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -1419,7 +1419,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
>   */
>  void nfs4_evict_inode(struct inode *inode)
>  {
> -	pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
> +	pnfs_return_layout(inode, NULL, RETURN_FILE, true);
>  	truncate_inode_pages(&inode->i_data, 0);
>  	end_writeback(inode);
>  	pnfs_destroy_layout(NFS_I(inode));
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 55505e4..bd234c4 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5622,11 +5622,6 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
>  			return;
>  		}
>  	}
> -	if (lrp->stateid) {
> -		/* Forget the layout, without sending the return */
> -		rpc_exit(task, 0);
> -		return;
> -	}
>  	if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args,
>  				&lrp->res.seq_res, 0, task))
>  		return;
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 0b7fc1d..a62f518 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -693,7 +693,7 @@ out_nolayout:
>  static int
>  return_layout(struct inode *ino, struct pnfs_layout_range *range,
>  	      enum pnfs_layoutreturn_type type, struct pnfs_layout_hdr *lo,
> -	      bool wait, const nfs4_stateid *stateid)
> +	      bool wait)
>  {
>  	struct nfs4_layoutreturn *lrp;
>  	struct nfs_server *server = NFS_SERVER(ino);
> @@ -714,7 +714,6 @@ return_layout(struct inode *ino, struct pnfs_layout_range *range,
>  	lrp->args.return_type = type;
>  	lrp->args.range = *range;
>  	lrp->args.inode = ino;
> -	lrp->stateid = stateid;
>  	lrp->clp = server->nfs_client;
>  
>  	status = nfs4_proc_layoutreturn(lrp, wait);
> @@ -725,7 +724,6 @@ out:
>  
>  int
>  _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
> -		    const nfs4_stateid *stateid, /* optional */
>  		    enum pnfs_layoutreturn_type type,
>  		    bool wait)
>  {
> @@ -766,11 +764,6 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
>  		pnfs_free_lseg_list(&tmp_list);
>  
>  		if (layoutcommit_needed(nfsi)) {
> -			if (stateid && !wait) { /* callback */
> -				dprintk("%s: layoutcommit pending\n", __func__);
> -				status = -EAGAIN;
> -				goto out_put;
> -			}
>  			status = pnfs_layoutcommit_inode(ino, wait);
>  			if (status) {
>  				/* Return layout even if layoutcommit fails */
> @@ -779,14 +772,11 @@ _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
>  					__func__, status);
>  			}
>  		}
> -		status = return_layout(ino, &arg, type, lo, wait, stateid);
> +		status = return_layout(ino, &arg, type, lo, wait);
>  	}
>  out:
>  	dprintk("<-- %s status: %d\n", __func__, status);
>  	return status;
> -out_put:
> -	put_layout_hdr(ino);
> -	goto out;
>  }
>  
>  /*
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index c5b4282..46dab34 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -205,7 +205,6 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
>  		   enum pnfs_iomode access_type);
>  bool pnfs_return_layout_barrier(struct nfs_inode *, struct pnfs_layout_range *);
>  int _pnfs_return_layout(struct inode *, struct pnfs_layout_range *,
> -			const nfs4_stateid *stateid, /* optional */
>  			enum pnfs_layoutreturn_type, bool wait);
>  void set_pnfs_layoutdriver(struct nfs_server *, u32 id);
>  void unset_pnfs_layoutdriver(struct nfs_server *);
> @@ -279,7 +278,6 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
>  
>  static inline int pnfs_return_layout(struct inode *ino,
>  				     struct pnfs_layout_range *range,
> -				     const nfs4_stateid *stateid, /* optional */
>  				     enum pnfs_layoutreturn_type type,
>  				     bool wait)
>  {
> @@ -288,7 +286,7 @@ static inline int pnfs_return_layout(struct inode *ino,
>  
>  	if (pnfs_enabled_sb(nfss) &&
>  	    (type != RETURN_FILE || has_layout(nfsi)))
> -		return _pnfs_return_layout(ino, range, stateid, type, wait);
> +		return _pnfs_return_layout(ino, range, type, wait);
>  
>  	return 0;
>  }
> @@ -383,7 +381,6 @@ pnfs_layout_roc_iomode(struct nfs_inode *nfsi)
>  
>  static inline int pnfs_return_layout(struct inode *ino,
>  				     struct pnfs_layout_range *range,
> -				     const nfs4_stateid *stateid, /* optional */
>  				     enum pnfs_layoutreturn_type type,
>  				     bool wait)
>  {
> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
> index d4c4804..7a19acb 100644
> --- a/include/linux/nfs_xdr.h
> +++ b/include/linux/nfs_xdr.h
> @@ -276,7 +276,6 @@ struct nfs4_layoutreturn {
>  	struct nfs4_layoutreturn_args args;
>  	struct nfs4_layoutreturn_res res;
>  	struct rpc_cred *cred;
> -	const nfs4_stateid *stateid;
>  	struct nfs_client *clp;
>  	int rpc_status;
>  };

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

end of thread, other threads:[~2010-11-17 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
2010-11-15 19:00 ` [PATCH 2/4] pnfs-submit: remove type " Fred Isaman
2010-11-15 19:00 ` [PATCH 3/4] pnfs-submit: remove has_layout_to_return() Fred Isaman
2010-11-15 19:00 ` [PATCH 4/4] pnfs-submit: move get_lseg into pnfs_has_layout, and rename Fred Isaman
2010-11-17 17:27 ` [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Benny Halevy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).