[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091202133753.GF13277@localhost>
Date:	Wed, 2 Dec 2009 21:37:53 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Nick Piggin <npiggin@...e.de>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 24/24] HWPOISON: show corrupted file info
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@...l.ustc.edu.cn>
---
---
 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists