[PATCH v1] erofs: Fallback to normal access if DAX is not supported on extra device

Yuezhang.Mo at sony.com Yuezhang.Mo at sony.com
Mon Jul 28 15:05:35 AEST 2025


On 2025/7/28 10:15, Gao Xiang wrote:
> 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 for your comments.

I fixed the indentation alignment of `dif->path` and removed the unnecessary comment
in the v2 patch.


More information about the Linux-erofs mailing list