Skip to contentSkip to conversation

erofs: accept source file descriptor via fsconfig

PATCH In review Giuseppe Scrivano 3 participants 3 messages Aug 4 – Aug 10

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

PATCH v6 1/1 erofs: accept source file descriptor via fsconfig

Allow userspace to pass an already-opened file descriptor as the mount source instead of a path string. This is useful for tools that already hold an fd to the image, such as composefs reusing an existing erofs backing file.

---
v5: https://lore.kernel.org/linux-fsdevel/[email protected]/
v4: https://lore.kernel.org/linux-fsdevel/[email protected]/
v3: https://lore.kernel.org/linux-fsdevel/[email protected]/
v2: https://lore.kernel.org/linux-fsdevel/[email protected]/
v1: https://lore.kernel.org/linux-fsdevel/ak5GfvVfWLJU1EwK@debian/

 Documentation/filesystems/erofs.rst | 17 +++++++
 fs/erofs/super.c                    | 73 ++++++++++++++++++++++++-----
 2 files changed, 79 insertions(+), 11 deletions(-)
Documentation/filesystems/erofs.rst +17 -0
index 4230884fb359..d301d9ac946a 100644
@@ -137,8 +137,25 @@ fsoffset=%llu          Specify block-aligned filesystem offset for the primary d
 inode_share            Enable inode page sharing for this filesystem.  Inodes with
                        identical content within the same domain ID can share the
                        page cache.
+source=%s              (For file-backed mounts) Specify the backing image as a path
+                       or as an already-opened file descriptor.
 ===================    =========================================================
 
+File-backed mounts
+==================
+
+When CONFIG_EROFS_FS_BACKED_BY_FILE is enabled, EROFS file-backed images
+can be mounted directly without a loopback block device.  The backing file
+can be given either as a path, or as an already-opened file descriptor.
+
+When a file descriptor is used, the kernel resolves its path and records it
+so that /proc/mounts and similar interfaces can still report the mount
+source.
+
+Only regular files are accepted as backing files; to mount an image that
+resides on a block device, use the traditional block device mount path
+instead.
+
 Sysfs Entries
 =============
 
fs/erofs/super.c +62 -11

110 lines not on this page · raw message

Signature · 1 line
2.55.0
maintainer Reviewed-by on v6 1/1
#1 lore raw
Quoted 9 lines · Giuseppe Scrivano

Allow userspace to pass an already-opened file descriptor as the mount source instead of a path string. This is useful for tools that already hold an fd to the image, such as composefs reusing an existing erofs backing file.

Thanks,