lkml.org 
[lkml]   [2009]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@mail.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;

\
 
 \ /
  Last update: 2009-12-02 14:41    [W:0.092 / U:75.344 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site