Tyler wrote:
MHD.Tayseer Alqouatli a écrit :
Hi all:
When the (vfs_rename_dir) or (vfs_rename_other) calls my underlying
file system's inode::rename(old_dir, old_dentry, new_dir, new_dentry)
What does the VFS expects from my filesystem to do when ?
First .. sure the VFS expects my fs to do the actual renaming on disk
blocks or update the metadata database or whatsoever, but what are
the changes it expect regarding it's own object (which are: old_dir,
old_dentry, new_dir, new_dentry in this case)
I've expected that I've to do a kind of association between the
new_dentry and the old_inode (as the old_inode will become the inode
of the new_dentry after renaming) but when i tried to read some
implementation of the inode::rename method on some simple file
systems to see how it works I couldn't figure out when or where such
an association is done (if it's really done) all that i've found is
some changes in the counters i couldn't understand well
Have i miss something ? any pointers will be helpful
Thanks in advance
MHD
Hi,
if you just rename the file, the inode structure should't change.
But the dentry should change. Especially the d_name field.
But also note that you have to change the parent directory. A
directory is a file which contains a list of his files. So you have to
change this list.
I think you juste have to do these operations. But im not a fs expert :)
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
Hi
Thanks Tyler .. your idea is logical and logically if I wanna move entry
specified with (new_dentry) from (old_dir) to (new_dir) i have to:
1- change the name of (old_dentry) to the name denoted by
(new_dentry->d_name) -doest i have to do any hashing/rehashing of the
names ?-
2- change the parent of (old_dentry) to refer to (new_dir) -"how could
this be done?"
3- decrease link count for (old_dir)
4- increase link count for (new_dir)
5- is there any thing else ?
if you check the simple_rename (which is the vfs default for rename
method) you won't see anything from the above but the link count
modification :) what is being missing ?
Another point will be abserved when checking simple_rename that it
unlinks the (new_dentry) if it was not negative (if it has an inode
associated with it) .. this is right if the destination name was a file
already exists so we have to overwrite it ... but if the destinaion name
was an already existing directory we'll move the source name into this
directory not unlink the destination directory
Any help will be appreciated .. the VFS design is nice but the
interfaces, pre_condition, post_conditions of it methods are not clear
Thanks
MHD
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/