From: Friendy Su <friendy.su@sony.com>
To: xiang@kernel.org, chao@kernel.org, jack@suse.cz, amir73il@gmail.com
Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Friendy Su <friendy.su@sony.com>,
Yuezhang Mo <Yuezhang.Mo@sony.com>,
Daniel Palmer <daniel.palmer@sony.com>
Subject: [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts
Date: Fri, 20 Nov 2026 11:19:09 +0800 [thread overview]
Message-ID: <20261120031909.1757230-1-friendy.su@sony.com> (raw)
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
reply other threads:[~2026-11-20 3:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120031909.1757230-1-friendy.su@sony.com \
--to=friendy.su@sony.com \
--cc=Yuezhang.Mo@sony.com \
--cc=amir73il@gmail.com \
--cc=chao@kernel.org \
--cc=daniel.palmer@sony.com \
--cc=jack@suse.cz \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®