From mboxrd@z Thu Jan 1 00:00:00 1970 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4260EC433F5 for ; Tue, 30 Nov 2021 18:51:36 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-313-eNow6pHRMlGRLgHMIxvHZQ-1; Tue, 30 Nov 2021 13:51:30 -0500 X-MC-Unique: eNow6pHRMlGRLgHMIxvHZQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55ABB81CCFE; Tue, 30 Nov 2021 18:51:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E8C460C13; Tue, 30 Nov 2021 18:51:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D15C21809C89; Tue, 30 Nov 2021 18:51:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUIpN14016714 for ; Tue, 30 Nov 2021 13:51:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 78C571121319; Tue, 30 Nov 2021 18:51:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 747601121315 for ; Tue, 30 Nov 2021 18:51:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 699AF811E84 for ; Tue, 30 Nov 2021 18:51:18 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-_uLKnz9gMYejKBSoBY_O3A-1; Tue, 30 Nov 2021 13:51:15 -0500 X-MC-Unique: _uLKnz9gMYejKBSoBY_O3A-1 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4D8FB8187B; Tue, 30 Nov 2021 18:51:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 722D9C53FC7; Tue, 30 Nov 2021 18:51:12 +0000 (UTC) Date: Tue, 30 Nov 2021 10:51:12 -0800 From: "Darrick J. Wong" To: Christoph Hellwig Message-ID: <20211130185112.GE8467@magnolia> References: <20211129102203.2243509-1-hch@lst.de> <20211129102203.2243509-7-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20211129102203.2243509-7-hch@lst.de> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: dm-devel@redhat.com Cc: nvdimm@lists.linux.dev, Mike Snitzer , linux-s390@vger.kernel.org, linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, Dan Williams , linux-ext4@vger.kernel.org, Ira Weiny Subject: Re: [dm-devel] [PATCH 06/29] dax: move the partition alignment check into fs_dax_get_by_bdev X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Mon, Nov 29, 2021 at 11:21:40AM +0100, Christoph Hellwig wrote: > fs_dax_get_by_bdev is the primary interface to find a dax device for a > block device, so move the partition alignment check there instead of > wiring it up through ->dax_supported. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Dan Williams Makes more sense than the old "get the dax device and /then/ check if it's ok to use it" strategy. Reviewed-by: Darrick J. Wong --D > --- > drivers/dax/super.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index c8500b7e2d8a2..f2cef47bdeafd 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -92,6 +92,12 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) > 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) { > + pr_info("%pg: error: unaligned partition for dax\n", bdev); > + return NULL; > + } > + > id = dax_read_lock(); > dax_dev = xa_load(&dax_hosts, (unsigned long)bdev->bd_disk); > if (!dax_dev || !dax_alive(dax_dev) || !igrab(&dax_dev->inode)) > @@ -106,10 +112,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > struct block_device *bdev, int blocksize, sector_t start, > sector_t sectors) > { > - pgoff_t pgoff, pgoff_end; > - sector_t last_page; > - int err; > - > if (blocksize != PAGE_SIZE) { > pr_info("%pg: error: unsupported blocksize for dax\n", bdev); > return false; > @@ -120,19 +122,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > - err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > - last_page = PFN_DOWN((start + sectors - 1) * 512) * PAGE_SIZE / 512; > - err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > return true; > } > EXPORT_SYMBOL_GPL(generic_fsdax_supported); > -- > 2.30.2 > -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5831BC433F5 for ; Tue, 30 Nov 2021 18:51:22 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4J3WX85hVTz3bc4 for ; Wed, 1 Dec 2021 05:51:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=f69KXMAp; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4601:e00::1; helo=ams.source.kernel.org; envelope-from=djwong@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=f69KXMAp; dkim-atps=neutral Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4J3WX42Q74z2yJL for ; Wed, 1 Dec 2021 05:51:16 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4D8FB8187B; Tue, 30 Nov 2021 18:51:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 722D9C53FC7; Tue, 30 Nov 2021 18:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638298272; bh=pIN7ABzLdiksJYiI1GQ6S2KBxnScyKH3E9XuH9ab5kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f69KXMApBRLMv9opuoCOfv4JankytX6MHovhMbMeU40j1k3J7m4Jmn9zdR8i4vbW5 QnbFwqdl+oJCTfd2dr855rqMqz8YoePtTSvD755hNQUKrIJWPZ2p7YXIdxOkBJlpxq TYdc8P7bCoXFkE3o80zpEezt72ki72NBML6US4zN94x5cCMnIArnldLFtUKLH14Ihv Owa+V0+yrk2ewdnwg25W2WY8amMN1fYPIbAhnTAQz2ZfxWsvNQN3aOI9eIcdJkx/qf SNIly+1efcIP33FcCVYMoP1YgaJ7BbBUpt8KP9uPPGHfvvnBkG0hWP8YdjtEiu3hmA yluXJtwfN/c0A== Date: Tue, 30 Nov 2021 10:51:12 -0800 From: "Darrick J. Wong" To: Christoph Hellwig Subject: Re: [PATCH 06/29] dax: move the partition alignment check into fs_dax_get_by_bdev Message-ID: <20211130185112.GE8467@magnolia> References: <20211129102203.2243509-1-hch@lst.de> <20211129102203.2243509-7-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211129102203.2243509-7-hch@lst.de> X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nvdimm@lists.linux.dev, Mike Snitzer , linux-s390@vger.kernel.org, linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, Dan Williams , linux-ext4@vger.kernel.org, Ira Weiny Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On Mon, Nov 29, 2021 at 11:21:40AM +0100, Christoph Hellwig wrote: > fs_dax_get_by_bdev is the primary interface to find a dax device for a > block device, so move the partition alignment check there instead of > wiring it up through ->dax_supported. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Dan Williams Makes more sense than the old "get the dax device and /then/ check if it's ok to use it" strategy. Reviewed-by: Darrick J. Wong --D > --- > drivers/dax/super.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index c8500b7e2d8a2..f2cef47bdeafd 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -92,6 +92,12 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) > 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) { > + pr_info("%pg: error: unaligned partition for dax\n", bdev); > + return NULL; > + } > + > id = dax_read_lock(); > dax_dev = xa_load(&dax_hosts, (unsigned long)bdev->bd_disk); > if (!dax_dev || !dax_alive(dax_dev) || !igrab(&dax_dev->inode)) > @@ -106,10 +112,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > struct block_device *bdev, int blocksize, sector_t start, > sector_t sectors) > { > - pgoff_t pgoff, pgoff_end; > - sector_t last_page; > - int err; > - > if (blocksize != PAGE_SIZE) { > pr_info("%pg: error: unsupported blocksize for dax\n", bdev); > return false; > @@ -120,19 +122,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > - err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > - last_page = PFN_DOWN((start + sectors - 1) * 512) * PAGE_SIZE / 512; > - err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > return true; > } > EXPORT_SYMBOL_GPL(generic_fsdax_supported); > -- > 2.30.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC5EBC433FE for ; Tue, 30 Nov 2021 18:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239714AbhK3Syg (ORCPT ); Tue, 30 Nov 2021 13:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234856AbhK3Syf (ORCPT ); Tue, 30 Nov 2021 13:54:35 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 187D6C061574; Tue, 30 Nov 2021 10:51:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 529E2CE1AFF; Tue, 30 Nov 2021 18:51:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 722D9C53FC7; Tue, 30 Nov 2021 18:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638298272; bh=pIN7ABzLdiksJYiI1GQ6S2KBxnScyKH3E9XuH9ab5kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f69KXMApBRLMv9opuoCOfv4JankytX6MHovhMbMeU40j1k3J7m4Jmn9zdR8i4vbW5 QnbFwqdl+oJCTfd2dr855rqMqz8YoePtTSvD755hNQUKrIJWPZ2p7YXIdxOkBJlpxq TYdc8P7bCoXFkE3o80zpEezt72ki72NBML6US4zN94x5cCMnIArnldLFtUKLH14Ihv Owa+V0+yrk2ewdnwg25W2WY8amMN1fYPIbAhnTAQz2ZfxWsvNQN3aOI9eIcdJkx/qf SNIly+1efcIP33FcCVYMoP1YgaJ7BbBUpt8KP9uPPGHfvvnBkG0hWP8YdjtEiu3hmA yluXJtwfN/c0A== Date: Tue, 30 Nov 2021 10:51:12 -0800 From: "Darrick J. Wong" To: Christoph Hellwig Cc: Dan Williams , Mike Snitzer , Ira Weiny , dm-devel@redhat.com, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 06/29] dax: move the partition alignment check into fs_dax_get_by_bdev Message-ID: <20211130185112.GE8467@magnolia> References: <20211129102203.2243509-1-hch@lst.de> <20211129102203.2243509-7-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211129102203.2243509-7-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Nov 29, 2021 at 11:21:40AM +0100, Christoph Hellwig wrote: > fs_dax_get_by_bdev is the primary interface to find a dax device for a > block device, so move the partition alignment check there instead of > wiring it up through ->dax_supported. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Dan Williams Makes more sense than the old "get the dax device and /then/ check if it's ok to use it" strategy. Reviewed-by: Darrick J. Wong --D > --- > drivers/dax/super.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index c8500b7e2d8a2..f2cef47bdeafd 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -92,6 +92,12 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) > 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) { > + pr_info("%pg: error: unaligned partition for dax\n", bdev); > + return NULL; > + } > + > id = dax_read_lock(); > dax_dev = xa_load(&dax_hosts, (unsigned long)bdev->bd_disk); > if (!dax_dev || !dax_alive(dax_dev) || !igrab(&dax_dev->inode)) > @@ -106,10 +112,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > struct block_device *bdev, int blocksize, sector_t start, > sector_t sectors) > { > - pgoff_t pgoff, pgoff_end; > - sector_t last_page; > - int err; > - > if (blocksize != PAGE_SIZE) { > pr_info("%pg: error: unsupported blocksize for dax\n", bdev); > return false; > @@ -120,19 +122,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > - err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > - last_page = PFN_DOWN((start + sectors - 1) * 512) * PAGE_SIZE / 512; > - err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end); > - if (err) { > - pr_info("%pg: error: unaligned partition for dax\n", bdev); > - return false; > - } > - > return true; > } > EXPORT_SYMBOL_GPL(generic_fsdax_supported); > -- > 2.30.2 >