Skip to contentSkip to conversation

famfs port to fuse - questions

DISCUSSION John Groves 3 participants 7 messages Feb 24, 2025 – Apr 11, 2025 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Miklos et. al.:

Here are some specific questions related to the famfs port into fuse [1][2] that I hope Miklos (and others) can give me feedback on soonish.

This work is active and serious, although you haven't heard much from me recently. I'm showing a famfs poster at Usenix FAST '25 this week [3].

I'm generally following the approach in [1] - in a famfs file system, LOOKUP is followed by GET_FMAP to retrieve the famfs file/dax metadata. It's tempting to merge the fmap into the LOOKUP reply, but this seems like an optimization to consider once basic function is established.

Q: Do you think it makes sense to make the famfs fmap an optional,
variable sized addition to the LOOKUP response?

Whenever an fmap references a dax device that isn't already known to the famfs/fuse kernel code, a GET_DAXDEV message is sent, with the reply providing the info required to open teh daxdev. A file becomes available when the fmap is complete and all referenced daxdevs are "opened".

Q: Any heartburn here?

When GET_FMAP is separate from LOOKUP, READDIRPLUS won't add value unless it receives fmaps as part of the attributes (i.e. lookups) that come back in its response - since a READDIRPLUS that gets 12 files will still need 12 GET_FMAP messages/responses to be complete. Merging fmaps as optional, variable-length components of the READDIRPLUS response buffers could eventualy make sense, but a cleaner solution intially would seem to be to disable READDIRPLUS in famfs. But...

* The libfuse/kernel ABI appears to allow low-level fuse servers that don't support READDIRPLUS...
* But libfuse doesn't look at conn->want for the READDIRPLUS related capabilities
* I have overridden that, but the kernel still sends the READDIRPLUS messages. It's possible I'm doing something hinky, and I'll keep looking for it.
* When I just return -ENOSYS to READDIRPLUS, things don't work well. Still looking into this.

Q: Do you know whether the current fuse kernel mod can handle a low-level
fuse server that doesn't support READDIRPLUS? This may be broken.

Q: If READDIRPLUS isn't actually optional, do you think the same attribute
reply merge (attr + famfs fmap) is viable for READDIRPLUS? I'd very much like to do this part "later".

Q: Are fuse lowlevel file systems like famfs expected to use libfuse and its
message handling (particularly init), or is it preferred that they not do so? Seems a shame to throw away all that api version checking, but turning off READDIRPLUS would require changes that might affect other libfuse clients. Please advise...

Note that the intended use cases for famfs generally involve large files rather than *many* files, so giving up READDIRPLUS may not matter very much, at least in the early going.

I'm hoping to get an initial RFC patch set out in a few weeks, but these questions address [some of] the open issues that need to be [at least initially] resolved first.

Regards,
John

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lwn.net/Articles/983105/
[3] https://www.usenix.org/conference/fast25/poster-session

#1 lore raw
Quoted 24 lines · John Groves

Miklos et. al.:

Here are some specific questions related to the famfs port into fuse [1][2] that I hope Miklos (and others) can give me feedback on soonish.

This work is active and serious, although you haven't heard much from me recently. I'm showing a famfs poster at Usenix FAST '25 this week [3].

I'm generally following the approach in [1] - in a famfs file system, LOOKUP is followed by GET_FMAP to retrieve the famfs file/dax metadata. It's tempting to merge the fmap into the LOOKUP reply, but this seems like an optimization to consider once basic function is established.

Q: Do you think it makes sense to make the famfs fmap an optional,
variable sized addition to the LOOKUP response?

Whenever an fmap references a dax device that isn't already known to the famfs/fuse kernel code, a GET_DAXDEV message is sent, with the reply providing the info required to open teh daxdev. A file becomes available when the fmap is complete and all referenced daxdevs are "opened".

Q: Any heartburn here?

Quoted 8 lines

When GET_FMAP is separate from LOOKUP, READDIRPLUS won't add value unless it receives fmaps as part of the attributes (i.e. lookups) that come back in its response - since a READDIRPLUS that gets 12 files will still need 12 GET_FMAP messages/responses to be complete. Merging fmaps as optional, variable-length components of the READDIRPLUS response buffers could eventualy make sense, but a cleaner solution intially would seem to be to disable READDIRPLUS in famfs. But...

Hi John,

Quoted 7 lines

* The libfuse/kernel ABI appears to allow low-level fuse servers that don't support READDIRPLUS...
* But libfuse doesn't look at conn->want for the READDIRPLUS related capabilities
* I have overridden that, but the kernel still sends the READDIRPLUS messages. It's possible I'm doing something hinky, and I'll keep looking for it.

On the kernel side, FUSE_READDIR / FUSE_READDIRPLUS requests are sent in fuse_readdir_uncached(). I don't see anything there that skips sending readdir / readdirplus requests if the server doesn't have .readdir / .readdirplus implemented. For some request types (eg FUSE_RENAME2, FUSE_LINK, FUSE_FSYNCDIR, FUSE_CREATE, ...), we do track if a request type isn't implemented by the server and then skip sending that request in the future (for example, see fuse_tmpfile()). If we wanted to do this skipping for readdir as well, it'd probably look something like

fs/fuse/fuse_i.h +3 -0
@@ -870,6 +870,9 @@ struct fuse_conn {
        /* Is link not implemented by fs? */
        unsigned int no_link:1;
 
+       /* Is readdir/readdirplus not implemented by fs? */
+       unsigned int no_readdir:1;
+
        /* Use io_uring for communication */
        unsigned int io_uring;
 
fs/fuse/readdir.c +0 -0
index 17ce9636a2b1..176d6ce953e5 100644
@@ -341,6 +341,9 @@ static int fuse_readdir_uncached(struct file

*file, struct dir_context *ctx)

        u64 attr_version = 0, evict_ctr = 0;
        bool locked;

+ if (fm->fc->no_readdir)
+ return -ENOSYS;
+

        folio = folio_alloc(GFP_KERNEL, 0);
        if (!folio)
                return -ENOMEM;
@@ -376,6 +379,8 @@ static int fuse_readdir_uncached(struct file
*file, struct dir_context *ctx)
                        res = parse_dirfile(folio_address(folio), res, file,
                                            ctx);
                }
+       } else if (res == -ENOSYS) {
+               fm->fc->no_readdir = 1;
        }

        folio_put(folio);
Quoted 5 lines

* When I just return -ENOSYS to READDIRPLUS, things don't work well. Still looking into this.

Q: Do you know whether the current fuse kernel mod can handle a low-level
fuse server that doesn't support READDIRPLUS? This may be broken.

From what I see, the fuse kernel code can handle servers that don't support readdir/readdirplus. The fuse readdir path gets invoked from file_operations->iterate_shared callback, which from what i see, the only ramification of this always returning an error is that the syscalls calling into this (eg getdents(), readdir()) fail.

Quoted 11 lines

Q: If READDIRPLUS isn't actually optional, do you think the same attribute
reply merge (attr + famfs fmap) is viable for READDIRPLUS? I'd very much like to do this part "later".

Q: Are fuse lowlevel file systems like famfs expected to use libfuse and its
message handling (particularly init), or is it preferred that they not do so? Seems a shame to throw away all that api version checking, but turning off READDIRPLUS would require changes that might affect other libfuse clients. Please advise...

imo, I don't see any benefits from using a custom-written library instead of libfuse. I think there'd end up being a lot of overlap between the two and wouldn't be worth the hassle.

Quoted 8 lines

Note that the intended use cases for famfs generally involve large files rather than *many* files, so giving up READDIRPLUS may not matter very much, at least in the early going.

I'm hoping to get an initial RFC patch set out in a few weeks, but these questions address [some of] the open issues that need to be [at least initially] resolved first.

Looking forward to reading your RFC patch.

Thanks,
Joanne

Quoted 7 lines

Regards,
John

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lwn.net/Articles/983105/
[3] https://www.usenix.org/conference/fast25/poster-session

#2 lore raw
Quoted 95 lines · Joanne Koong
Quoted 24 lines · John Groves

Miklos et. al.:

Here are some specific questions related to the famfs port into fuse [1][2] that I hope Miklos (and others) can give me feedback on soonish.

This work is active and serious, although you haven't heard much from me recently. I'm showing a famfs poster at Usenix FAST '25 this week [3].

I'm generally following the approach in [1] - in a famfs file system, LOOKUP is followed by GET_FMAP to retrieve the famfs file/dax metadata. It's tempting to merge the fmap into the LOOKUP reply, but this seems like an optimization to consider once basic function is established.

Q: Do you think it makes sense to make the famfs fmap an optional,
variable sized addition to the LOOKUP response?

Whenever an fmap references a dax device that isn't already known to the famfs/fuse kernel code, a GET_DAXDEV message is sent, with the reply providing the info required to open teh daxdev. A file becomes available when the fmap is complete and all referenced daxdevs are "opened".

Q: Any heartburn here?

Quoted 8 lines

When GET_FMAP is separate from LOOKUP, READDIRPLUS won't add value unless it receives fmaps as part of the attributes (i.e. lookups) that come back in its response - since a READDIRPLUS that gets 12 files will still need 12 GET_FMAP messages/responses to be complete. Merging fmaps as optional, variable-length components of the READDIRPLUS response buffers could eventualy make sense, but a cleaner solution intially would seem to be to disable READDIRPLUS in famfs. But...

Hi John,

Quoted 7 lines

* The libfuse/kernel ABI appears to allow low-level fuse servers that don't support READDIRPLUS...
* But libfuse doesn't look at conn->want for the READDIRPLUS related capabilities
* I have overridden that, but the kernel still sends the READDIRPLUS messages. It's possible I'm doing something hinky, and I'll keep looking for it.

On the kernel side, FUSE_READDIR / FUSE_READDIRPLUS requests are sent in fuse_readdir_uncached(). I don't see anything there that skips sending readdir / readdirplus requests if the server doesn't have .readdir / .readdirplus implemented. For some request types (eg FUSE_RENAME2, FUSE_LINK, FUSE_FSYNCDIR, FUSE_CREATE, ...), we do track if a request type isn't implemented by the server and then skip sending that request in the future (for example, see fuse_tmpfile()). If we wanted to do this skipping for readdir as well, it'd probably look something like

fs/fuse/fuse_i.h +3 -0
@@ -870,6 +870,9 @@ struct fuse_conn {
        /* Is link not implemented by fs? */
        unsigned int no_link:1;
 
+       /* Is readdir/readdirplus not implemented by fs? */
+       unsigned int no_readdir:1;
+
        /* Use io_uring for communication */
        unsigned int io_uring;
 
fs/fuse/readdir.c +3 -0
index 17ce9636a2b1..176d6ce953e5 100644
@@ -341,6 +341,9 @@ static int fuse_readdir_uncached(struct file
 *file, struct dir_context *ctx)
        u64 attr_version = 0, evict_ctr = 0;
        bool locked;
 
+       if (fm->fc->no_readdir)
+               return -ENOSYS;
+
        folio = folio_alloc(GFP_KERNEL, 0);
        if (!folio)
                return -ENOMEM;
fs/fuse/readdir.c +2 -0
@@ -376,6 +379,8 @@ static int fuse_readdir_uncached(struct file
 *file, struct dir_context *ctx)
                        res = parse_dirfile(folio_address(folio), res, file,
                                            ctx);
                }
+       } else if (res == -ENOSYS) {
+               fm->fc->no_readdir = 1;
        }
 
        folio_put(folio);
Quoted 3 lines

* When I just return -ENOSYS to READDIRPLUS, things don't work well. Still looking into this.

Quoted 8 lines
Quoted 2 lines

Q: Do you know whether the current fuse kernel mod can handle a low-level
fuse server that doesn't support READDIRPLUS? This may be broken.

From what I see, the fuse kernel code can handle servers that don't support readdir/readdirplus. The fuse readdir path gets invoked from file_operations->iterate_shared callback, which from what i see, the only ramification of this always returning an error is that the syscalls calling into this (eg getdents(), readdir()) fail.

Thanks for doing some of the digging Joanne. I'm not sure what was going wrong a few weeks ago when I initially disabled readdirplus, but I have it working now - in fact I now have famfs "fully" working under fuse (for some definition of fully ;).

I have a gnarly rebase plus some documentation to write, but I may go ahead and share branches this week, in case anybody wants to take a look. That will be a fuse kernel branch, and a famfs user space branch...

Also: any plans for a fuse BOF at LSFMM?

<snip>

Thanks,
John

#3 lore raw
Quoted 106 lines · John Groves
Quoted 95 lines · Joanne Koong
Quoted 24 lines · John Groves

Miklos et. al.:

Here are some specific questions related to the famfs port into fuse [1][2] that I hope Miklos (and others) can give me feedback on soonish.

This work is active and serious, although you haven't heard much from me recently. I'm showing a famfs poster at Usenix FAST '25 this week [3].

I'm generally following the approach in [1] - in a famfs file system, LOOKUP is followed by GET_FMAP to retrieve the famfs file/dax metadata. It's tempting to merge the fmap into the LOOKUP reply, but this seems like an optimization to consider once basic function is established.

Q: Do you think it makes sense to make the famfs fmap an optional,
variable sized addition to the LOOKUP response?

Whenever an fmap references a dax device that isn't already known to the famfs/fuse kernel code, a GET_DAXDEV message is sent, with the reply providing the info required to open teh daxdev. A file becomes available when the fmap is complete and all referenced daxdevs are "opened".

Q: Any heartburn here?

Quoted 8 lines

When GET_FMAP is separate from LOOKUP, READDIRPLUS won't add value unless it receives fmaps as part of the attributes (i.e. lookups) that come back in its response - since a READDIRPLUS that gets 12 files will still need 12 GET_FMAP messages/responses to be complete. Merging fmaps as optional, variable-length components of the READDIRPLUS response buffers could eventualy make sense, but a cleaner solution intially would seem to be to disable READDIRPLUS in famfs. But...

Hi John,

Quoted 7 lines

* The libfuse/kernel ABI appears to allow low-level fuse servers that don't support READDIRPLUS...
* But libfuse doesn't look at conn->want for the READDIRPLUS related capabilities
* I have overridden that, but the kernel still sends the READDIRPLUS messages. It's possible I'm doing something hinky, and I'll keep looking for it.

On the kernel side, FUSE_READDIR / FUSE_READDIRPLUS requests are sent in fuse_readdir_uncached(). I don't see anything there that skips sending readdir / readdirplus requests if the server doesn't have .readdir / .readdirplus implemented. For some request types (eg FUSE_RENAME2, FUSE_LINK, FUSE_FSYNCDIR, FUSE_CREATE, ...), we do track if a request type isn't implemented by the server and then skip sending that request in the future (for example, see fuse_tmpfile()). If we wanted to do this skipping for readdir as well, it'd probably look something like

fs/fuse/fuse_i.h +3 -0
@@ -870,6 +870,9 @@ struct fuse_conn {
        /* Is link not implemented by fs? */
        unsigned int no_link:1;
 
+       /* Is readdir/readdirplus not implemented by fs? */
+       unsigned int no_readdir:1;
+
        /* Use io_uring for communication */
        unsigned int io_uring;
 
fs/fuse/readdir.c +3 -0
index 17ce9636a2b1..176d6ce953e5 100644
@@ -341,6 +341,9 @@ static int fuse_readdir_uncached(struct file
 *file, struct dir_context *ctx)
        u64 attr_version = 0, evict_ctr = 0;
        bool locked;
 
+       if (fm->fc->no_readdir)
+               return -ENOSYS;
+
        folio = folio_alloc(GFP_KERNEL, 0);
        if (!folio)
                return -ENOMEM;
fs/fuse/readdir.c +2 -0
@@ -376,6 +379,8 @@ static int fuse_readdir_uncached(struct file
 *file, struct dir_context *ctx)
                        res = parse_dirfile(folio_address(folio), res, file,
                                            ctx);
                }
+       } else if (res == -ENOSYS) {
+               fm->fc->no_readdir = 1;
        }
 
        folio_put(folio);
Quoted 3 lines

* When I just return -ENOSYS to READDIRPLUS, things don't work well. Still looking into this.

Quoted 8 lines
Quoted 2 lines

Q: Do you know whether the current fuse kernel mod can handle a low-level
fuse server that doesn't support READDIRPLUS? This may be broken.

From what I see, the fuse kernel code can handle servers that don't support readdir/readdirplus. The fuse readdir path gets invoked from file_operations->iterate_shared callback, which from what i see, the only ramification of this always returning an error is that the syscalls calling into this (eg getdents(), readdir()) fail.

Quoted 9 lines

Thanks for doing some of the digging Joanne. I'm not sure what was going wrong a few weeks ago when I initially disabled readdirplus, but I have it working now - in fact I now have famfs "fully" working under fuse (for some definition of fully ;).

I have a gnarly rebase plus some documentation to write, but I may go ahead and share branches this week, in case anybody wants to take a look. That will be a fuse kernel branch, and a famfs user space branch...

Looking forward to seeing this.

Quoted 1 line

Also: any plans for a fuse BOF at LSFMM?

I'm definitely interested if there is one. There was some discussion about this on this thread [1] a few months ago - Miklos said he won't be able to make it to LSF this year and I think Bernd said he won't be able to as well, but if there are some other interested FUSE people at LSF, maybe we could have a fuse meetup that would be video-callable in?

Thanks,
Joanne

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/T/#ma4968312a21f8bd0da3431d818c1b5bff75aefcc

Quoted 6 lines

<snip>

Thanks,
John

A message that is not in the archive (sent off-list or not yet received): CAOQ4uxjwn+PacrG1kWf7uki+cigDo9cWXNkg5e987r8hfKiDQw@mail.gmail.com

#5 lore raw
Quoted 22 lines · Amir Goldstein

Sorry for html reply... Writing from mobile
But wanted you to have the feedback pre RFC patch

Quoted 8 lines · John Groves

Miklos et. al.:

Here are some specific questions related to the famfs port into fuse [1][2] that I hope Miklos (and others) can give me feedback on soonish.

This work is active and serious, although you haven't heard much from me recently. I'm showing a famfs poster at Usenix FAST '25 this week [3].

Quoted 8 lines

I'm generally following the approach in [1] - in a famfs file system, LOOKUP is followed by GET_FMAP to retrieve the famfs file/dax metadata. It's tempting to merge the fmap into the LOOKUP reply, but this seems like an optimization to consider once basic function is established.

Q: Do you think it makes sense to make the famfs fmap an optional,
variable sized addition to the LOOKUP response?

Quoted 6 lines

Please see two other email threads from last few days about extending LOOKUP response for PASSTHROUGH to backing inode and related question on io_uring and PASSTHROUGH

I think the answer to you question, how to best extend LOOKUP response, should be bundled with the answer to the questions on those other threads.

Thanks for the quick reply, Amir. I'm traveling this week with a hectic schedule (Usenix FAST++), so I won't get much actual work done.

I'll stipulate that my list-participation skills need improvement, but I haven't figured out which threads those are. If somebody can point me directly to them, you will have my gratitude.

Time frame for my initial RFC is probably still a few weeks out.

Quoted 7 lines
Quoted 7 lines

Whenever an fmap references a dax device that isn't already known to the famfs/fuse kernel code, a GET_DAXDEV message is sent, with the reply providing the info required to open teh daxdev. A file becomes available when the fmap is complete and all referenced daxdevs are "opened".

Quoted 5 lines
Quoted 2 lines

Q: Any heartburn here?

See also similar discussions on those other email threads about alternative and more efficient APIs for mapping backing files.

Same, see above about my questionable list-searching skills

Quoted 5 lines

As Miklos said before mapping file ranges to backing file also makes sense for passthrough use cases so if there are similarities with GET_FMAP maybe there is room for sharing design goals, but I am not sure if this is the case?

I hope so...

Quoted 21 lines
Quoted 21 lines

When GET_FMAP is separate from LOOKUP, READDIRPLUS won't add value unless it
receives fmaps as part of the attributes (i.e. lookups) that come back in its response - since a READDIRPLUS that gets 12 files will still need 12 GET_FMAP messages/responses to be complete. Merging fmaps as optional, variable-length components of the READDIRPLUS response buffers could eventualy make sense, but a cleaner solution intially would seem to be to disable READDIRPLUS in famfs. But...

* The libfuse/kernel ABI appears to allow low-level fuse servers that don't support READDIRPLUS...
* But libfuse doesn't look at conn->want for the READDIRPLUS related capabilities
* I have overridden that, but the kernel still sends the READDIRPLUS messages. It's possible I'm doing something hinky, and I'll keep looking for it.
* When I just return -ENOSYS to READDIRPLUS, things don't work well. Still looking into this.

Quoted 6 lines
Quoted 3 lines

Q: Do you know whether the current fuse kernel mod can handle a low-level
fuse server that doesn't support READDIRPLUS? This may be broken.

Did you try returning zero d_ino from readdirplus? I thinks that's the server way of saying I do not know how to reply as readdirplus.

No, but I'll try that when I get back home. I found documentation somewhere that said ENOSYS was the answer.

Quoted 4 lines

I would have liked it if there was an FOPEN_NOREADDIRPLUS per opendir. This could be more efficient than having to get the first readdirplus request.

I don't know enough to have an opinion here (yet), but I'll start thinking it through.

Quoted 14 lines
Quoted 14 lines

Q: If READDIRPLUS isn't actually optional, do you think the same attribute
reply merge (attr + famfs fmap) is viable for READDIRPLUS? I'd very much like to do this part "later".

Q: Are fuse lowlevel file systems like famfs expected to use libfuse and its
message handling (particularly init), or is it preferred that they not do so? Seems a shame to throw away all that api version checking, but turning off READDIRPLUS would require changes that might affect other libfuse clients. Please advise...

Quoted 7 lines
Quoted 5 lines

Note that the intended use cases for famfs generally involve large files rather than *many* files, so giving up READDIRPLUS may not matter very much,
at least in the early going.

If famfs does not need readdirplus you should not have to deal with it.

Technically it's not that readdirplus can't be helpful for famfs - it's just that readdirplus is not much help if the response doesn't include famfs fmaps.

But I do think the nicest bringup path would be to disable readdirplus, so what I should see is a bunch of READDIRs followed by (or alternating with?) a bunch of LOOKUPs. That route should aid bringup by avoiding new variable payloads on existing commands in the immediate term.

But if said payloads are being designed or considered, I should definitely get the famfs requirements into that discussion, so we can do something that works for all of us!

Quoted 21 lines

I don't see a problem with adding noreaddirplus config to libfuse, but not sure you even need this to be in init. I would prefer it per opendir.

Thanks,
Amir.

Quoted 13 lines

I'm hoping to get an initial RFC patch set out in a few weeks, but these questions address [some of] the open issues that need to be [at least initially] resolved first.

Regards,
John

[1]
https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lwn.net/Articles/983105/
[3] https://www.usenix.org/conference/fast25/poster-session

Thanks,
John

#6 lore raw
In reply to John Groves

OK, I'm on track to post the first famfs/fuse RFC patches next week. This will be a kernel patch, a libfuse patch and a pointer to a compatible famfs user space and instructions.

Dumb question: where do I post the libfuse patchs?

Thanks,
John

#7 lore raw
Quoted 7 lines · John Groves

OK, I'm on track to post the first famfs/fuse RFC patches next week. This will be a kernel patch, a libfuse patch and a pointer to a compatible famfs user space and instructions.

Dumb question: where do I post the libfuse patchs?

https://github.com/libfuse/libfuse

Thanks,
Bernd