Amin Abbaspour
2009-Jul-11 17:44 UTC
[Gluster-users] How to Extract File Location From fd_t
Hi All, I want to write a trace like translator with a limited FOP set just to notify if the file is modified or not (i.e. create, writev, unlink). I want to log this information including modified file names into a file or DB and use another process for indexing. My questions: 1. Is there any similar functionality in any of current xlators? 2. Is my FOP subset (mentioned above) correct or I have missed any other CUD (create, update, delete) operations? 3. If I write this module myself, I want to extend trace.c. Then in "trace_writev" I have fd in hand. How can I get this fd's file name? 4. If I do #3, will this cause multiple log for a single update operation? How can I notice that for example three last changes are for one update operation? 5. Should I ask all above in dev list? :) I wish I could express my questions. Thanks for your help. Amin Abbaspour
----- "Amin Abbaspour" <abbaspour_amin at yahoo.com> wrote:> Hi All, > > I want to write a trace like translator with a limited FOP set just to > notify if the file is modified or not (i.e. create, writev, unlink).> My questions: > > 1. Is there any similar functionality in any of current xlators?No.> 2. Is my FOP subset (mentioned above) correct or I have missed any > other CUD (create, update, delete) operations?Look at all the FOPs in afr-inode-write.c and afr-dir-write.c. Those are the ones that create, update or modify files and directories.> 3. If I write this module myself, I want to extend trace.c. Then in > "trace_writev" I have fd in hand. How can I get this fd's file name?Get the inode as fd->inode and then use inode_path (libglusterfs/src/inode.c) to get the name. Happy hacking, Vikas -- Engineer - http://gluster.com/ A: Because it messes up the way people read text. Q: Why is a top-posting such a bad thing? --
Amin Abbaspour
2009-Jul-16 10:06 UTC
[Gluster-users] How to Extract File Location From fd_t
Thanks Vikas, You replay was really helpful. Hope to set this xlator up soon. Amin Abbaspour --- On Tue, 7/14/09, Vikas Gorur <vikas at gluster.com> wrote:> From: Vikas Gorur <vikas at gluster.com> > Subject: Re: [Gluster-users] How to Extract File Location From fd_t > To: "Amin Abbaspour" <abbaspour_amin at yahoo.com> > Cc: gluster-users at gluster.org > Date: Tuesday, July 14, 2009, 1:01 PM > > ----- "Amin Abbaspour" <abbaspour_amin at yahoo.com> > wrote: > > > Hi All, > > > > I want to write a trace like translator with a limited > FOP set just to > > notify if the file is modified or not (i.e. create, > writev, unlink). > > > My questions: > > > > 1. Is there any similar functionality in any of > current xlators? > > No. > > > 2. Is my FOP subset (mentioned above) correct or I > have missed any > > other CUD (create, update, delete) operations? > > Look at all the FOPs in afr-inode-write.c and > afr-dir-write.c. Those > are the ones that create, update or modify files and > directories. > > > 3. If I write this module myself, I want to extend > trace.c. Then in > > "trace_writev" I have fd in hand. How can I get this > fd's file name? > > Get the inode as fd->inode and then use inode_path > (libglusterfs/src/inode.c) > to get the name. > > Happy hacking, > Vikas > -- > Engineer - http://gluster.com/ > > A: Because it messes up the way people read text. > Q: Why is a top-posting such a bad thing? > -- >