[pnfs] [PATCH 1/2] pnfs: Add file layout comments and debugging info.
Dean Hildebrand
seattleplus at gmail.com
Mon May 12 14:35:16 EDT 2008
Other than comments, the main change is adding the
string version of the ip addr to the device so
it can be printed out for easier debugging.
Signed-off-by: Dean Hildebrand <dhildeb at us.ibm.com>
---
fs/nfs/nfs4filelayout.c | 20 +++++++++++++++-----
fs/nfs/nfs4filelayout.h | 4 ++++
fs/nfs/nfs4filelayoutdev.c | 17 ++++++++++++-----
fs/nfs/pnfs.c | 9 +++++----
4 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index c9b184e..020949f 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -208,8 +208,12 @@ static void filelayout_read_call_done(struct rpc_task *task, void *data)
{
struct nfs_read_data *rdata = (struct nfs_read_data *)data;
- if (rdata->orig_offset)
+
+ if (rdata->orig_offset) {
+ dprintk("%s new off %llu orig offset %llu\n",
+ __func__, rdata->args.offset, rdata->orig_offset);
rdata->args.offset = rdata->orig_offset;
+ }
pnfs_callback_ops->nfs_readlist_complete(rdata);
}
@@ -218,8 +222,11 @@ static void filelayout_write_call_done(struct rpc_task *task, void *data)
{
struct nfs_write_data *wdata = (struct nfs_write_data *)data;
- if (wdata->orig_offset)
+ if (wdata->orig_offset) {
+ dprintk("%s new off %llu orig offset %llu\n",
+ __func__, wdata->args.offset, wdata->orig_offset);
wdata->args.offset = wdata->orig_offset;
+ }
pnfs_callback_ops->nfs_writelist_complete(wdata);
}
@@ -274,7 +281,8 @@ static int filelayout_read_pagelist(
} else {
ds = dserver.dev->ds_list[0];
- dprintk("%s USE DS:ip %x\n", __func__, htonl(ds->ds_ip_addr));
+ dprintk("%s USE DS:ip %x %s\n", __func__,
+ htonl(ds->ds_ip_addr), ds->r_addr);
/* just try the first data server for the index..*/
data->pnfs_client = ds->ds_clp->cl_rpcclient;
@@ -308,6 +316,7 @@ print_ds(struct nfs4_pnfs_ds *ds)
dprintk(" ds->ds_port %hu\n", ntohs(ds->ds_port));
dprintk(" ds->ds_clp %p\n", ds->ds_clp);
dprintk(" ds->ds_count %d\n", atomic_read(&ds->ds_count));
+ dprintk(" %s\n", ds->r_addr);
}
/* Perform async writes. */
@@ -347,9 +356,10 @@ static int filelayout_write_pagelist(
/* use the first multipath data server */
ds = dserver.dev->ds_list[0];
- dprintk("%s ino %lu %Zu@%Lu DS:%x:%hu\n",
+ dprintk("%s ino %lu %Zu@%Lu DS:%x:%hu %s\n",
__func__, inode->i_ino, count, offset,
- htonl(ds->ds_ip_addr), ntohs(ds->ds_port));
+ htonl(ds->ds_ip_addr), ntohs(ds->ds_port),
+ ds->r_addr);
data->pnfs_client = ds->ds_clp->cl_rpcclient;
data->ds_nfs_client = ds->ds_clp;
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h
index b1f0284..4a75da7 100644
--- a/fs/nfs/nfs4filelayout.h
+++ b/fs/nfs/nfs4filelayout.h
@@ -32,14 +32,17 @@ enum stripetype4 {
STRIPE_DENSE = 2
};
+/* Individual ip address */
struct nfs4_pnfs_ds {
struct hlist_node ds_node; /* nfs4_pnfs_dev_hlist dev_dslist */
u32 ds_ip_addr;
u32 ds_port;
struct nfs_client *ds_clp;
atomic_t ds_count;
+ char r_addr[29];
};
+/* Individual data server with list of mutipath ip's*/
struct nfs4_pnfs_dev {
u32 stripe_index;
int num_ds;
@@ -60,6 +63,7 @@ struct nfs4_pnfs_dev_hlist {
struct hlist_head dev_dslist[NFS4_PNFS_DEV_HASH_SIZE];
};
+/* Actual file layout device (single devid) */
struct nfs4_pnfs_dserver {
struct nfs_fh *fh;
struct nfs4_pnfs_dev *dev;
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index ede71b0..23e94b2 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -81,6 +81,7 @@ print_ds_list(struct nfs4_pnfs_dev *fdev)
if (ds->ds_clp)
dprintk(" cl_exchange_flags %x\n",
ds->ds_clp->cl_exchange_flags);
+ dprintk(" ip:port %s\n", ds->r_addr);
ds++;
}
}
@@ -216,7 +217,8 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
int addrlen;
int err = 0;
- dprintk("--> %s\n", __func__);
+ dprintk("--> %s ip:port %s\n", __func__, ds->r_addr);
+
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = ds->ds_ip_addr;
sin.sin_port = ds->ds_port;
@@ -427,7 +429,7 @@ nfs4_pnfs_device_add(struct filelayout_mount_type *mt,
static void
nfs4_pnfs_ds_add(struct filelayout_mount_type *mt, struct nfs4_pnfs_ds **dsp,
- u32 ip_addr, u32 port)
+ u32 ip_addr, u32 port, char *r_addr, int len)
{
struct nfs4_pnfs_ds *tmp_ds, *ds;
struct nfs4_pnfs_dev_hlist *hlist = mt->hlist;
@@ -441,6 +443,7 @@ nfs4_pnfs_ds_add(struct filelayout_mount_type *mt, struct nfs4_pnfs_ds **dsp,
/* Initialize ds */
ds->ds_ip_addr = ip_addr;
ds->ds_port = port;
+ strncpy(ds->r_addr, r_addr, len);
atomic_set(&ds->ds_count, 1);
INIT_HLIST_NODE(&ds->ds_node);
@@ -496,7 +499,7 @@ decode_and_add_ds(uint32_t **pp, struct filelayout_mount_type *mt)
ip_addr = htonl((tmp[0]<<24) | (tmp[1]<<16) | (tmp[2]<<8) | (tmp[3]));
port = htons((tmp[4] << 8) | (tmp[5]));
- nfs4_pnfs_ds_add(mt, &ds, ip_addr, port);
+ nfs4_pnfs_ds_add(mt, &ds, ip_addr, port, r_addr, len);
/* XXX: Do we connect to data servers here?
* Don't want a lot of un-used (never used!) connections....
@@ -757,15 +760,19 @@ nfs4_pnfs_dserver_get(struct pnfs_layout_segment *lseg,
BUG_ON(stripe_idx >= di->stripe_count);
dserver->dev = &di->stripe_devs[stripe_idx];
- if (dserver->dev == NULL)
+ if (dserver->dev == NULL) {
+ printk(KERN_ERR "%s: No data server for device id (%s)!! \n",
+ __func__, deviceid_fmt(&layout->dev_id));
return 1;
+ }
if (layout->num_fh == 1)
dserver->fh = &layout->fh_array[0];
else
dserver->fh = &layout->fh_array[stripe_idx];
- dprintk("%s: dev_id=%s idx=%u, offset=%Lu, count=%Zu\n",
+ dprintk("%s: dev_id=%s ip:port=%s, idx=%u, offset=%Lu, count=%Zu\n",
__func__, deviceid_fmt(&layout->dev_id),
+ dserver->dev->ds_list[0]->r_addr,
stripe_idx, offset, count);
return 0;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b01527e..9b66785 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1421,10 +1421,9 @@ pnfs_file_write(struct file *filp, const char __user *buf, size_t count,
*pos,
IOMODE_RW,
NULL);
- if (status) {
- dprintk("%s: Unable to get a layout for %Zd@%llu iomode %d)\n",
- __func__, count, *pos, IOMODE_RW);
- }
+ if (status)
+ dprintk("%s: Unable to get a layout for %Zu@%llu iomode %d)\n",
+ __func__, count, *pos, IOMODE_RW);
out:
return do_sync_write(filp, buf, count, pos);
}
@@ -1464,6 +1463,8 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
IOMODE_RW,
&lseg);
if (status) {
+ dprintk("%s: Updating layout failed (%d), retry with NFS \n",
+ __func__, status);
status = 1; /* retry with nfs I/O */
goto out;
}
--
1.5.3.3
More information about the pNFS
mailing list