[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4jtWzd3c_S1_4fYA1SXTJZfBzP_1xk_OwYkeNp0UhxwSg@mail.gmail.com>
Date: Tue, 23 Nov 2021 18:56:29 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: Christoph Hellwig <hch@....de>
Cc: Mike Snitzer <snitzer@...hat.com>, Ira Weiny <ira.weiny@...el.com>,
device-mapper development <dm-devel@...hat.com>,
linux-xfs <linux-xfs@...r.kernel.org>,
Linux NVDIMM <nvdimm@...ts.linux.dev>,
linux-s390 <linux-s390@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-erofs@...ts.ozlabs.org,
linux-ext4 <linux-ext4@...r.kernel.org>,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH 25/29] dax: return the partition offset from fs_dax_get_by_bdev
On Tue, Nov 9, 2021 at 12:34 AM Christoph Hellwig <hch@....de> wrote:
>
> Prepare from removing the block_device from the DAX I/O path by returning
s/from removing/for the removal of/
> 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 <hch@....de>
> ---
> drivers/dax/super.c | 9 ++++++---
> drivers/md/dm.c | 4 ++--
> fs/erofs/internal.h | 2 ++
> fs/erofs/super.c | 4 ++--
> fs/ext2/ext2.h | 1 +
> fs/ext2/super.c | 2 +-
> fs/ext4/ext4.h | 1 +
> fs/ext4/super.c | 2 +-
> fs/xfs/xfs_buf.c | 2 +-
> fs/xfs/xfs_buf.h | 1 +
> include/linux/dax.h | 6 ++++--
> 11 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index c0910687fbcb2..cc32dcf71c116 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -70,17 +70,20 @@ EXPORT_SYMBOL_GPL(dax_remove_host);
> /**
> * dax_get_by_host() - 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;
> }
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 282008afc465f..5ea6115d19bdc 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -637,7 +637,7 @@ static int open_table_device(struct table_device *td, dev_t dev,
> struct mapped_device *md)
> {
> struct block_device *bdev;
> -
> + u64 part_off;
> int r;
>
> BUG_ON(td->dm_dev.bdev);
> @@ -653,7 +653,7 @@ static int open_table_device(struct table_device *td, dev_t dev,
> }
>
> td->dm_dev.bdev = bdev;
> - td->dm_dev.dax_dev = fs_dax_get_by_bdev(bdev);
> + td->dm_dev.dax_dev = fs_dax_get_by_bdev(bdev, &part_off);
Perhaps allow NULL as an argument for callers that do not care about
the start offset?
Otherwise, looks good / clever.
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists