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 B10D5C433EF for ; Tue, 23 Nov 2021 22:26:14 +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-533-3cyf-9QzPQe19BYi6WpdUw-1; Tue, 23 Nov 2021 17:26:12 -0500 X-MC-Unique: 3cyf-9QzPQe19BYi6WpdUw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3CAC1006AA0; Tue, 23 Nov 2021 22:26:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A55A5FC13; Tue, 23 Nov 2021 22:26:06 +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 C31D74A703; Tue, 23 Nov 2021 22:26:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ANMQ1v5022804 for ; Tue, 23 Nov 2021 17:26:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5270C4010FFC; Tue, 23 Nov 2021 22:26:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DBBE40CFD04 for ; Tue, 23 Nov 2021 22:26:01 +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 35841106655B for ; Tue, 23 Nov 2021 22:26:01 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-B95Wp5ksMRuHNJSO4aizmw-1; Tue, 23 Nov 2021 17:25:57 -0500 X-MC-Unique: B95Wp5ksMRuHNJSO4aizmw-1 Received: by mail.kernel.org (Postfix) with ESMTPSA id 63B2260F5B; Tue, 23 Nov 2021 22:25:56 +0000 (UTC) Date: Tue, 23 Nov 2021 14:25:55 -0800 From: "Darrick J. Wong" To: Christoph Hellwig Message-ID: <20211123222555.GE266024@magnolia> References: <20211109083309.584081-1-hch@lst.de> <20211109083309.584081-7-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20211109083309.584081-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.84 on 10.11.54.1 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.16 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 Tue, Nov 09, 2021 at 09:32:46AM +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 > --- > 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 04fc680542e8d..482fe775324a4 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -93,6 +93,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) { Do we have to be careful about 64-bit division here, or do we not support DAX on 32-bit? > + pr_info("%pg: error: unaligned partition for dax\n", bdev); I also wonder if this should be ratelimited...? --D > + 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)) > @@ -107,10 +113,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; > @@ -121,19 +123,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 EED97C433F5 for ; Tue, 23 Nov 2021 22:26:08 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HzJdC09kHz2ynf for ; Wed, 24 Nov 2021 09:26:07 +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=Qw8qbxKV; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.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=Qw8qbxKV; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 4HzJd35kmxz2yP0 for ; Wed, 24 Nov 2021 09:25:59 +1100 (AEDT) Received: by mail.kernel.org (Postfix) with ESMTPSA id 63B2260F5B; Tue, 23 Nov 2021 22:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637706356; bh=QAV7Co9x+kq7cw9CnYx72vJEWiPcLd0IRsChlJ7iD78=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qw8qbxKV0Ln59bnZ2iYvOCv17wc7NmZh2MVxAZoTUcjsGNcBZmG3/y8Q/y5EgIU5z /Ud6BAVnfCGhCYrp8HEHI2+/oPKUxgQfi7IwyDfXcYG8HqhS9fH0BBdDHARe1h/v2R 7TUyTl1cxhl1w+Cm157k5ff4tt95TM11J5zZXaFkyV2QIcdSubiuEdFX8woRCQsoJi ye9Pa33GtkO04j+eaol/2zzbKQr0Ulfns+oBJwkqlGf2W9emGi7Irt2r6IIEzkds8z JuJGU8+xc+QmNI7kLV/+mvxjz4Ku5J0WJTELrf3/2LsR9G90q2v/zZ2lDrTO802RUz NlSo0Mf2Bi+iQ== Date: Tue, 23 Nov 2021 14:25:55 -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: <20211123222555.GE266024@magnolia> References: <20211109083309.584081-1-hch@lst.de> <20211109083309.584081-7-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211109083309.584081-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 Tue, Nov 09, 2021 at 09:32:46AM +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 > --- > 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 04fc680542e8d..482fe775324a4 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -93,6 +93,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) { Do we have to be careful about 64-bit division here, or do we not support DAX on 32-bit? > + pr_info("%pg: error: unaligned partition for dax\n", bdev); I also wonder if this should be ratelimited...? --D > + 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)) > @@ -107,10 +113,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; > @@ -121,19 +123,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 A08B2C433F5 for ; Tue, 23 Nov 2021 22:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236863AbhKWW3G (ORCPT ); Tue, 23 Nov 2021 17:29:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:39454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233344AbhKWW3F (ORCPT ); Tue, 23 Nov 2021 17:29:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 63B2260F5B; Tue, 23 Nov 2021 22:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637706356; bh=QAV7Co9x+kq7cw9CnYx72vJEWiPcLd0IRsChlJ7iD78=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qw8qbxKV0Ln59bnZ2iYvOCv17wc7NmZh2MVxAZoTUcjsGNcBZmG3/y8Q/y5EgIU5z /Ud6BAVnfCGhCYrp8HEHI2+/oPKUxgQfi7IwyDfXcYG8HqhS9fH0BBdDHARe1h/v2R 7TUyTl1cxhl1w+Cm157k5ff4tt95TM11J5zZXaFkyV2QIcdSubiuEdFX8woRCQsoJi ye9Pa33GtkO04j+eaol/2zzbKQr0Ulfns+oBJwkqlGf2W9emGi7Irt2r6IIEzkds8z JuJGU8+xc+QmNI7kLV/+mvxjz4Ku5J0WJTELrf3/2LsR9G90q2v/zZ2lDrTO802RUz NlSo0Mf2Bi+iQ== Date: Tue, 23 Nov 2021 14:25:55 -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: <20211123222555.GE266024@magnolia> References: <20211109083309.584081-1-hch@lst.de> <20211109083309.584081-7-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211109083309.584081-7-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Nov 09, 2021 at 09:32:46AM +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 > --- > 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 04fc680542e8d..482fe775324a4 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -93,6 +93,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) { Do we have to be careful about 64-bit division here, or do we not support DAX on 32-bit? > + pr_info("%pg: error: unaligned partition for dax\n", bdev); I also wonder if this should be ratelimited...? --D > + 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)) > @@ -107,10 +113,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; > @@ -121,19 +123,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 >