Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC721C433EF for ; Wed, 24 Nov 2021 02:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238586AbhKXC7u (ORCPT ); Tue, 23 Nov 2021 21:59:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233953AbhKXC7t (ORCPT ); Tue, 23 Nov 2021 21:59:49 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9248C06173E for ; Tue, 23 Nov 2021 18:56:40 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id w33-20020a17090a6ba400b001a722a06212so3326420pjj.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=zSk+sw3u1aQxuLjPyTygxgFxX372+n68vuRnBAu9NOaUEvkT/VoL/4xG+iHExEPTXO XOZAMbkVGJfBeVwmOW2Od+iJSnGdK/wlYoPLxktrFhxMMb3CELmEaHKbDDcV1dqZ0wsf Xbvma6la8jU749BOR/jdf2sTdy8abEv85mZ1CQEAefPMF0589DiskFPM6RBYffRtg8fi /kCF9gtcKhC8GA0Vh3/CduAh37Ccs2Hf9UIAqkar2qXwV9W81auFj3AzlL0MWUUmRw+K tOmEP6IGKanAAtd9iNZn6L9scBquo+ErTUCDnsTIbjkgn/jynRDfF5WNr13dpt9Wjh3u /8DA== X-Gm-Message-State: AOAM530BAASyJLCMxgbLAexgV3DTOT+Eb7dgygbrb2NXFp2m8uQNCLpl IoIYsemrYcYa4G9k34+7q1wikGQ0SpvuNsLFtvkKYQ== 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) 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" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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