Re: [PATCH 24/24] HWPOISON: show corrupted file info

From: Wu Fengguang
Date: Wed Dec 02 2009 - 08:38:15 EST


On Wed, Dec 02, 2009 at 09:20:48PM +0800, Andi Kleen wrote:
> > + dentry = d_find_alias(inode);
> > +
> > + if (dentry) {
> > + spin_lock(&dentry->d_lock);
> > + name = dentry->d_name.name;
> > + }
>
> The standard way to do that is d_path()

Good idea.

> But the paths are somewhat meaningless without the root.

It would still be more helpful :)

> Better to not print path names for now.

OK.

> And pgoff should be just a byte offset with a range

Makes sense.


btw, I have a patch (maybe out of date) to allow calling d_path()
without a known root:


Subject: vfs: enable __d_path() to handle NULL vfsmnt

Enable __d_path() to handle vfsmnt==NULL case.

This can happen when the caller only have a struct inode/dentry instead of a
struct file, and still want to print the (partial) path within the filesystem.

Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>
---

---
fs/dcache.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

--- linux-2.6.orig/fs/dcache.c
+++ linux-2.6/fs/dcache.c
@@ -1943,7 +1943,10 @@ char *__d_path(const struct path *path,

if (dentry == root->dentry && vfsmnt == root->mnt)
break;
- if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
+ if (unlikely(!vfsmnt)) {
+ if (IS_ROOT(dentry))
+ break;
+ } else if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
/* Global root? */
if (vfsmnt->mnt_parent == vfsmnt) {
goto global_root;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/