* [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts @ 2026-10-23 2:16 Friendy Su 2026-10-23 2:32 ` Friendy.Su 2026-11-19 21:40 ` Gao Xiang 0 siblings, 2 replies; 4+ messages in thread From: Friendy Su @ 2026-10-23 2:16 UTC (permalink / raw) To: xiang, chao, jack, amir73il Cc: linux-erofs, linux-kernel, Friendy Su, Yuezhang Mo, Daniel Palmer SB_I_ALLOW_HSM makes erofs support fanotify FAN_PRE_ACCESS event for bdev-based mounts. file-backed mounts do not support this. This is for use case that erofs file data is not available on local block device at mount, but need to be filled at fanotify FAN_PRE_ACCESS event handler. E.g. format erofs to blob mode, meta data on /dev/pmem0, file data on blob device /dev/pmem1. The file content in blob device is dummy. mount as below: $ sudo mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs/ In FAN_PRE_ACCESS handler, actual file content is fetched from remote then filled into the DAX mounted block device /dev/pmem1. 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 0967aace9f7f..be8728b8d116 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -667,6 +667,15 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) errorfc(fc, "FSDAX is not allowed when inode_share is on"); return -EINVAL; } + if (!erofs_is_fileio_mode(sbi)) { + /* + * Only enable HSM to support fanotify FAN_PRE_ACCESS event + * under block device backed mounts. + * For file-backed mounts, do not enable since erofs-utils + * has already supported FAN_PRE_ACCESS event on backend image. + */ + 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] 4+ messages in thread
* Re: [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts 2026-10-23 2:16 [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Friendy Su @ 2026-10-23 2:32 ` Friendy.Su 2026-11-19 21:40 ` Gao Xiang 1 sibling, 0 replies; 4+ messages in thread From: Friendy.Su @ 2026-10-23 2:32 UTC (permalink / raw) To: xiang, chao, jack, amir73il Cc: linux-erofs, linux-kernel, Yuezhang.Mo, Daniel.Palmer Hi, Gao I will send patches for test in erofs-utils. Best Regards Friendy ________________________________________ From: Su, Friendy <Friendy.Su@sony.com> Sent: Friday, October 23, 2026 10:16 To: xiang@kernel.org; chao@kernel.org; jack@suse.cz; amir73il@gmail.com Cc: linux-erofs@lists.ozlabs.org; linux-kernel@vger.kernel.org; Su, Friendy; Mo, Yuezhang; Palmer, Daniel (SGC) Subject: [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts SB_I_ALLOW_HSM makes erofs support fanotify FAN_PRE_ACCESS event for bdev-based mounts. file-backed mounts do not support this. This is for use case that erofs file data is not available on local block device at mount, but need to be filled at fanotify FAN_PRE_ACCESS event handler. E.g. format erofs to blob mode, meta data on /dev/pmem0, file data on blob device /dev/pmem1. The file content in blob device is dummy. mount as below: $ sudo mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs/ In FAN_PRE_ACCESS handler, actual file content is fetched from remote then filled into the DAX mounted block device /dev/pmem1. 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 0967aace9f7f..be8728b8d116 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -667,6 +667,15 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) errorfc(fc, "FSDAX is not allowed when inode_share is on"); return -EINVAL; } + if (!erofs_is_fileio_mode(sbi)) { + /* + * Only enable HSM to support fanotify FAN_PRE_ACCESS event + * under block device backed mounts. + * For file-backed mounts, do not enable since erofs-utils + * has already supported FAN_PRE_ACCESS event on backend image. + */ + 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] 4+ messages in thread
* Re: [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts 2026-10-23 2:16 [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Friendy Su 2026-10-23 2:32 ` Friendy.Su @ 2026-11-19 21:40 ` Gao Xiang 2026-11-20 3:23 ` Friendy.Su 1 sibling, 1 reply; 4+ messages in thread From: Gao Xiang @ 2026-11-19 21:40 UTC (permalink / raw) To: Friendy Su Cc: xiang, chao, jack, amir73il, linux-erofs, linux-kernel, Yuezhang Mo, Daniel Palmer Hi Friendy, On Fri, Oct 23, 2026 at 10:16:35AM +0800, Friendy Su wrote: > SB_I_ALLOW_HSM makes erofs support fanotify FAN_PRE_ACCESS event > for bdev-based mounts. file-backed mounts do not support this. > > This is for use case that erofs file data is not available on > local block device at mount, but need to be filled at fanotify > FAN_PRE_ACCESS event handler. > > E.g. format erofs to blob mode, meta data on /dev/pmem0, file data > on blob device /dev/pmem1. The file content in blob device is dummy. > > mount as below: > > $ sudo mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs/ > > In FAN_PRE_ACCESS handler, actual file content is fetched from remote > then filled into the DAX mounted block device /dev/pmem1. 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 | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/erofs/super.c b/fs/erofs/super.c > index 0967aace9f7f..be8728b8d116 100644 > --- a/fs/erofs/super.c > +++ b/fs/erofs/super.c > @@ -667,6 +667,15 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) > errorfc(fc, "FSDAX is not allowed when inode_share is on"); > return -EINVAL; > } > + if (!erofs_is_fileio_mode(sbi)) { > + /* > + * Only enable HSM to support fanotify FAN_PRE_ACCESS event > + * under block device backed mounts. > + * For file-backed mounts, do not enable since erofs-utils > + * has already supported FAN_PRE_ACCESS event on backend image. > + */ Could you just change it to * Follow other filesystems by supporting FAN_PRE_ACCESS events * only on bdev-backed mount. Don't bother with file-backed mounts. I hope we could avoid mentioning user-space details in the kernel codebase directly. Could you send a new version as I suggested, otherwise it looks good to me, Reviewed-by: Gao Xiang <xiang@kernel.org> Thanks, Gao Xiang > + 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] 4+ messages in thread
* Re: [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts 2026-11-19 21:40 ` Gao Xiang @ 2026-11-20 3:23 ` Friendy.Su 0 siblings, 0 replies; 4+ messages in thread From: Friendy.Su @ 2026-11-20 3:23 UTC (permalink / raw) To: Gao Xiang Cc: chao, jack, amir73il, linux-erofs, linux-kernel, Yuezhang.Mo, Daniel.Palmer Hi, Thanks for comment. I have sent patch v3. Best Regards Friendy ________________________________________ From: Gao Xiang <xiang@kernel.org> Sent: Friday, November 20, 2026 5:40 To: Su, Friendy Cc: xiang@kernel.org; chao@kernel.org; jack@suse.cz; amir73il@gmail.com; linux-erofs@lists.ozlabs.org; linux-kernel@vger.kernel.org; Mo, Yuezhang; Palmer, Daniel (SGC) Subject: Re: [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Hi Friendy, On Fri, Oct 23, 2026 at 10: 16: 35AM +0800, Friendy Su wrote: > SB_I_ALLOW_HSM makes erofs support fanotify FAN_PRE_ACCESS event > for bdev-based mounts. file-backed mounts do not support this. > > This is for use case Hi Friendy, On Fri, Oct 23, 2026 at 10:16:35AM +0800, Friendy Su wrote: > SB_I_ALLOW_HSM makes erofs support fanotify FAN_PRE_ACCESS event > for bdev-based mounts. file-backed mounts do not support this. > > This is for use case that erofs file data is not available on > local block device at mount, but need to be filled at fanotify > FAN_PRE_ACCESS event handler. > > E.g. format erofs to blob mode, meta data on /dev/pmem0, file data > on blob device /dev/pmem1. The file content in blob device is dummy. > > mount as below: > > $ sudo mount -o dax,device=/dev/pmem1 /dev/pmem0 /mnt/erofs/ > > In FAN_PRE_ACCESS handler, actual file content is fetched from remote > then filled into the DAX mounted block device /dev/pmem1. 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 | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/erofs/super.c b/fs/erofs/super.c > index 0967aace9f7f..be8728b8d116 100644 > --- a/fs/erofs/super.c > +++ b/fs/erofs/super.c > @@ -667,6 +667,15 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) > errorfc(fc, "FSDAX is not allowed when inode_share is on"); > return -EINVAL; > } > + if (!erofs_is_fileio_mode(sbi)) { > + /* > + * Only enable HSM to support fanotify FAN_PRE_ACCESS event > + * under block device backed mounts. > + * For file-backed mounts, do not enable since erofs-utils > + * has already supported FAN_PRE_ACCESS event on backend image. > + */ Could you just change it to * Follow other filesystems by supporting FAN_PRE_ACCESS events * only on bdev-backed mount. Don't bother with file-backed mounts. I hope we could avoid mentioning user-space details in the kernel codebase directly. Could you send a new version as I suggested, otherwise it looks good to me, Reviewed-by: Gao Xiang <xiang@kernel.org> Thanks, Gao Xiang > + 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] 4+ messages in thread
end of thread, other threads:[~2026-11-20 3:24 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-10-23 2:16 [PATCH v2] erofs: set SB_I_ALLOW_HSM for bdev-based mounts Friendy Su 2026-10-23 2:32 ` Friendy.Su 2026-11-19 21:40 ` Gao Xiang 2026-11-20 3:23 ` Friendy.Su
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®