Skip to contentSkip to conversation

dentry object

DISCUSSION Ashish Khurange 3 participants 4 messages Feb 28, 2006 VFS

lore
Share & tools
lore
#0 lore raw

Hi,
From a given dentry, i want to generate that files absolute path. I don't want to use d_path, because it doesn't cross mount points. Here is the algorithm what I have decided.

1. From dentry object get dname.
2. store in string
3. if IS_ROOT (dentry) goto stop
3. find its parent using dentry->parent
4. go to 1.

Stop.

Will this work?

I have one more question, when I have dentry of a file, then if dentries of all its parents up to '/' are present in the dcache?

Regards,
- Ashish K.

#1 lore raw
Quoted 11 lines · [email protected] wrote:

Hi,
From a given dentry, i want to generate that files absolute path. I
don't want to use d_path, because it doesn't cross mount points. Here is the algorithm what I have decided.

1. From dentry object get dname.
2. store in string
3. if IS_ROOT (dentry) goto stop
3. find its parent using dentry->parent
4. go to 1.

Quoted 7 lines

Stop.

Will this work?

I have one more question, when I have dentry of a file, then if dentries of all its parents up to '/' are present in the dcache?

AFAIK yes, unless the filesystem is being exported in which case this may not hold. Read Documentation/filesystems/Exporting.

Phillip

Quoted 7 lines

Regards,
- Ashish K.
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Ashish Khurange
Quoted 3 lines · Ashish Khurange

Hi,
From a given dentry, i want to generate that files absolute path. I don't want to use d_path, because it doesn't cross mount points.

Don't think this will cross mountpoints.

dentry->d_parent -> dentry at the root of a filesystem.

Check out fs/dcache.c:__d_path and look moe closely at d_path.

Quoted 22 lines

Here is the algorithm what I have decided.

1. From dentry object get dname.
2. store in string
3. if IS_ROOT (dentry) goto stop
3. find its parent using dentry->parent
4. go to 1.

Stop.

Will this work?

I have one more question, when I have dentry of a file, then if dentries of all its parents up to '/' are present in the dcache?

Regards,
- Ashish K.
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to [email protected]

[email protected] wrote:

I am sorry, if I am not using right terms. Please consider.

I have one basic query. I tried to google for 'dentry object' but didnt found the right answer. When I have dentry object of a file. Can I traverse till root's dentry using dentry->d_parent, step by step?

How does kernel shrinks dentry cache? Does it removes any of the dentry which is in 'parent path' of the concerned dentry object?

If kernel can remove such parent dentry, what happens when I access dentry->d_parent.

Thanks,
- Ashish

Quoted 46 lines
Quoted 10 lines · [email protected] wrote:

Hi,
From a given dentry, i want to generate that files absolute path. I don't want to use d_path, because it doesn't cross mount points. Here is the algorithm what I have decided.

1. From dentry object get dname.
2. store in string
3. if IS_ROOT (dentry) goto stop
3. find its parent using dentry->parent
4. go to 1.

Quoted 8 lines

Stop.

Will this work?

I have one more question, when I have dentry of a file, then if dentries of all its parents up to '/' are present in the dcache?

AFAIK yes, unless the filesystem is being exported in which case this may not hold. Read Documentation/filesystems/Exporting.

Phillip

Quoted 9 lines

Regards,
- Ashish K.
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html