2010-12-15 16:03:22

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 01/11] wave 2: restore removed comment in nfs4_evict_inode

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/inode.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 54a2fc7..e557d96 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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
--
1.7.2.1



2010-12-15 16:03:25

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 05/11] wave 2: remove notify_drained

Just code it inline.

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/callback.h | 5 -----
fs/nfs/pnfs.c | 2 +-
2 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index 6691be1..c4d2a07 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -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,
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index df6561a..dadc113 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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);
}
--
1.7.2.1


2010-12-15 16:03:24

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 04/11] wave 2: share code between put_lseg and pnfs_free_lseg_list

Create a free_lseg() function from the duplicated code.

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 5c6b4fb..df6561a 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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);
}

--
1.7.2.1


2010-12-15 16:03:28

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 11/11] wave 2: remove unneeded includes from callback_proc.c

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

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/callback_proc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index afa51c3..e541b94 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -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"
--
1.7.2.1


2010-12-15 16:03:26

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 08/11] wave 2: remove table above should_free_lseg

The table doesn't add any useful information.

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f2360af..f4e618d 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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)
--
1.7.2.1


2010-12-15 16:03:26

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 07/11] wave 2: remove trigger_flush

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

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/callback_proc.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 918d6c5..afa51c3 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -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;
}
--
1.7.2.1


2010-12-15 16:03:25

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 06/11] wave 2: rename notify fields

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

Signed-off-by: Fred Isaman <[email protected]>
---
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(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index a5fa786..918d6c5 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -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;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index dadc113..f2360af 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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);
}
}
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index f77a35b..deedcca 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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 {
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 7162c88..e0739a5 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -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 */

--
1.7.2.1


2010-12-15 16:03:23

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 03/11] wave 2: remove pnfs_ld_layoutret_on_setattr()

Dead code.

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.h | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index c413954..f77a35b 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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;
--
1.7.2.1


2010-12-15 16:03:23

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 02/11] wave 2: remove gratuitous changes to nfs4_layoutget_done

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4proc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d8f754e..096c89d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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;
}
--
1.7.2.1


2010-12-15 16:03:27

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 10/11] wave 2: remove unneeded include from pnfs.h

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

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index deedcca..7a4559e 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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 */
--
1.7.2.1


2010-12-15 16:03:27

by Fred Isaman

[permalink] [raw]
Subject: [PATCH 09/11] wave 2: Fix outdated comment above _pnfs_return_layout

Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f4e618d..93f50f4 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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)
--
1.7.2.1