2012-02-29 23:34:37

by Myklebust, Trond

[permalink] [raw]
Subject: [PATCH 1/2] NFSv4.1: Get rid of redundant NFS4CLNT_LAYOUTRECALL tests

The NFS4CLNT_LAYOUTRECALL tests in pnfs_layout_process and
pnfs_update_layout are redundant.

In the case of a bulk layout recall, we're always testing for
the NFS_LAYOUT_BULK_RECALL flay anyway.
In the case of a file or segment recall, the call to
pnfs_set_layout_stateid() updates the layout_header 'barrier'
sequence id, which triggers the test in pnfs_layoutgets_blocked()
and is less race-prone than NFS4CLNT_LAYOUTRECALL anyway.

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

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a534216..9c19f92 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -966,8 +966,7 @@ pnfs_update_layout(struct inode *ino,
}

/* Do we even need to bother with this? */
- if (test_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state) ||
- test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
+ if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
dprintk("%s matches recall, use MDS\n", __func__);
goto out_unlock;
}
@@ -1048,8 +1047,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
}

spin_lock(&ino->i_lock);
- if (test_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state) ||
- test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
+ if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
dprintk("%s forget reply due to recall\n", __func__);
goto out_forget_reply;
}
--
1.7.7.6



2012-02-29 23:34:38

by Myklebust, Trond

[permalink] [raw]
Subject: [PATCH 2/2] NFSv4.1: Get rid of NFS4CLNT_LAYOUTRECALL

The NFS4CLNT_LAYOUTRECALL bit is a long-term impediment to scalability. It
basically stops all other recalls by a given server once any layout recall
is requested.

If the recall is for a different file, then we don't care.
If the recall applies to the same file, then we're in one of two situations:
Either we are in the case of a replay of an existing request, in which case
the session is supposed to deal with matters, or we are dealing with a
completely different request, in which case we should just try to process
it.

Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/callback_proc.c | 6 +-----
fs/nfs/nfs4_fs.h | 1 -
2 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index f71978d..0e0865e 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -233,17 +233,13 @@ static u32 initiate_bulk_draining(struct nfs_client *clp,
static u32 do_callback_layoutrecall(struct nfs_client *clp,
struct cb_layoutrecallargs *args)
{
- u32 res = NFS4ERR_DELAY;
+ u32 res;

dprintk("%s enter, type=%i\n", __func__, args->cbl_recall_type);
- if (test_and_set_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state))
- goto out;
if (args->cbl_recall_type == RETURN_FILE)
res = initiate_file_draining(clp, args);
else
res = initiate_bulk_draining(clp, args);
- clear_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state);
-out:
dprintk("%s returning %i\n", __func__, res);
return res;

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b133b50..19079ec 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -20,7 +20,6 @@ enum nfs4_client_state {
NFS4CLNT_RECLAIM_REBOOT,
NFS4CLNT_RECLAIM_NOGRACE,
NFS4CLNT_DELEGRETURN,
- NFS4CLNT_LAYOUTRECALL,
NFS4CLNT_SESSION_RESET,
NFS4CLNT_RECALL_SLOT,
NFS4CLNT_LEASE_CONFIRM,
--
1.7.7.6


2012-03-01 15:39:37

by Anna Schumaker

[permalink] [raw]
Subject: Re: [PATCH 1/2] NFSv4.1: Get rid of redundant NFS4CLNT_LAYOUTRECALL tests

On 02/29/2012 06:34 PM, Trond Myklebust wrote:

> The NFS4CLNT_LAYOUTRECALL tests in pnfs_layout_process and
> pnfs_update_layout are redundant.
>
> In the case of a bulk layout recall, we're always testing for
> the NFS_LAYOUT_BULK_RECALL flay anyway.
> In the case of a file or segment recall, the call to
> pnfs_set_layout_stateid() updates the layout_header 'barrier'
> sequence id, which triggers the test in pnfs_layoutgets_blocked()
> and is less race-prone than NFS4CLNT_LAYOUTRECALL anyway.
>
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> fs/nfs/pnfs.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index a534216..9c19f92 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -966,8 +966,7 @@ pnfs_update_layout(struct inode *ino,
> }
>
> /* Do we even need to bother with this? */
> - if (test_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state) ||
> - test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
> + if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
> dprintk("%s matches recall, use MDS\n", __func__);
> goto out_unlock;
> }
> @@ -1048,8 +1047,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
> }
>
> spin_lock(&ino->i_lock);
> - if (test_bit(NFS4CLNT_LAYOUTRECALL, &clp->cl_state) ||
> - test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {


This was the only place that the clp structure was used, so you could probably remove it to avoid this warning:

fs/nfs/pnfs.c: In function 'pnfs_layout_process':
fs/nfs/pnfs.c:1058:21: warning: unused variable 'clp' [-Wunused-variable]

- Bryan

> + if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
> dprintk("%s forget reply due to recall\n", __func__);
> goto out_forget_reply;
> }



2012-03-01 16:18:27

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 1/2] NFSv4.1: Get rid of redundant NFS4CLNT_LAYOUTRECALL tests

T24gVGh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