[Gluster-devel] How can add one fop after another fop?

Niels de Vos ndevos at redhat.com
Thu Mar 30 12:48:54 UTC 2017


On Thu, Mar 30, 2017 at 04:59:02PM +0430, Tahereh Fattahi wrote:
> Yes, I know the architecture of translators, of course I dont want to
> create a new translator.

A new xlator, or an extension to an existing one (I can't think of any
appropriate one though) would be the best solution.

> If I understand that my idea is correct I will create one page in
> uder_review tab, But I am not sure, I should test.
> First I need to know which function firstly execute when a create operation
> is running?

There are create functions in the different 'master xlator' (which is
the xlator that starts the top of the xlator-graph). For gfapi access
this is the pub_glfs_creat() or pub_glfs_open() function. There are also
functions in xlators/mount/fuse/src/fuse-bridge.c and under
xlators/nfs/server/. If you place the function addition in its own
xlator, it will be used by all access methods, and there would not be a
need to make modifications everywhere.

Niels


> 
> On Thu, Mar 30, 2017 at 4:10 PM, Niels de Vos <ndevos at redhat.com> wrote:
> 
> > On Thu, Mar 30, 2017 at 03:52:39PM +0430, Tahereh Fattahi wrote:
> > > Thanks for your answer.
> > > For example I want to save the number of files in directory as one
> > extended
> > > attribute.
> > > After every create operation, this number should be added and set as
> > > attribute, So after create I need a setxattr.
> > > But I dont know where this create is completed, I tested in dht
> > translator
> > > and it was false because the creation is not complete in this translator.
> >
> > Each xlator receives the create procedure (and its callback). The
> > "Glustr way" of doing this, could be to write your own xlator. Because
> > this is a functionality we would like to see too, it would be a great
> > opportunity to contribute such an xlator (or other approach?).
> >
> > My take on the functionality, is that the number of entries in a
> > directory can be represented as (struct stat)->st_size of a directory
> > inode. The Gluster internal representation could be stored as an xattr.
> >
> > You seem to be interested in implementing such a feature. If you write
> > an email to this list with your proposal, we can work with you to get
> > this included in one of the next versions.
> >
> > Once the approach has been settled upon, you can write a little design
> > document for the glusterfs-specs repository [0].
> >
> > HTH,
> > Niels
> >
> >
> > 0. https://github.com/gluster/glusterfs-specs (use Gerrit to post docs)
> >
> >
> > >
> > > On Thu, Mar 30, 2017 at 3:44 PM, Niels de Vos <ndevos at redhat.com> wrote:
> > >
> > > > On Thu, Mar 30, 2017 at 07:03:28AM +0430, Tahereh Fattahi wrote:
> > > > > Hi
> > > > > I want after create any file, do one setxattr automatically , where
> > and
> > > > how
> > > > > I should add this operation, and in which translator?
> > > >
> > > > We would like to add support for compound (or composite) FOPs through
> > > > libgfapi. This is currently not available yet, and I do not think
> > anyone
> > > > started working on it.
> > > >
> > > > Could you explain a little more about your use case for this? Concrete
> > > > examples will help in understanding and pointing you to potential
> > > > alternative solutions.
> > > >
> > > > Thanks,
> > > > Niels
> > > >
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20170330/6ad7f128/attachment.sig>


More information about the Gluster-devel mailing list