Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294514
b: refs/heads/master
c: 20d27e9
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Mar 2, 2012
1 parent dda3f5f commit 73537f7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31b8e2aec099f22d40277c424d8c24b2a4c95fce
refs/heads/master: 20d27e929fb4790a339a4ddcc9a27f14db06055b
45 changes: 45 additions & 0 deletions trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,51 @@ struct nfs_fh *nfs_alloc_fhandle(void)
return fh;
}

/**
* _nfs_display_fhandle - display an NFS file handle on the console
*
* @fh: file handle to display
* @caption: display caption
*
* For debugging only.
*/
#ifdef RPC_DEBUG
void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption)
{
unsigned short i;

if (fh->size == 0 || fh == NULL) {
printk(KERN_DEFAULT "%s at %p is empty\n", caption, fh);
return;
}

printk(KERN_DEFAULT "%s at %p is %u bytes:\n", caption, fh, fh->size);
for (i = 0; i < fh->size; i += 16) {
__be32 *pos = (__be32 *)&fh->data[i];

switch ((fh->size - i - 1) >> 2) {
case 0:
printk(KERN_DEFAULT " %08x\n",
be32_to_cpup(pos));
break;
case 1:
printk(KERN_DEFAULT " %08x %08x\n",
be32_to_cpup(pos), be32_to_cpup(pos + 1));
break;
case 2:
printk(KERN_DEFAULT " %08x %08x %08x\n",
be32_to_cpup(pos), be32_to_cpup(pos + 1),
be32_to_cpup(pos + 2));
break;
default:
printk(KERN_DEFAULT " %08x %08x %08x %08x\n",
be32_to_cpup(pos), be32_to_cpup(pos + 1),
be32_to_cpup(pos + 2), be32_to_cpup(pos + 3));
}
}
}
#endif

/**
* nfs_inode_attrs_need_update - check if the inode attributes need updating
* @inode - pointer to inode
Expand Down
14 changes: 14 additions & 0 deletions trunk/include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,20 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
kfree(fh);
}

#ifdef RPC_DEBUG
extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
#define nfs_display_fhandle(fh, caption) \
do { \
if (unlikely(nfs_debug & NFSDBG_FACILITY)) \
_nfs_display_fhandle(fh, caption); \
} while (0)
#else
static inline void nfs_display_fhandle(const struct nfs_fh *fh,
const char *caption)
{
}
#endif

/*
* linux/fs/nfs/nfsroot.c
*/
Expand Down

0 comments on commit 73537f7

Please sign in to comment.