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

Niels de Vos ndevos at redhat.com
Thu Mar 30 11:40:08 UTC 2017


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/4372c966/attachment.sig>


More information about the Gluster-devel mailing list