From cd913c76f489def1a388e3a5b10df94948ede3f5 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 29 Nov 2021 11:21:59 +0100 Subject: dax: return the partition offset from fs_dax_get_by_bdev Prepare for the removal of the block_device from the DAX I/O path by returning the partition offset from fs_dax_get_by_bdev so that the file systems have it at hand for use during I/O. Signed-off-by: Christoph Hellwig Reviewed-by: Dan Williams Reviewed-by: Darrick J. Wong Link: https://lore.kernel.org/r/20211129102203.2243509-26-hch@lst.de Signed-off-by: Dan Williams --- drivers/dax/super.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/dax') diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 45d931aefd06..e7152a6c4cc4 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -69,17 +69,20 @@ EXPORT_SYMBOL_GPL(dax_remove_host); /** * fs_dax_get_by_bdev() - temporary lookup mechanism for filesystem-dax * @bdev: block device to find a dax_device for + * @start_off: returns the byte offset into the dax_device that @bdev starts */ -struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start_off) { struct dax_device *dax_dev; + u64 part_size; int id; if (!blk_queue_dax(bdev->bd_disk->queue)) return NULL; - if ((get_start_sect(bdev) * SECTOR_SIZE) % PAGE_SIZE || - (bdev_nr_sectors(bdev) * SECTOR_SIZE) % PAGE_SIZE) { + *start_off = get_start_sect(bdev) * SECTOR_SIZE; + part_size = bdev_nr_sectors(bdev) * SECTOR_SIZE; + if (*start_off % PAGE_SIZE || part_size % PAGE_SIZE) { pr_info("%pg: error: unaligned partition for dax\n", bdev); return NULL; } -- cgit v1.2.3