dax: remove silly single-page limitation in dax_zero_page_range
Subsystems (4)
PATCH 1/1 dax: remove silly single-page limitation in dax_zero_page_range
From: Darrick J. Wong <[email protected]>
It's totally silly that the dax zero_page_range implementations are required to accept a page count, but one of the four implementations silently ignores the page count and the wrapper itself errors out if you try to do more than one page.
Fix the nvdimm implementation to loop over the page count and remove the artificial limitation.
--- drivers/dax/super.c | 7 ------- drivers/nvdimm/pmem.c | 14 +++++++++++--- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/dax/super.c +0 -7
@@ -353,13 +353,6 @@ int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, {if (!dax_alive (dax_dev))return -ENXIO ; -/* -* There are no callers that want to zero more than one page as of now. -* Once users are there, this check can be removed after the -* device mapper code has been updated to split ranges across targets. -*/ -if (nr_pages !=1 ) -return -EIO ;return dax_dev->ops->zero_page_range (dax_dev, pgoff, nr_pages); }
drivers/nvdimm/pmem.c +11 -3
@@ -288,10 +288,18 @@ static int pmem_dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, size_t nr_pages) {struct pmem_device *pmem =dax_get_private (dax_dev); +int ret =0 ; -return blk_status_to_errno (pmem_do_write (pmem,ZERO_PAGE (0 ),0 , -PFN_PHYS (pgoff) >>SECTOR_SHIFT , -PAGE_SIZE )); +for (; nr_pages >0 && ret ==0 ; pgoff++, nr_pages--) { +blk_status_t status; + + status =pmem_do_write (pmem,ZERO_PAGE (0 ),0 , +PFN_PHYS (pgoff) >>SECTOR_SHIFT , +PAGE_SIZE ); + ret =blk_status_to_errno (status); + } + +return ret; } static long pmem_dax_direct_access(struct dax_device *dax_dev,
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
It's totally silly that the dax
zero_page_rangeimplementations are required to accept a page count, but one of the four implementations silently ignores the page count and the wrapper itself errors out if you try to do more than one page.Fix the nvdimm implementation to loop over the page count and remove the artificial limitation.
Signed-off-by Darrick J. Wong <[email protected]>--- drivers/dax/super.c | 7 ------- drivers/nvdimm/pmem.c | 14 +++++++++++--- 2 files changed, 11 insertions(+), 10 deletions(-)drivers/dax/super.c +0
-0
drivers/dax/super.c int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, · line 360
Quoted 8 lines
drivers/dax/super.c +0
-5@@ -353,13 +353,6 @@ int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, {if (!dax_alive (dax_dev))return -ENXIO ; -/* -* There are no callers that want to zero more than one page as of now. -* Once users are there, this check can be removed after the -* device mapper code has been updated to split ranges across targets. -*/
It's device-mapper that's the issue, you need to make sure that every device-mapper zero_page_range implementation knows how to route a multi-page operation. This is part of the motivation to drop that support and move simple concatenation and striping into the PMEM driver directly.