[Gluster-devel] lseek

Ian Latter ian.latter at midnightcode.org
Mon May 14 09:51:59 UTC 2012


Hello Xavi,


  Ok - thanks.  I was hoping that this was how read 
and write were working (i.e. with absolute offsets 
and not just getting relative offsets from the current
seek point), however what of the raw seek 
command?

     len = lseek(fd, 0, SEEK_END);

     Upon  successful completion, lseek() returns 
     the resulting offset location as measured in 
     bytes from the beginning of the  file.  

  Any idea on where the return value comes from?  
I will need to fake up a file size for this command ..



----- Original Message -----
>From: "Xavier Hernandez" <xhernandez at datalab.es>
>To: <gluster-devel at nongnu.org>
>Subject:  Re: [Gluster-devel] lseek
>Date: Mon, 14 May 2012 09:48:17 +0200
>
> 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.
> 
> Xavi
> 
> 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
> 
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> https://lists.nongnu.org/mailman/listinfo/gluster-devel
> 


--
Ian Latter
Late night coder ..
http://midnightcode.org/




More information about the Gluster-devel mailing list