Skip to contentSkip to conversation

wave 2: restore removed comment in nfs4_evict_inode

PATCH New Fred Isaman 1 participant 11 messages Dec 15, 2010

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

PATCH 1/11 wave 2: restore removed comment in nfs4_evict_inode

---
 fs/nfs/inode.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/inode.c +1 -0
index 54a2fc7..e557d96 100644
@@ -1425,6 +1425,7 @@ void nfs4_evict_inode(struct inode *inode)
 	pnfs_destroy_layout(NFS_I(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);
 }
 #endif
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 2/11 wave 2: remove gratuitous changes to nfs4_layoutget_done

---
 fs/nfs/nfs4proc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +3 -3
index d8f754e..096c89d 100644
@@ -5405,12 +5405,13 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
 static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
 {
 	struct nfs4_layoutget *lgp = calldata;
-	struct inode *ino = lgp->args.inode;
+	struct nfs_server *server = NFS_SERVER(lgp->args.inode);
 
 	dprintk("--> %s\n", __func__);
 
 	if (!nfs4_sequence_done(task, &lgp->res.seq_res))
 		return;
+
 	switch (task->tk_status) {
 	case 0:
 		break;
@@ -5419,8 +5420,7 @@ static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
 		task->tk_status = -NFS4ERR_DELAY;
 		/* Fall through */
 	default:
-		if (nfs4_async_handle_error(task, NFS_SERVER(ino),
-					    NULL, NULL) == -EAGAIN) {
+		if (nfs4_async_handle_error(task, server, NULL, NULL) == -EAGAIN) {
 			rpc_restart_call_prepare(task);
 			return;
 		}
Signature · 1 line
1.7.2.1
#2 lore raw

PATCH 3/11 wave 2: remove pnfs_ld_layoutret_on_setattr()

In reply to Fred Isaman

Dead code.

---
 fs/nfs/pnfs.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
fs/nfs/pnfs.h +0 -6
index c413954..f77a35b 100644
@@ -336,12 +336,6 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, int sync)
 }
 
 static inline bool
-pnfs_ld_layoutret_on_setattr(struct inode *inode)
-{
-	return false;
-}
-
-static inline bool
 pnfs_roc(struct inode *ino)
 {
 	return false;
Signature · 1 line
1.7.2.1
#3 lore raw

PATCH 4/11 wave 2: share code between put_lseg and pnfs_free_lseg_list

In reply to Fred Isaman

Create a free_lseg() function from the duplicated code.

---
 fs/nfs/pnfs.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)
fs/nfs/pnfs.c +16 -18
index 5c6b4fb..df6561a 100644
@@ -280,6 +280,18 @@ init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
 	lseg->pls_notify_count = 0;
 }
 
+static void free_lseg(struct pnfs_layout_segment *lseg)
+{
+	struct inode *ino = lseg->layout->inode;
+	int count = lseg->pls_notify_count;
+
+	BUG_ON(atomic_read(&lseg->pls_refcount) != 0);
+	NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
+	notify_drained(NFS_SERVER(ino)->nfs_client, count);
+	/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
+	put_layout_hdr(NFS_I(ino)->layout);
+}
+
 static void
 _put_lseg_common(struct pnfs_layout_segment *lseg)
 {
@@ -329,14 +341,9 @@ put_lseg(struct pnfs_layout_segment *lseg)
 		test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
 	ino = lseg->layout->inode;
 	if (atomic_dec_and_lock(&lseg->pls_refcount, &ino->i_lock)) {
-		int count = lseg->pls_notify_count;
-
 		_put_lseg_common(lseg);
 		spin_unlock(&ino->i_lock);
-		NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
-		notify_drained(NFS_SERVER(ino)->nfs_client, count);
-		/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
-		put_layout_hdr(NFS_I(ino)->layout);
+		free_lseg(lseg);
 	}
 }
 EXPORT_SYMBOL_GPL(put_lseg);
@@ -402,18 +409,9 @@ void
 pnfs_free_lseg_list(struct list_head *free_me)
 {
 	struct pnfs_layout_segment *lseg, *tmp;
-	struct inode *ino;
-	int count;
-
-	list_for_each_entry_safe(lseg, tmp, free_me, fi_list) {
-		BUG_ON(atomic_read(&lseg->pls_refcount) != 0);
-		ino = lseg->layout->inode;
-		count = lseg->pls_notify_count;
-		NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
-		notify_drained(NFS_SERVER(ino)->nfs_client, count);
-		/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
-		put_layout_hdr(NFS_I(ino)->layout);
-	}
+
+	list_for_each_entry_safe(lseg, tmp, free_me, fi_list)
+		free_lseg(lseg);
 	INIT_LIST_HEAD(free_me);
 }
 
Signature · 1 line
1.7.2.1
#4 lore raw

PATCH 5/11 wave 2: remove notify_drained

In reply to Fred Isaman

Just code it inline.

---
 fs/nfs/callback.h |    5 -----
 fs/nfs/pnfs.c     |    2 +-
 2 files changed, 1 insertions(+), 6 deletions(-)
fs/nfs/callback.h +0 -5
index 6691be1..c4d2a07 100644
@@ -168,11 +168,6 @@ extern unsigned nfs4_callback_layoutrecall(
 
 extern void nfs4_check_drain_bc_complete(struct nfs4_session *ses);
 
-static inline void notify_drained(struct nfs_client *clp, int count)
-{
-	atomic_sub(count, &clp->cl_drain_notify);
-}
-
 #endif /* CONFIG_NFS_V4_1 */
 
 extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
fs/nfs/pnfs.c +1 -1
index df6561a..dadc113 100644
@@ -287,7 +287,7 @@ static void free_lseg(struct pnfs_layout_segment *lseg)
 
 	BUG_ON(atomic_read(&lseg->pls_refcount) != 0);
 	NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
-	notify_drained(NFS_SERVER(ino)->nfs_client, count);
+	atomic_sub(count, &NFS_SERVER(ino)->nfs_client->cl_drain_notify);
 	/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
 	put_layout_hdr(NFS_I(ino)->layout);
 }
Signature · 1 line
1.7.2.1
#5 lore raw

PATCH 6/11 wave 2: rename notify fields

In reply to Fred Isaman

Due to code changes, these no longer are involved in any notification. Instead, they are just counts, so name appropriately.

---
 fs/nfs/callback_proc.c    |    4 ++--
 fs/nfs/pnfs.c             |   10 +++++-----
 fs/nfs/pnfs.h             |    2 +-
 include/linux/nfs_fs_sb.h |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
fs/nfs/callback_proc.c +2 -2
index a5fa786..918d6c5 100644
@@ -202,9 +202,9 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp,
 	dprintk("%s enter, type=%i\n", __func__, args->cbl_recall_type);
 	if (test_and_set_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state))
 		goto out;
-	atomic_inc(&clp->cl_drain_notify);
+	atomic_inc(&clp->cl_recall_count);
 	status = initiate_layout_draining(clp, args);
-	if (atomic_dec_and_test(&clp->cl_drain_notify))
+	if (atomic_dec_and_test(&clp->cl_recall_count))
 		res = NFS4ERR_NOMATCHING_LAYOUT;
 	else
 		res = NFS4ERR_DELAY;
fs/nfs/pnfs.c +5 -5
index dadc113..f2360af 100644
@@ -277,17 +277,17 @@ init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
 	smp_mb();
 	set_bit(NFS_LSEG_VALID, &lseg->pls_flags);
 	lseg->layout = lo;
-	lseg->pls_notify_count = 0;
+	lseg->pls_recall_count = 0;
 }
 
 static void free_lseg(struct pnfs_layout_segment *lseg)
 {
 	struct inode *ino = lseg->layout->inode;
-	int count = lseg->pls_notify_count;
+	int count = lseg->pls_recall_count;
 
 	BUG_ON(atomic_read(&lseg->pls_refcount) != 0);
 	NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
-	atomic_sub(count, &NFS_SERVER(ino)->nfs_client->cl_drain_notify);
+	atomic_sub(count, &NFS_SERVER(ino)->nfs_client->cl_recall_count);
 	/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
 	put_layout_hdr(NFS_I(ino)->layout);
 }
@@ -590,8 +590,8 @@ void nfs4_asynch_forget_layouts(struct pnfs_layout_hdr *lo,
 	assert_spin_locked(&lo->inode->i_lock);
 	list_for_each_entry_safe(lseg, tmp, &lo->segs, fi_list)
 		if (should_free_lseg(&lseg->range, range)) {
-			lseg->pls_notify_count++;
-			atomic_inc(&NFS_SERVER(lo->inode)->nfs_client->cl_drain_notify);
+			lseg->pls_recall_count++;
+			atomic_inc(&NFS_SERVER(lo->inode)->nfs_client->cl_recall_count);
 			mark_lseg_invalid(lseg, tmp_list);
 		}
 }
fs/nfs/pnfs.h +1 -1
index f77a35b..deedcca 100644
@@ -44,7 +44,7 @@ struct pnfs_layout_segment {
 	atomic_t pls_refcount;
 	unsigned long pls_flags;
 	struct pnfs_layout_hdr *layout;
-	int pls_notify_count;
+	int pls_recall_count;
 };
 
 enum pnfs_try_status {
include/linux/nfs_fs_sb.h +1 -1
index 7162c88..e0739a5 100644
@@ -84,7 +84,7 @@ struct nfs_client {
 	u32			cl_exchange_flags;
 	struct nfs4_session	*cl_session; 	/* sharred session */
 	struct list_head	cl_layouts;
-	atomic_t		cl_drain_notify;
+	atomic_t		cl_recall_count; /* no. of lsegs in recall */
 	struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */
 #endif /* CONFIG_NFS_V4_1 */
 
Signature · 1 line
1.7.2.1
#6 lore raw

PATCH 7/11 wave 2: remove trigger_flush

In reply to Fred Isaman

We intend to just stop using the layout, no need to flush page cache.

---
 fs/nfs/callback_proc.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
fs/nfs/callback_proc.c +0 -8
index 918d6c5..afa51c3 100644
@@ -111,11 +111,6 @@ int nfs4_validate_delegation_stateid(struct nfs_delegation *delegation, const nf
 
 #if defined(CONFIG_NFS_V4_1)
 
-static void trigger_flush(struct inode *ino)
-{
-	write_inode_now(ino, 0);
-}
-
 static int initiate_layout_draining(struct nfs_client *clp,
 				    struct cb_layoutrecallargs *args)
 {
@@ -154,8 +149,6 @@ static int initiate_layout_draining(struct nfs_client *clp,
 		}
 		pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
 		spin_unlock(&lo->inode->i_lock);
-		if (rv == NFS4_OK)
-			trigger_flush(lo->inode);
 		pnfs_free_lseg_list(&free_me_list);
 	} else {
 		struct pnfs_layout_hdr *tmp;
@@ -185,7 +178,6 @@ static int initiate_layout_draining(struct nfs_client *clp,
 			nfs4_asynch_forget_layouts(lo, &range, &free_me_list);
 			list_del_init(&lo->plh_bulk_recall);
 			spin_unlock(&lo->inode->i_lock);
-			trigger_flush(lo->inode);
 			put_layout_hdr(lo);
 			rv = NFS4_OK;
 		}
Signature · 1 line
1.7.2.1
#7 lore raw

PATCH 8/11 wave 2: remove table above should_free_lseg

In reply to Fred Isaman

The table doesn't add any useful information.

---
 fs/nfs/pnfs.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
fs/nfs/pnfs.c +0 -11
index f2360af..f4e618d 100644
@@ -348,17 +348,6 @@ put_lseg(struct pnfs_layout_segment *lseg)
 }
 EXPORT_SYMBOL_GPL(put_lseg);
 
-/*
- * iomode matching rules:
- * range	lseg	match
- * -----	-----	-----
- * ANY		READ	true
- * ANY		RW	true
- * RW		READ	false
- * RW		RW	true
- * READ		READ	true
- * READ		RW	false
- */
 bool
 should_free_lseg(struct pnfs_layout_range *lseg_range,
 		 struct pnfs_layout_range *recall_range)
Signature · 1 line
1.7.2.1
#8 lore raw

PATCH 9/11 wave 2: Fix outdated comment above _pnfs_return_layout

In reply to Fred Isaman
---
 fs/nfs/pnfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfs/pnfs.c +3 -1
index f4e618d..93f50f4 100644
@@ -585,7 +585,9 @@ void nfs4_asynch_forget_layouts(struct pnfs_layout_hdr *lo,
 		}
 }
 
-/* Initiates a LAYOUTRETURN(FILE) */
+/* Since we are using the forgetful model, nothing is sent over the wire.
+ * However, we still must stop using any matching layouts.
+ */
 int
 _pnfs_return_layout(struct inode *ino, struct pnfs_layout_range *range,
 		    bool wait)
Signature · 1 line
1.7.2.1
#9 lore raw

PATCH 10/11 wave 2: remove unneeded include from pnfs.h

In reply to Fred Isaman

This was added to support now removed code, so it can go too.

---
 fs/nfs/pnfs.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
fs/nfs/pnfs.h +0 -1
index deedcca..7a4559e 100644
@@ -31,7 +31,6 @@
 #define FS_NFS_PNFS_H
 
 #include <linux/nfs_page.h>
-#include "callback.h" /* for cb_layoutrecallargs */
 
 enum {
 	NFS_LSEG_VALID = 0,	/* cleared when lseg is recalled/returned */
Signature · 1 line
1.7.2.1
#10 lore raw

PATCH 11/11 wave 2: remove unneeded includes from callback_proc.c

In reply to Fred Isaman

These were added to support now removed code, so they can go too.

---
 fs/nfs/callback_proc.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nfs/callback_proc.c +0 -3
index afa51c3..e541b94 100644
@@ -8,9 +8,6 @@
 #include <linux/nfs4.h>
 #include <linux/nfs_fs.h>
 #include <linux/slab.h>
-#include <linux/kthread.h>
-#include <linux/module.h>
-#include <linux/writeback.h>
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
Signature · 1 line
1.7.2.1