Skip to contentSkip to conversation

FUSE: add another flag to support shared mmap in FOPEN_DIRECT_IO mode

RFC Hao Xu 2 participants 3 messages May 2, 2023 – May 3, 2023 VFS

lore
Share & tools
lore

Hao Xu

author
#0 lore raw

Hi all,

From discussion with Bernd, I get that FOPEN_DIRECT_IO is designed for those user cases where users want strong coherency like network filesystems, where one server serves multiple remote clients. And thus shared mmap is disabled since local page cache existence breaks this kind of coherency.

But here our use case is one virtiofs daemon serve one guest vm, We use FOPEN_DIRECT_IO to reduce memory footprint not for coherency. So we expect shared mmap works in this case. Here I suggest/am implementing adding another flag to indicate this kind of cases----use FOPEN_DIRECT_IO not for coherency----so that shared mmap works.

Thanks,

Hao

#1 lore raw

Hi Hao,

Quoted 6 lines · Hao Xu

Hi all,

From discussion with Bernd, I get that FOPEN_DIRECT_IO is designed for
those user cases where users want strong coherency like network filesystems, where one server serves multiple remote clients. And thus shared mmap is disabled since local page cache existence breaks this kind of coherency.

But here our use case is one virtiofs daemon serve one guest vm, We use FOPEN_DIRECT_IO to reduce memory footprint not for coherency. So we expect shared mmap works in this case. Here I suggest/am implementing adding another flag to indicate this kind of cases----use FOPEN_DIRECT_IO not for coherency----so that shared mmap works.

Yeah it should work, but I think what you want is "DAX" - can you try to enable it?

fuse_i.h: FUSE_DAX_ALWAYS, /* "-o dax=always" */
fuse_i.h: FUSE_DAX_NEVER, /* "-o dax=never" */
fuse_i.h: FUSE_DAX_INODE_USER, /* "-o dax=inode" */

Hope it helps,
Bernd

author
#2 lore raw

Hi Bernd,

Quoted 11 lines · Bernd Schubert

Hi Hao,

Quoted 5 lines · Hao Xu

Hi all,

 From discussion with Bernd, I get that FOPEN_DIRECT_IO is designed for those user cases where users want strong coherency like network filesystems, where one server serves multiple remote clients. And thus shared mmap is disabled since local page cache existence breaks this kind of coherency.

But here our use case is one virtiofs daemon serve one guest vm, We use FOPEN_DIRECT_IO to reduce memory footprint not for coherency. So we expect shared mmap works in this case. Here I suggest/am implementing adding another flag to indicate this kind of cases----use FOPEN_DIRECT_IO not for coherency----so that shared mmap works.

Yeah it should work, but I think what you want is "DAX" - can you try to enable it?

Quoted 8 lines

fuse_i.h:    FUSE_DAX_ALWAYS,    /* "-o dax=always" */ fuse_i.h:    FUSE_DAX_NEVER,        /* "-o dax=never" */ fuse_i.h:    FUSE_DAX_INODE_USER,    /* "-o dax=inode" */

Hope it helps,
Bernd

Thanks for your suggestion, the thing is most IO in our case are small random read to small files. I believe Dax should help but doubt it may be not too much.

Another reason we are not leveraging DAX is the hypervisor software we use doesn't support DAX well. So I think the feature in this RFC should be good for

some non-DAX use cases (like ours)

Thanks,

Hao