* [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts
@ 2026-11-20 3:19 Friendy Su
2026-11-20 17:49 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Friendy Su @ 2026-11-20 3:19 UTC (permalink / raw)
To: xiang, chao, jack, amir73il
Cc: linux-erofs, linux-kernel, Friendy Su, Yuezhang Mo, Daniel Palmer
Set SB_I_ALLOW_HSM to enable fanotify FAN_PRE_ACCESS events for
bdev-backed mounts. File-backed mounts are not supported.
This allows EROFS to handle cases where file data is not available
locally at mount time and needs to be fetched on demand by a
FAN_PRE_ACCESS event handler.
For example, an EROFS image can use blob mode with metadata stored
on /dev/pmem0 and file data on /dev/pmem1, where the latter initially
contains dummy data.
The filesystem can be mounted with:
mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs
On receiving a FAN_PRE_ACCESS event, the handler fetches the actual
file data from a remote source and fills the corresponding blocks
on /dev/pmem1 before access proceeds.
Signed-off-by: Friendy Su <friendy.su@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Daniel Palmer <daniel.palmer@sony.com>
---
fs/erofs/super.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index ce05557bd998..4ef4c8ce1240 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -684,6 +684,14 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
errorfc(fc, "superblock_share does not support extra devices");
return -EINVAL;
}
+ if (!erofs_is_fileio_mode(sbi)) {
+ /*
+ * Follow other filesystems by supporting FAN_PRE_ACCESS events
+ * only on bdev-backed mount. Don't bother with file-backed
+ * mounts.
+ */
+ sb->s_iflags |= SB_I_ALLOW_HSM;
+ }
sbi->blkszbits = PAGE_SHIFT;
if (erofs_is_fileio_mode(sbi)) {
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts
2026-11-20 3:19 [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Friendy Su
@ 2026-11-20 17:49 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2026-11-20 17:49 UTC (permalink / raw)
To: Friendy Su
Cc: xiang, chao, jack, amir73il, linux-erofs, linux-kernel,
Yuezhang Mo, Daniel Palmer
On Fri, Nov 20, 2026 at 11:19:09AM +0800, Friendy Su wrote:
> Set SB_I_ALLOW_HSM to enable fanotify FAN_PRE_ACCESS events for
> bdev-backed mounts. File-backed mounts are not supported.
>
> This allows EROFS to handle cases where file data is not available
> locally at mount time and needs to be fetched on demand by a
> FAN_PRE_ACCESS event handler.
>
> For example, an EROFS image can use blob mode with metadata stored
> on /dev/pmem0 and file data on /dev/pmem1, where the latter initially
> contains dummy data.
>
> The filesystem can be mounted with:
>
> mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs
>
> On receiving a FAN_PRE_ACCESS event, the handler fetches the actual
> file data from a remote source and fills the corresponding blocks
> on /dev/pmem1 before access proceeds.
>
> Signed-off-by: Friendy Su <friendy.su@sony.com>
> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
> Reviewed-by: Daniel Palmer <daniel.palmer@sony.com>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 3:19 [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Friendy Su
2026-11-20 17:49 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®