On Sun, Feb 19, 2017 at 11:05:03PM -0500, Raghavendra Gowdappa wrote: > Speaking of gluster internals, gluster relies primarily on gfid to identify file-system objects. So, if you've gfid, its easy to do operations on the fs object. In fact fuse mount even allows access to fs objects just by using gfids: > > --aux-gfid-mount Enable access to filesystem through gfid directly > > When glusterfs is mounted with the above option, one can access the file/directory using path <glusterfs-mount>/.gfid/<canonicalized-gfid> > > However, with just ino from stat I think it might not be possible to access the fs object. Note the following function, which derives ino from gfid: > > ino_t > gfid_to_ino (uuid_t gfid) > { > ino_t ino = 0; > int32_t i; > > for (i = 8; i < 16; i++) { > ino <<= 8; > ino += (uint8_t)gfid[i]; > } > > return ino; > } > > As can be seen above first 8 bytes of gfid is *lost*. So, I don't think its possible to derive gfid from ino. Without gfid or path, access to fs object is not possible > > PS: Though I've used the example of fuse, on a high level, the answer is same for gfapi. gfapi offers glfs_h_extract_handle() and glfs_h_create_from_handle(). Internally these function use the volume-id and gfid, it is not possible to use the inode#. https://github.com/gluster/glusterfs/blob/master/api/src/glfs-handles.h#L278-L289 This is what NFS-Ganesha uses too. A NFS-Client gets a handle (opaque string) from NFS-Ganesha and keeps it cached in combination with the inode. When the client access the inode again, it finds the cached handle and uses that to communicate back to NFS-Ganesha (and properly NFS-Ganesh server that is, after reboots and all, no server-side caching of the handle is required). This is pretty similar to how FUSE works internally as well. HTH, Niels > > regards, > Raghavendra > > ----- Original Message ----- > > From: "chris holcombe" <chris.holcombe@xxxxxxxxxxxxx> > > To: gluster-devel@xxxxxxxxxxx > > Sent: Sunday, February 19, 2017 11:08:16 PM > > Subject: Inode to Gluster handle > > > > Anyone know how to take an inode number and get a gfapi gluster object > > from it? Or possibly even better, convert it into a gluster path? > > > > Thanks, > > Chris > > _______________________________________________ > > Gluster-devel mailing list > > Gluster-devel@xxxxxxxxxxx > > http://lists.gluster.org/mailman/listinfo/gluster-devel > > > _______________________________________________ > Gluster-devel mailing list > Gluster-devel@xxxxxxxxxxx > http://lists.gluster.org/mailman/listinfo/gluster-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Gluster-devel mailing list Gluster-devel@xxxxxxxxxxx http://lists.gluster.org/mailman/listinfo/gluster-devel