Re: [PATCH 4/5] fuse: implement statx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 8/22/23 17:33, Miklos Szeredi wrote:
On Tue, 22 Aug 2023 at 17:20, Bernd Schubert <bernd.schubert@xxxxxxxxxxx> wrote:

Hi Miklos,

sorry for late review.

On 8/10/23 12:55, Miklos Szeredi wrote:
[...]
+static int fuse_do_statx(struct inode *inode, struct file *file,
+                      struct kstat *stat)
+{
+     int err;
+     struct fuse_attr attr;
+     struct fuse_statx *sx;
+     struct fuse_statx_in inarg;
+     struct fuse_statx_out outarg;
+     struct fuse_mount *fm = get_fuse_mount(inode);
+     u64 attr_version = fuse_get_attr_version(fm->fc);
+     FUSE_ARGS(args);
+
+     memset(&inarg, 0, sizeof(inarg));
+     memset(&outarg, 0, sizeof(outarg));
+     /* Directories have separate file-handle space */
+     if (file && S_ISREG(inode->i_mode)) {
+             struct fuse_file *ff = file->private_data;
+
+             inarg.getattr_flags |= FUSE_GETATTR_FH;
+             inarg.fh = ff->fh;
+     }
+     /* For now leave sync hints as the default, request all stats. */
+     inarg.sx_flags = 0;
+     inarg.sx_mask = STATX_BASIC_STATS | STATX_BTIME;



What is actually the reason not to pass through flags from
fuse_update_get_attr()? Wouldn't it make sense to request the minimal
required mask and then server side can decide if it wants to fill in more?

This and following commit is about btime and btime only.  It's about
adding just this single attribute, otherwise the logic is unchanged.

But the flexibility is there in the interface definition, and
functionality can be added later.

Sure, though what speaks against setting (limiting the mask) right away?

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 42f49fe6e770..de1d991757a5 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1168,7 +1168,8 @@ static void fuse_statx_to_attr(struct fuse_statx *sx, struct fuse_attr *attr)
 }
static int fuse_do_statx(struct inode *inode, struct file *file,
-                        struct kstat *stat)
+                        struct kstat *stat, u32 request_mask,
+                        unsigned int flags)
 {
        int err;
        struct fuse_attr attr;
@@ -1188,9 +1189,10 @@ static int fuse_do_statx(struct inode *inode, struct file *file,
                inarg.getattr_flags |= FUSE_GETATTR_FH;
                inarg.fh = ff->fh;
        }
-       /* For now leave sync hints as the default, request all stats. */
-       inarg.sx_flags = 0;
-       inarg.sx_mask = STATX_BASIC_STATS | STATX_BTIME;
+
+       /* request the given mask, server side is free to return more */
+       inarg.sx_flags = flags;
+       inarg.sx_mask = request_mask;
        args.opcode = FUSE_STATX;
        args.nodeid = get_node_id(inode);
        args.in_numargs = 1;
@@ -1304,7 +1306,8 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
                forget_all_cached_acls(inode);
                /* Try statx if BTIME is requested */
                if (!fc->no_statx && (request_mask & ~STATX_BASIC_STATS)) {
-                       err = fuse_do_statx(inode, file, stat);
+                       err = fuse_do_statx(inode, file, stat, request_mask,
+                                           flags);
                        if (err == -ENOSYS) {
                                fc->no_statx = 1;
                                goto retry;



Thanks,
Bernd



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux