Skip to content

Commit 2316097

Browse files
Coly Listellarhopper
authored andcommitted
dax: print error message by pr_info() in __generic_fsdax_supported()
In struct dax_operations, the callback routine dax_supported() returns a bool type result. For false return value, the caller has no idea whether the device does not support dax at all, or it is just some mis- configuration issue. An example is formatting an Ext4 file system on pmem device on top of a NVDIMM namespace by, # mkfs.ext4 /dev/pmem0 If the fs block size does not match kernel space memory page size (which is possible on non-x86 platform), mount this Ext4 file system will fail, # mount -o dax /dev/pmem0 /mnt mount: /mnt: wrong fs type, bad option, bad superblock on /dev/pmem0, missing codepage or helper program, or other error. And from the dmesg output there is only the following information, [ 307.853148] EXT4-fs (pmem0): DAX unsupported by block device. The above information is quite confusing. Because definitely the pmem0 device supports dax operation, and the super block is consistent as how it was created by mkfs.ext4. Indeed the failure is from __generic_fsdax_supported() by the following code piece, if (blocksize != PAGE_SIZE) { pr_debug("%s: error: unsupported blocksize for dax\n", bdevname(bdev, buf)); return false; } It is because the Ext4 block size is 4KB and kernel page size is 8KB or 16KB. It is not simple to make dax_supported() from struct dax_operations or __generic_fsdax_supported() to return exact failure type right now. So the simplest fix is to use pr_info() to print all the error messages inside __generic_fsdax_supported(). Then users may find informative clue from the kernel message at least. Message printed by pr_debug() is very easy to be ignored by users. This patch prints error message by pr_info() in __generic_fsdax_supported(), when then mount fails, following lines can be found from dmesg output, [ 2705.500885] pmem0: error: unsupported blocksize for dax [ 2705.500888] EXT4-fs (pmem0): DAX unsupported by block device. Now the users may have idea the mount failure is from pmem driver for unsupported block size. Link: https://lore.kernel.org/r/[email protected] Cc: Dan Williams <[email protected]> Cc: Anthony Iliopoulos <[email protected]> Reported-by: Michal Suchanek <[email protected]> Suggested-by: Jan Kara <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Pankaj Gupta <[email protected]> Signed-off-by: Coly Li <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 4877846 commit 2316097

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/dax/super.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
8080
int err, id;
8181

8282
if (blocksize != PAGE_SIZE) {
83-
pr_debug("%s: error: unsupported blocksize for dax\n",
83+
pr_info("%s: error: unsupported blocksize for dax\n",
8484
bdevname(bdev, buf));
8585
return false;
8686
}
8787

8888
err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff);
8989
if (err) {
90-
pr_debug("%s: error: unaligned partition for dax\n",
90+
pr_info("%s: error: unaligned partition for dax\n",
9191
bdevname(bdev, buf));
9292
return false;
9393
}
9494

9595
last_page = PFN_DOWN((start + sectors - 1) * 512) * PAGE_SIZE / 512;
9696
err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end);
9797
if (err) {
98-
pr_debug("%s: error: unaligned partition for dax\n",
98+
pr_info("%s: error: unaligned partition for dax\n",
9999
bdevname(bdev, buf));
100100
return false;
101101
}
@@ -106,7 +106,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
106106
dax_read_unlock(id);
107107

108108
if (len < 1 || len2 < 1) {
109-
pr_debug("%s: error: dax access failed (%ld)\n",
109+
pr_info("%s: error: dax access failed (%ld)\n",
110110
bdevname(bdev, buf), len < 1 ? len : len2);
111111
return false;
112112
}
@@ -139,7 +139,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
139139
}
140140

141141
if (!dax_enabled) {
142-
pr_debug("%s: error: dax support not enabled\n",
142+
pr_info("%s: error: dax support not enabled\n",
143143
bdevname(bdev, buf));
144144
return false;
145145
}

0 commit comments

Comments
 (0)