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

Gao Xiang hsiangkao at linux.alibaba.com
Wed Jul 30 19:37:13 AEST 2025



On 2025/7/30 17:24, Yuezhang.Mo at sony.com wrote:
> On 2025/7/29 11:07, Hongbo Li wrote:
>> On 2025/7/28 12:54, Yuezhang Mo wrote:

...

>>>      if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb))
>>>              sbi->devs->flatdev = true;
>>> @@ -338,7 +348,6 @@ static int erofs_read_superblock(struct super_block *sb)
>>>      if (ret < 0)
>>>              goto out;
>>>
>>> -   /* handle multiple devices */
>>>      ret = erofs_scan_devices(sb, dsb);
>>>
>>>      if (erofs_sb_has_48bit(sbi))
>>> @@ -671,14 +680,9 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
>>>                      return invalfc(fc, "cannot use fsoffset in fscache mode");
>>>      }
>>>
>>> -   if (test_opt(&sbi->opt, DAX_ALWAYS)) {
>>> -           if (!sbi->dif0.dax_dev) {
>>> -                   errorfc(fc, "DAX unsupported by block device. Turning off DAX.");
>>> -                   clear_opt(&sbi->opt, DAX_ALWAYS);
>>> -           } else if (sbi->blkszbits != PAGE_SHIFT) {
>>> -                   errorfc(fc, "unsupported blocksize for DAX");
>>> -                   clear_opt(&sbi->opt, DAX_ALWAYS);
>>> -           }
>>> +   if (test_opt(&sbi->opt, DAX_ALWAYS) && sbi->blkszbits != PAGE_SHIFT) {
>>> +           errorfc(fc, "unsupported blocksize for DAX");
>>
>> How about using the info log? Can we consider using infofc in this case?
>>
> 
> This is not a case of error, I also think using the info log is better.
> 
> In erofs_init_device() and erofs_scan_devices(), use erofs_info() to output the
> logs of turning off DAX. How about using erofs_info() uniformly?

Honestly I have no idea how infofc()/errorfc() works on the
userspace side, it seems ext2/4 just use ext{2,4}_msg(KERN_ERR)
for example for DAX.

infofc() only has the only one caller:
cramfs/inode.c:         infofc(fc, "empty filesystem");

warnfc() has more callers:
ceph/super.c:                   warnfc(fc, "Value of option \"%s\" is unrecognized",
ceph/super.c:                   warnfc(fc, "Conflicting test_dummy_encryption options");
ceph/super.c:           warnfc(fc,
ceph/super.c:   warnfc(fc, "test_dummy_encryption mode enabled");
super.c:                        warnfc(fc, "reusing existing filesystem not allowed");
super.c:                        warnfc(fc, "reusing existing filesystem in another namespace not allowed");

I'm fine with either way, but if we follow ext2/ext4, erofs_err()
is needed too although I don't think the fallback should be
identified as errors...

Thanks,
Gao Xiang



More information about the Linux-erofs mailing list