[Gluster-devel] Inode to Gluster handle

Raghavendra Gowdappa rgowdapp at redhat.com
Mon Feb 20 04:05:03 UTC 2017


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.

regards,
Raghavendra

----- Original Message -----
> From: "chris holcombe" <chris.holcombe at canonical.com>
> To: gluster-devel at gluster.org
> Sent: Sunday, February 19, 2017 11:08:16 PM
> Subject: [Gluster-devel] 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 at gluster.org
> http://lists.gluster.org/mailman/listinfo/gluster-devel
> 


More information about the Gluster-devel mailing list