Skip to contentSkip to conversation

SQUASHME pnfs-submit remove pnfs4_layout_reclaim

PATCH In review [email protected] 2 participants 3 messages Jul 21, 2010

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

PATCH 1/2 SQUASHME pnfs-submit remove pnfs4_layout_reclaim

From: Andy Adamson <[email protected]>

Not used. Destroy all layouts on lease expiration instead.

---
 fs/nfs/nfs4proc.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)
fs/nfs/nfs4proc.c +0 -13
index fd6438d..05f072c 100644
@@ -1094,17 +1094,6 @@ static struct nfs_open_context *nfs4_state_find_open_context(struct nfs4_state *
 	return ERR_PTR(-ENOENT);
 }
 
-static void pnfs4_layout_reclaim(struct nfs4_state *state)
-{
-#if defined(CONFIG_NFS_V4_1)
-	/* FIXME: send gratuitous layout commits and return with the reclaim
-	 * flag during grace period
-	 */
-	pnfs_destroy_layout(NFS_I(state->inode));
-	pnfs_set_layout_stateid(NFS_I(state->inode)->layout, &zero_stateid);
-#endif /* CONFIG_NFS_V4_1 */
-}
-
 static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context *ctx, struct nfs4_state *state)
 {
 	struct nfs4_opendata *opendata;
@@ -1181,7 +1170,6 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state *
 			       sizeof(state->stateid.u.data));
 		write_sequnlock(&state->seqlock);
 	}
-	pnfs4_layout_reclaim(state);
 	return 0;
 }
 
@@ -1236,7 +1224,6 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
 		return PTR_ERR(ctx);
 	ret = nfs4_do_open_reclaim(ctx, state);
 	put_nfs_open_context(ctx);
-	pnfs4_layout_reclaim(state);
 	return ret;
 }
 
Signature · 1 line
1.6.6
#1 lore raw

PATCH 2/2 SQUASHME pnfs-submit destroy all layouts upon lease expiration

From: Andy Adamson <[email protected]>

---
 fs/nfs/nfs4state.c |    1 +
 fs/nfs/pnfs.c      |   18 ++++++++++++++++++
 fs/nfs/pnfs.h      |    5 +++++
 3 files changed, 24 insertions(+), 0 deletions(-)
fs/nfs/nfs4state.c +1 -0
index 2696909..18284bd 100644
@@ -1471,6 +1471,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
 			}
 			clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
 			set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
+			pnfs_destroy_all_layouts(clp);
 		}
 
 		if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
fs/nfs/pnfs.c +18 -0
index 0f255f5..a0415d5 100644
@@ -399,6 +399,24 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
 	spin_unlock(&nfsi->vfs_inode.i_lock);
 }
 
+/*
+ * Called by the state manger to remove all layouts established under an
+ * expired lease.
+ */
+void
+pnfs_destroy_all_layouts(struct nfs_client *clp)
+{
+	struct pnfs_layout_type *lo;
+
+	while (!list_empty(&clp->cl_layouts)) {
+		lo = list_entry(clp->cl_layouts.next, struct pnfs_layout_type,
+				lo_layouts);
+		dprintk("%s freeing layout for inode %lu\n", __func__,
+			lo->lo_inode->i_ino);
+		pnfs_destroy_layout(NFS_I(lo->lo_inode));
+	}
+}
+
 static inline void
 init_lseg(struct pnfs_layout_type *lo, struct pnfs_layout_segment *lseg)
 {
fs/nfs/pnfs.h +5 -0
index 1d16049..30c91d0 100644
@@ -64,6 +64,7 @@ void pnfs_layout_release(struct pnfs_layout_type *, struct nfs4_pnfs_layout_segm
 void pnfs_set_layout_stateid(struct pnfs_layout_type *lo,
 			     const nfs4_stateid *stateid);
 void pnfs_destroy_layout(struct nfs_inode *);
+void pnfs_destroy_all_layouts(struct nfs_client *);
 void put_layout(struct inode *inode);
 void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_type *lo);
 
@@ -134,6 +135,10 @@ static inline void pnfs_update_layout(struct inode *ino,
 
 #else  /* CONFIG_NFS_V4_1 */
 
+static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
+{
+}
+
 static inline void pnfs_destroy_layout(struct nfs_inode *nfsi)
 {
 }
Signature · 1 line
1.6.6
#2 lore raw
In reply to [email protected]
Quoted 3 lines · On Jul. 21, 2010, 17:43 +0300, [email protected] wrote:

From: Andy Adamson <[email protected]>

Not used. Destroy all layouts on lease expiration instead.

What do you mean by not used?
You've just deleted two uses in this patch...

Benny

Quoted 44 lines
---
 fs/nfs/nfs4proc.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)
fs/nfs/nfs4proc.c +0 -13
index fd6438d..05f072c 100644
@@ -1094,17 +1094,6 @@ static struct nfs_open_context *nfs4_state_find_open_context(struct nfs4_state *
 	return ERR_PTR(-ENOENT);
 }
 
-static void pnfs4_layout_reclaim(struct nfs4_state *state)
-{
-#if defined(CONFIG_NFS_V4_1)
-	/* FIXME: send gratuitous layout commits and return with the reclaim
-	 * flag during grace period
-	 */
-	pnfs_destroy_layout(NFS_I(state->inode));
-	pnfs_set_layout_stateid(NFS_I(state->inode)->layout, &zero_stateid);
-#endif /* CONFIG_NFS_V4_1 */
-}
-
 static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context *ctx, struct nfs4_state *state)
 {
 	struct nfs4_opendata *opendata;
@@ -1181,7 +1170,6 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state *
 			       sizeof(state->stateid.u.data));
 		write_sequnlock(&state->seqlock);
 	}
-	pnfs4_layout_reclaim(state);
 	return 0;
 }
 
@@ -1236,7 +1224,6 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
 		return PTR_ERR(ctx);
 	ret = nfs4_do_open_reclaim(ctx, state);
 	put_nfs_open_context(ctx);
-	pnfs4_layout_reclaim(state);
 	return ret;
 }