Message ID | 20231023180801.2953446-4-amir73il@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Support more filesystems with FAN_REPORT_FID | expand |
On Mon, Oct 23, 2023 at 09:08:00PM +0300, Amir Goldstein wrote: > Similar to the common FILEID_INO32* file handle types, define common > FILEID_INO64* file handle types. > > The type values of FILEID_INO64_GEN and FILEID_INO64_GEN_PARENT are the > values returned by fuse and xfs for 64bit ino encoded file handle types. Please actually switch xfs to fully use the helpers instead of duplicating the logic. Presumable the same for fuse, but for that I'd need to look at how it works for fuse right now and if there's not some subtle differences.
On Fri, Oct 27, 2023 at 9:05 AM Christoph Hellwig <hch@infradead.org> wrote: > > On Mon, Oct 23, 2023 at 09:08:00PM +0300, Amir Goldstein wrote: > > Similar to the common FILEID_INO32* file handle types, define common > > FILEID_INO64* file handle types. > > > > The type values of FILEID_INO64_GEN and FILEID_INO64_GEN_PARENT are the > > values returned by fuse and xfs for 64bit ino encoded file handle types. > > Please actually switch xfs to fully use the helpers instead of > duplicating the logic. I will follow up with another patch. > Presumable the same for fuse, but for that > I'd need to look at how it works for fuse right now and if there's not > some subtle differences. > There are subtle differences: 1. fuse encodes an internal nodeid - not i_ino 2. fuse encodes the inode number as [low32,high32] It cannot use the generic helper. Thanks, Amir.
On Fri, Oct 27, 2023 at 09:43:01AM +0300, Amir Goldstein wrote: > > Presumable the same for fuse, but for that > > I'd need to look at how it works for fuse right now and if there's not > > some subtle differences. > > > > There are subtle differences: > 1. fuse encodes an internal nodeid - not i_ino > 2. fuse encodes the inode number as [low32,high32] > > It cannot use the generic helper. That's what I almost feared. It still should use the common symbolic name for the format just to make everyones life simpler.
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 2e4eb7cf26fb..e63f966698a5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1002,7 +1002,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len, } *max_len = len; - return parent ? 0x82 : 0x81; + return parent ? FILEID_INO64_GEN_PARENT : FILEID_INO64_GEN; } static struct dentry *fuse_fh_to_dentry(struct super_block *sb, @@ -1010,7 +1010,8 @@ static struct dentry *fuse_fh_to_dentry(struct super_block *sb, { struct fuse_inode_handle handle; - if ((fh_type != 0x81 && fh_type != 0x82) || fh_len < 3) + if ((fh_type != FILEID_INO64_GEN && + fh_type != FILEID_INO64_GEN_PARENT) || fh_len < 3) return NULL; handle.nodeid = (u64) fid->raw[0] << 32; @@ -1024,7 +1025,7 @@ static struct dentry *fuse_fh_to_parent(struct super_block *sb, { struct fuse_inode_handle parent; - if (fh_type != 0x82 || fh_len < 6) + if (fh_type != FILEID_INO64_GEN_PARENT || fh_len < 6) return NULL; parent.nodeid = (u64) fid->raw[3] << 32; diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 85bd027494e5..4119d3ee72eb 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -98,6 +98,17 @@ enum fid_type { */ FILEID_FAT_WITH_PARENT = 0x72, + /* + * 64 bit inode number, 32 bit generation number. + */ + FILEID_INO64_GEN = 0x81, + + /* + * 64 bit inode number, 32 bit generation number, + * 64 bit parent inode number, 32 bit parent generation. + */ + FILEID_INO64_GEN_PARENT = 0x82, + /* * 128 bit child FID (struct lu_fid) * 128 bit parent FID (struct lu_fid)