> From: Ragnar Sundblad [mailto:ra...@csc.kth.se]
> Sent: Wednesday, April 28, 2010 3:49 PM
> 
> What indicators do you have that ONTAP/WAFL has inode->name lookup
> functionality? 

I don't have any such indicator, and if that's the way my words came out,
sorry for that.  Allow me to clarify:

In ontap, if you make a snapshot, and then move/rename directories all over
the place like crazy, and you're now in the totally restructured filesystem,
wanting to look at the previous version of some file or directory ... You
can still look in the .snapshot directory of the present filesystem, and you
can still see the contents of that subdirectory from a previous time.  There
is no difficulty trying to locate the old snapshots.

Actually, I'm glad you asked this question, because until now I assumed that
meant ontap was somehow keeping track of "mv" operations, and linking the
present .snapshot directory to whatever the old names used to be.  So you
could instantly get a listing of the present directory in a previous
filesystem snapshot, even though the present directory had a different name
or path name at some previous time.  But now that I'm explaining it out
loud, I realize that's not necessary.

All you need to be able to do is to read the contents of inode X in a
previous snapshot, even though you might not know the name or pathname of
inode X within that snapshot.  Is this possible?  

Instead of "file = open('/path/to/somefile')"  Can you "file =
openinode(12345)" instead?  Since you don't necessarily know the path to the
file, can you skip that step, and open an inode directly?  I'll look into
that, but I've never heard of it before, so if anyone already knows how,
please share.

 
> I must be missing something or maybe I am just plain stupid (both
> are probable), and just out of curiosity: What is the exact problem
> you are trying to solve? Providing a move/rename history? Is there
> a specific use case?

Specific case:

In order to implement zhist, I'd very much like to instantly locate previous
snapshot versions of a file or directory, even though you can't assume the
filename or path remained unchanged.

Let's suppose you rename, move, or modify a file or directory.
        mkdir -p /tank/widgets/a/rel2049_773.13-4
        echo "hi" > /tank/widgets/a/rel2049_773.13-4/somefile.txt
        (create snapshot "mysnap")
        mkdir -p /tank/widgets/b/foogoo_release_1.9
        mv /tank/widgets/a/rel2049_773.13-4/somefile.txt
/tank/widgets/b/foogoo_release_1.9/README
        echo " there" >> /tank/widgets/b/foogoo_release_1.9/README

Let's suppose you are now working on widget B, and you want to look at the
past zfs snapshot of README, but you don't remember where it came from.
That is, you don't know the previous name or location where that file used
to be.  One way you could do it would be:

Look up the inode number of README.  (for example, ls -i README)
                (suppose it's inode 12345)
find /tank/.zfs/snapshot -inum 12345

It will produce the result eventually:
        /tank/.zfs/snapshot/mysnap/a/rel2049_773.13-4/somefile.txt

So at last, you can see the previous version of that file.  Unfortunately,
the find command will take a very long time.  You might grow gray hair.


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to