[PATCH v1] erofs: Fallback to normal access if DAX is not supported on extra device
Gao Xiang
hsiangkao at linux.alibaba.com
Mon Jul 28 12:15:08 AEST 2025
Hi Yuezhang,
On 2025/7/28 09:49, Yuezhang Mo wrote:
> If using multiple devices, we should check if the extra device support
> DAX instead of checking the primary device when deciding if to use DAX
> to access a file.
>
> If an extra device does not support DAX we should fallback to normal
> access otherwise the data on that device will be inaccessible.
>
> Signed-off-by: Yuezhang Mo <Yuezhang.Mo at sony.com>
> Reviewed-by: Friendy Su <friendy.su at sony.com>
> Reviewed-by: Jacky Cao <jacky.cao at sony.com>
> Reviewed-by: Daniel Palmer <daniel.palmer at sony.com>
> ---
> fs/erofs/super.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index e1020aa60771..ad1578bb0f7b 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -174,6 +174,11 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
> if (!erofs_is_fileio_mode(sbi)) {
> dif->dax_dev = fs_dax_get_by_bdev(file_bdev(file),
> &dif->dax_part_off, NULL, NULL);
> + if (!dif->dax_dev && test_opt(&sbi->opt, DAX_ALWAYS)) {
> + erofs_info(sb, "DAX unsupported by %s. Turning off DAX.",
> + dif->path);
The patch itself looks good to me, yes, I don't think out
a reasonable way to enable partial DAX for multiple devices.
So it'd better to just disable such case.
Just a nitpick, it would be better to align `dif->path` to the
following char of `(` in the line above.
Also if it's possible, please remove the unnecessary comment
("/* handle multiple devices */") above erofs_scan_devices()
together since:
- it was obvious and it might be not inaccurrate;
- it now handles some primary device stuff too.
Thanks,
Gao XIang
More information about the Linux-erofs
mailing list