These two patches bring Benny's git://linux-nfs.org/~bhalevy/linux-pnfs.git
pnfs-submit-wave3-rev5 branch in line with the wave 3 code just submitted for
review, caveat some author and patch comment differences.
The 16 patch wave 3 patch set can be found at
git://linux-nfs.org/projects/andros/nfs-2.6.git wave3-on-nfs-for-next-rev7
0001-SQUASHME-pnfs_submit-wave3-general-cleanup.patch
0002-SQUASHME-pnfs-submit-wave3-avoid-calculating-j-index.patch
-->Andy
From: Fred Isaman <[email protected]>
Calculating the j index is expensive, so save and reuse it instead of recalculating.
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4filelayout.c | 7 ++++---
fs/nfs/nfs4filelayout.h | 5 +++--
fs/nfs/nfs4filelayoutdev.c | 16 +++++++---------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 80e7a66..3768377 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -220,7 +220,7 @@ filelayout_read_pagelist(struct nfs_read_data *data)
struct pnfs_layout_segment *lseg = data->lseg;
struct nfs4_pnfs_ds *ds;
loff_t offset = data->args.offset;
- u32 idx;
+ u32 j, idx;
struct nfs_fh *fh;
dprintk("--> %s ino %lu pgbase %u req %Zu@%llu\n",
@@ -228,7 +228,8 @@ filelayout_read_pagelist(struct nfs_read_data *data)
data->args.pgbase, (size_t)data->args.count, offset);
/* Retrieve the correct rpc_client for the byte range */
- idx = nfs4_fl_calc_ds_index(lseg, offset);
+ j = nfs4_fl_calc_j_index(lseg, offset);
+ idx = nfs4_fl_calc_ds_index(lseg, j);
ds = nfs4_fl_prepare_ds(lseg, idx);
if (!ds) {
/* Either layout fh index faulty, or ds connect failed */
@@ -241,7 +242,7 @@ filelayout_read_pagelist(struct nfs_read_data *data)
/* No multipath support. Use first DS */
data->ds_clp = ds->ds_clp;
- fh = nfs4_fl_select_ds_fh(lseg, offset);
+ fh = nfs4_fl_select_ds_fh(lseg, j);
if (fh)
data->args.fh = fh;
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h
index 7e33bd8..1809aa6 100644
--- a/fs/nfs/nfs4filelayout.h
+++ b/fs/nfs/nfs4filelayout.h
@@ -84,12 +84,13 @@ FILELAYOUT_LSEG(struct pnfs_layout_segment *lseg)
}
extern struct nfs_fh *
-nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, loff_t offset);
+nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j);
extern void nfs4_fl_free_deviceid_callback(struct pnfs_deviceid_node *);
extern void print_ds(struct nfs4_pnfs_ds *ds);
extern void print_deviceid(struct nfs4_deviceid *dev_id);
-u32 nfs4_fl_calc_ds_index(struct pnfs_layout_segment *lseg, loff_t offset);
+u32 nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset);
+u32 nfs4_fl_calc_ds_index(struct pnfs_layout_segment *lseg, u32 j);
struct nfs4_pnfs_ds *nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg,
u32 ds_idx);
extern struct nfs4_file_layout_dsaddr *
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 1e1c536..2780d97 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -517,8 +517,8 @@ nfs4_fl_find_get_deviceid(struct nfs_client *clp, struct nfs4_deviceid *id)
* Want res = (offset - layout->pattern_offset)/ layout->stripe_unit
* Then: ((res + fsi) % dsaddr->stripe_count)
*/
-static u32
-_nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset)
+u32
+nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset)
{
struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
u64 tmp;
@@ -530,16 +530,13 @@ _nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset)
}
u32
-nfs4_fl_calc_ds_index(struct pnfs_layout_segment *lseg, loff_t offset)
+nfs4_fl_calc_ds_index(struct pnfs_layout_segment *lseg, u32 j)
{
- u32 j;
-
- j = _nfs4_fl_calc_j_index(lseg, offset);
return FILELAYOUT_LSEG(lseg)->dsaddr->stripe_indices[j];
}
struct nfs_fh *
-nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, loff_t offset)
+nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j)
{
struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
u32 i;
@@ -551,11 +548,12 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, loff_t offset)
/* Use the MDS OPEN fh set in nfs_read_rpcsetup */
return NULL;
else
- i = nfs4_fl_calc_ds_index(lseg, offset);
+ i = nfs4_fl_calc_ds_index(lseg, j);
} else
- i = _nfs4_fl_calc_j_index(lseg, offset);
+ i = j;
return flseg->fh_array[i];
}
+
void
filelayout_mark_devid_negative(struct nfs_client *mds_clp,
struct pnfs_deviceid_node *devid,
--
1.6.6
From: Andy Adamson <[email protected]>
Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/client.c | 11 ++++++-----
fs/nfs/nfs4filelayoutdev.c | 2 +-
fs/nfs/nfs4proc.c | 2 +-
fs/nfs/pagelist.c | 5 +++--
fs/nfs/pnfs.h | 1 +
fs/nfs/read.c | 20 +++++++-------------
6 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 17da633..78e6ebe 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -490,11 +490,12 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
* Look up a client by IP address and protocol version
* - creates a new record if one doesn't yet exist
*/
-static struct nfs_client *nfs_get_client(struct nfs_client_initdata *cl_init,
- const struct rpc_timeout *timeparms,
- const char *ip_addr,
- rpc_authflavor_t authflavour,
- int noresvport)
+static struct nfs_client *
+nfs_get_client(const struct nfs_client_initdata *cl_init,
+ const struct rpc_timeout *timeparms,
+ const char *ip_addr,
+ rpc_authflavor_t authflavour,
+ int noresvport)
{
struct nfs_client *clp, *new = NULL;
int error;
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index b8c3681..1e1c536 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -586,8 +586,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
struct nfs_server *s = NFS_SERVER(lseg->pls_layout->plh_inode);
int err;
- /* Already tried to connect, don't try again */
if (dsaddr->deviceid.de_flags & NFS4_DEVICE_ID_NEG_ENTRY) {
+ /* Already tried to connect, don't try again */
dprintk("%s Deviceid marked out of use\n", __func__);
return NULL;
}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index aab3efd..0f73db0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3111,7 +3111,7 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
/* Reset the the nfs_read_data to send the read to the MDS. */
void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data)
{
- dprintk("%s Reset task for i/o through \n", __func__);
+ dprintk("%s Reset task for i/o through\n", __func__);
/* offsets will differ in the dense stripe case */
data->args.offset = data->mds_offset;
data->ds_clp = NULL;
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index f0aa20b..2c793a7 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -257,8 +257,9 @@ static int nfs_can_coalesce_requests(struct nfs_page *prev,
return 0;
if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE)
return 0;
- /* For non-whole file layouts, need to check that req is inside of
- * pgio->pg_test.
+ /*
+ * Non-whole file layouts need to check that req is inside of
+ * pgio->pg_lseg.
*/
if (pgio->pg_test && !pgio->pg_test(pgio, prev, req))
return 0;
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index d2d708a..a760363 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -194,6 +194,7 @@ void pnfs_roc_release(struct inode *ino);
void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);
bool pnfs_roc_drain(struct inode *ino, u32 *barrier);
+
static inline int lo_fail_bit(u32 iomode)
{
return iomode == IOMODE_RW ?
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 896dc4e..9447156 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -22,7 +22,6 @@
#include <linux/module.h>
#include <asm/system.h>
-#include <linux/module.h>
#include "pnfs.h"
#include "nfs4_fs.h"
@@ -185,7 +184,8 @@ int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
/* Set up the initial task struct. */
NFS_PROTO(inode)->read_setup(data, &msg);
- dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
+ dprintk("NFS: %5u initiated read call (req %s/%lld, %u bytes @ "
+ "offset %llu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
@@ -200,16 +200,6 @@ int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
}
EXPORT_SYMBOL(nfs_initiate_read);
-static int pnfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
- const struct rpc_call_ops *call_ops)
-{
- if (data->lseg &&
- (pnfs_try_to_read_data(data, call_ops) == PNFS_ATTEMPTED))
- return 0;
-
- return nfs_initiate_read(data, clnt, call_ops);
-}
-
/*
* Set up the NFS read request struct
*/
@@ -238,7 +228,11 @@ static int nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
data->res.eof = 0;
nfs_fattr_init(&data->fattr);
- return pnfs_initiate_read(data, NFS_CLIENT(inode), call_ops);
+ if (data->lseg &&
+ (pnfs_try_to_read_data(data, call_ops) == PNFS_ATTEMPTED))
+ return 0;
+
+ return nfs_initiate_read(data, NFS_CLIENT(inode), call_ops);
}
static void
--
1.6.6
On 2011-02-14 14:31, [email protected] wrote:
> These two patches bring Benny's git://linux-nfs.org/~bhalevy/linux-pnfs.git
> pnfs-submit-wave3-rev5 branch in line with the wave 3 code just submitted for
> review, caveat some author and patch comment differences.
>
> The 16 patch wave 3 patch set can be found at
> git://linux-nfs.org/projects/andros/nfs-2.6.git wave3-on-nfs-for-next-rev7
>
> 0001-SQUASHME-pnfs_submit-wave3-general-cleanup.patch
> 0002-SQUASHME-pnfs-submit-wave3-avoid-calculating-j-index.patch
>
>
> -->Andy
Looks good to me.
Merged to pnfs-submit-wave3, thanks!
Benny