Re: [PATCH v3] erofs: set SB_I_ALLOW_HSM for bdev-based mounts

From: Gao Xiang

Date: Fri Nov 20 2026 - 12:49:19 EST


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@xxxxxxxx>
> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
> Reviewed-by: Daniel Palmer <daniel.palmer@xxxxxxxx>

Reviewed-by: Gao Xiang <xiang@xxxxxxxxxx>

Thanks,
Gao Xiang