[Gluster-devel] unify's return "struct stat" scheme

Amar S. Tumballi amar at zresearch.com
Mon Jan 14 08:07:27 UTC 2008


Hi Daobing,
 Thanks for such a detailed observation. Your suggestion holds good other
than for all the stats 'st_ino' field should be from namespace node.

 The respective code is committed now. (patch-636)

Thanks,
Amar

On Jan 10, 2008 8:21 AM, LI Daobing <lidaobing at gmail.com> wrote:

> Hello,
>
> this letter is relative with the last letter post by me in [1]
> [1] http://tinyurl.com/2lsa24
>
> unify adopt 4 schemes to return struct stat* in 18 functions.
>
> 1. struct stat* is returned from the data node: readv, writev

st_ino is not required as the stat returned here is not used by fuse layer.


>
> 2. struct stat* is returned from the NS node: mknod, mkdir, symlink,
> link, create

Mainly used for st_ino


>
> 3. most part of struct stat* is returned from the NS node, but mtime,
> st_size, st_blocks is returned from data node: lookup, stat, fstat,
> fchmod, fchown, ftruncate

just returning st_ino from NS node, and other from storage node is enough.


>
> 4. if it's a directory, return struct stat* from the NS node,
> otherwise same with 3: chmod, chown, truncate, utimens, rename
> (I don't know whether I have made mistake in this paragraph, :) )
>
I can see all your observations are right.


>
> Hmm, the unstable returned time will make vim give a warning (as I
> descripted in last letter). So I propose another scheme for returning
> struct stat*:
>
> 1. if it's a file: return struct stat* from the data node

st_ino should be from NS node.


>
> 2. if it's a dir: return struct stat* from the NS node
>


>
> under this scheme, at least the returned stat* can be stable.
>
> Any comment or suggestion? Thanks.
>
> --
> Best Regards,
>  LI Daobing
>
>


-- 
Amar Tumballi
Gluster/GlusterFS Hacker
[bulde on #gluster/irc.gnu.org]
http://www.zresearch.com - Commoditizing Supercomputing and Superstorage!



More information about the Gluster-devel mailing list