From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AEB92C82 for ; Wed, 24 Nov 2021 02:56:40 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso3830652pji.0 for ; Tue, 23 Nov 2021 18:56:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=K6aLDxpU5yyseOlKo6rNtA4cugi0ipNPCjlDJmHcgIw=; b=ZodTRA+l0cWcfcrO3HjZ5G1YiDvMh60G3gnO10/HB5K3wACoMILqWpq5tyghP5PaAd /HwKbMOp519uQpkZTsiaKbJxiO4I4LMxvhZKQ98u2R62HbNgGSXOiBZGNXqPhLpDseTa 7vzzMoZl4/zH+br0ANjvCl5c9fXM78IWjkNvHtHR5BTyrgEmRWUa/QYkAkFWIBqAi3vh b+zNb07awMu9xLTaQ0QBdRnjc+S/g9oqwKglYR/Xxt8j7ck6Lkr6xNcD5O/IUvzABpY5 Eu59hL+MFPuc5JaG7/+/vAaPPJWsBP2y6puOgx7hXkD43mLwWUFY6ZCNi+QL3gXyrcQM vLMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=K6aLDxpU5yyseOlKo6rNtA4cugi0ipNPCjlDJmHcgIw=; b=a+xWEQx4BxAl/U+jUZ0Z5pVEY5F4LcKIE4AqNdZTM83/qB/Gns9QtVmeHIxLtWME8Y 8liS54Im14l87TF4gRcAFvWd70Gwl8dLE5epddA7v5AIijHmQ1zwZbPQjI6TumIzsT13 IapIXzStHjBrjRy/K7+8yWS8P/50KJ6n9/+71YvLhoUSCm8r8NcvZbByE7S2YtAx2F66 Ig6fEO58IM7oYXmZy65iAkK1Lp86D4z4pPNjjqMB4LqINO8ANg4W+6w0lUUkoFS0NOu2 ajwIUPS6t4TYw8+QqRmnwjjMOa+9p22ZGA6zvB7DFkcn9FyT/+KJRezAZpP09tqc8NGO NRTQ== X-Gm-Message-State: AOAM533MxvViaGqLBYEj8kj9meUgPanVHu7N1Mnx2dRM8sTRQcAt0zvC 3+oqvUdxW187xpffQUWIqKUOLknQsWueuBDAoPyCog== X-Google-Smtp-Source: ABdhPJzo6eTnlpQwuRFEtmMj42wpPoH8sJWzIsynA2XekOCtzKT4A4dij0QV0bz7WFLT+916AMzKYpVsKpziQJRycmQ= X-Received: by 2002:a17:90b:1e07:: with SMTP id pg7mr3567015pjb.93.1637722600133; Tue, 23 Nov 2021 18:56:40 -0800 (PST) Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20211109083309.584081-1-hch@lst.de> <20211109083309.584081-26-hch@lst.de> In-Reply-To: <20211109083309.584081-26-hch@lst.de> From: Dan Williams Date: Tue, 23 Nov 2021 18:56:29 -0800 Message-ID: Subject: Re: [PATCH 25/29] dax: return the partition offset from fs_dax_get_by_bdev To: Christoph Hellwig Cc: Mike Snitzer , Ira Weiny , device-mapper development , linux-xfs , Linux NVDIMM , linux-s390 , linux-fsdevel , linux-erofs@lists.ozlabs.org, linux-ext4 , virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" On Tue, Nov 9, 2021 at 12:34 AM Christoph Hellwig 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 > --- > 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