[Gluster-devel] lseek

Xavier Hernandez xhernandez at datalab.es
Mon May 14 07:48:17 UTC 2012

Hello Ian,

there is no such thing as an explicit seek in glusterfs. Each readv, 
writev, (f)truncate and rchecksum have an offset parameter that tells 
you the position where the operation must be performed.

If you make something that changes the size of the file you must make it 
in a way that it is transparent to upper translators. This means that 
all offsets you will receive are "real" (in your case, offsets in the 
uncompressed version of the file). You should calculate in some way the 
equivalent offset in the compressed version of the file and send it to 
the correspoding fop of the lower translators.

In the same way, you must return in all iatt structures the real size of 
the file (not the compressed size).

I'm not sure what is the intended use of NONSEEKABLE, but I think it is 
for special file types, like devices or similar that are sequential in 
nature. Anyway, this is a fuse flag that you can't return from a regular 
translator open fop.


On 05/14/2012 03:22 AM, Ian Latter wrote:
> Hello,
>    I'm looking for a seek (lseek) implementation in
> one of the modules and I can't see one.
>    Do I need to care about seeking if my module
> changes the file size (i.e. compresses) in Gluster?
> I would have thought that I did except that I believe
> that what I'm reading is that Gluster returns a
> NONSEEKABLE flag on file open (fuse_kernel.h at
> line 149).  Does this mitigate the need to correct
> the user seeks?
> Cheers,
> --
> Ian Latter
> Late night coder ..
> http://midnightcode.org/
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> https://lists.nongnu.org/mailman/listinfo/gluster-devel

More information about the Gluster-devel mailing list