dax: Move mandatory ->zero_page_range() check in alloc_dax()
authorVivek Goyal <vgoyal@redhat.com>
Wed, 1 Apr 2020 16:11:25 +0000 (12:11 -0400)
committerDan Williams <dan.j.williams@intel.com>
Fri, 3 Apr 2020 02:15:03 +0000 (19:15 -0700)
commit4e4ced93794acb42adb19484132966defba8f3a6
tree2a63f73c19e052bb5b7fa283545cd9349447d21e
parent4f3b4f161d7a070d2181dbcf7fbd97c7631d5c24
dax: Move mandatory ->zero_page_range() check in alloc_dax()

zero_page_range() dax operation is mandatory for dax devices. Right now
that check happens in dax_zero_page_range() function. Dan thinks that's
too late and its better to do the check earlier in alloc_dax().

I also modified alloc_dax() to return pointer with error code in it in
case of failure. Right now it returns NULL and caller assumes failure
happened due to -ENOMEM. But with this ->zero_page_range() check, I
need to return -EINVAL instead.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Link: https://lore.kernel.org/r/20200401161125.GB9398@redhat.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/dax/bus.c
drivers/dax/super.c
drivers/md/dm.c
drivers/nvdimm/pmem.c
drivers/s390/block/dcssblk.c