From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 0D81072 for ; Wed, 27 Oct 2021 23:07:18 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id i5so3088862pla.5 for ; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=d6phRBLSNqEavLbFGa7qsltfCwCXOIkQGNewJdYfiMwINhHDbJ+v3Tvr+m7SXCKglh f1Y9JyoYsY7pru2o0qaf9ZrRobsN47Jue96kM8PwOADE6VAIkbXtDJTZy+mzrce1H5ii TDWfFC/E9fe8cXOG72hb4HndsLJ5qovtA1WXr8x1UXXNXsg6OU7/y9sWKZsB9Ro8FzaF 3kotXlCmovzhrPQGnkvqh1aQ4+kBEwqSKMSlKnEz5Ahj4QsLMDMTI4jX5+IsmEJsZDOu D4ACx/M3ONMf14xOrt8n/jVyvHMKdyB04vPcp4aB9RBAawLg1e2wm7UXNUEREJEycjA9 pSnQ== 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=HdhCT+iFz5r4Jt0NdtFvfvev0qHUK8t9ZCvLenYYrEGD7Sc619hZWU3JQTRzzk8k7x gEI+nHUVrG3grJ+IbKmx5OTpRqW0V0ElBppSEFycezVBJkJNENxl2iW2D93Pzu9b2WYG 8AhgT8TSDL0dZKdp7shp+SGJrvek0bZpwbjp4AjrBxcR42gcPWM0pbEuY6UeSIYS9g1a TbR6HY7kpBF4q88DzKMUhlP6GHO2tSCuf65xfBCbH59mvK3+bReNv45NpToaqESf6va/ nanyuIEYNyihqsqQxI9jaJ7xa4Rr8/5cZm6PYz7HCgHeYBkVu2Km7EpFYCQPfKdQQ3dh 3mYA== X-Gm-Message-State: AOAM533WmdepFhcUuJEg+tTVR0i2hnzZQMJQ2s+exidqN/dnPJlVzWu3 LL7R6+Uh1d7AtA6+MVeKeqKCkztM4wqGOlqtz9Hx9A== X-Google-Smtp-Source: ABdhPJxTOfk9fcqxHjqgG3f1vnNsNPlrTHxqnz6/LIE7U1wpYxfkWo7JAy9TqN/B72HDrJA9DjHrJAEIhgWs2Md2+FA= X-Received: by 2002:a17:90b:350f:: with SMTP id ls15mr618659pjb.220.1635376038542; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20211018044054.1779424-1-hch@lst.de> <20211018044054.1779424-6-hch@lst.de> In-Reply-To: <20211018044054.1779424-6-hch@lst.de> From: Dan Williams Date: Wed, 27 Oct 2021 16:07:07 -0700 Message-ID: Subject: Re: [PATCH 05/11] dax: move the partition alignment check into 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 Sun, Oct 17, 2021 at 9:41 PM 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. Looks good. > > 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) { > + 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)) > @@ -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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3517C433F5 for ; Wed, 27 Oct 2021 23:07:24 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6FB4160F56 for ; Wed, 27 Oct 2021 23:07:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6FB4160F56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1D47B40598; Wed, 27 Oct 2021 23:07:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ea3BtSWCm5R2; Wed, 27 Oct 2021 23:07:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id C7A9540586; Wed, 27 Oct 2021 23:07:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 99A38C0012; Wed, 27 Oct 2021 23:07:22 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 93363C000E for ; Wed, 27 Oct 2021 23:07:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 730774010E for ; Wed, 27 Oct 2021 23:07:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel-com.20210112.gappssmtp.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H6csg4-2Metl for ; Wed, 27 Oct 2021 23:07:19 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by smtp2.osuosl.org (Postfix) with ESMTPS id 84C0C400EA for ; Wed, 27 Oct 2021 23:07:18 +0000 (UTC) Received: by mail-pj1-x1036.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so3262615pjb.0 for ; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=d6phRBLSNqEavLbFGa7qsltfCwCXOIkQGNewJdYfiMwINhHDbJ+v3Tvr+m7SXCKglh f1Y9JyoYsY7pru2o0qaf9ZrRobsN47Jue96kM8PwOADE6VAIkbXtDJTZy+mzrce1H5ii TDWfFC/E9fe8cXOG72hb4HndsLJ5qovtA1WXr8x1UXXNXsg6OU7/y9sWKZsB9Ro8FzaF 3kotXlCmovzhrPQGnkvqh1aQ4+kBEwqSKMSlKnEz5Ahj4QsLMDMTI4jX5+IsmEJsZDOu D4ACx/M3ONMf14xOrt8n/jVyvHMKdyB04vPcp4aB9RBAawLg1e2wm7UXNUEREJEycjA9 pSnQ== 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=5x8nvfdX87nCdkPEtLL/oayj6jomdrpfW2mgCd50lJlt33OuxqMbaXTSKUGLFrMr9m RPMy/ejx9RsYD4I2fWqhW/DZmm63Ffd0J1vxElzx/QkqrfCn5u5UxjC8PUqM5hytKKRu VZ/fNgoDCZfYM4kR1OnkvMT/ldBwI50HXHxz4z9gjwha43xKwYAXRcMHq0tKGUMV3x9Z alUYh3B/J4nKTOow1LmItSm7OV4L/YD2IKYRwNU3hRTOvqm9NU2P45/LClQmElQn1ZQ6 f/TyIrkyuURNCvHPSyvKX3w3FsSYsGc5dukc/MR9xRHU/JsjNXqKxhynUyIZ7NGYgjC/ RysQ== X-Gm-Message-State: AOAM533eBVJOcPQp0WmDHvag96MD5XZ7RWaLu7lg1Cn/XEjdFKFpTCoD z45Lazq2NWh7nk2VZ4i/S5wrv/1WpNT9ux8B/mOoFQ== X-Google-Smtp-Source: ABdhPJxTOfk9fcqxHjqgG3f1vnNsNPlrTHxqnz6/LIE7U1wpYxfkWo7JAy9TqN/B72HDrJA9DjHrJAEIhgWs2Md2+FA= X-Received: by 2002:a17:90b:350f:: with SMTP id ls15mr618659pjb.220.1635376038542; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) MIME-Version: 1.0 References: <20211018044054.1779424-1-hch@lst.de> <20211018044054.1779424-6-hch@lst.de> In-Reply-To: <20211018044054.1779424-6-hch@lst.de> From: Dan Williams Date: Wed, 27 Oct 2021 16:07:07 -0700 Message-ID: Subject: Re: [PATCH 05/11] dax: move the partition alignment check into fs_dax_get_by_bdev To: Christoph Hellwig Cc: Linux NVDIMM , Mike Snitzer , linux-s390 , linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs , device-mapper development , linux-fsdevel , linux-ext4 , Ira Weiny X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Sun, Oct 17, 2021 at 9:41 PM 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. Looks good. > > 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) { > + 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)) > @@ -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 > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45A59C433F5 for ; Wed, 27 Oct 2021 23:07:38 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9542C60FC0 for ; Wed, 27 Oct 2021 23:07:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9542C60FC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-6QwSr8fNMOCDxGrUm_l14w-1; Wed, 27 Oct 2021 19:07:33 -0400 X-MC-Unique: 6QwSr8fNMOCDxGrUm_l14w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B11848026AD; Wed, 27 Oct 2021 23:07:28 +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 01634100E12C; Wed, 27 Oct 2021 23:07:28 +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 CB2E44EA2A; Wed, 27 Oct 2021 23:07:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19RN7OcU016911 for ; Wed, 27 Oct 2021 19:07:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4EF3551E2; Wed, 27 Oct 2021 23:07:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4919851E1 for ; Wed, 27 Oct 2021 23:07:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 5D9C1185A79C for ; Wed, 27 Oct 2021 23:07:21 +0000 (UTC) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-GIXEGy31O9KOLODvcYk5-Q-1; Wed, 27 Oct 2021 19:07:19 -0400 X-MC-Unique: GIXEGy31O9KOLODvcYk5-Q-1 Received: by mail-pj1-f41.google.com with SMTP id nn3-20020a17090b38c300b001a03bb6c4ebso3233689pjb.1 for ; Wed, 27 Oct 2021 16:07:19 -0700 (PDT) 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=Ojo6YrFyXs+8sMLVZMFp5OrYVbVV/hQyzgRGcTx+Uo7zu6tkjAlAfGM11uvznqMwmg YBMpD/NZt4so0jaOQofDmDEQSZR3y7CHKQuKg4xJwFGzWwqwTOFKaFeFYk+jA+SP5xs0 9kMVp5TmxSY1GweaGw0J7um4q2bO9sCNnJzPPVFcxzcAYw1Za1LSxXUxPwr2XLGYAp4w 8hioEA3cOcs4UbxMStMqhswH6/+0ij9alSjJrsS+ir4sWon1OStbY3RuCJiHNmJrm8VA Impquex2v+yR/daev+OpQUCcSLocPpTMNIINv1zA6sHnFtL0JOGh6YKH+Edz117mRfrB cZBA== X-Gm-Message-State: AOAM531KujzMnnxKuYXBghcZeHLdaouJKZBa20kYkHZ2gdzZKVyTebWo 52iEkQQOlno+lJz9cRr9A0VZCkTD2paxHP65vkC0AA== X-Google-Smtp-Source: ABdhPJxTOfk9fcqxHjqgG3f1vnNsNPlrTHxqnz6/LIE7U1wpYxfkWo7JAy9TqN/B72HDrJA9DjHrJAEIhgWs2Md2+FA= X-Received: by 2002:a17:90b:350f:: with SMTP id ls15mr618659pjb.220.1635376038542; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) MIME-Version: 1.0 References: <20211018044054.1779424-1-hch@lst.de> <20211018044054.1779424-6-hch@lst.de> In-Reply-To: <20211018044054.1779424-6-hch@lst.de> From: Dan Williams Date: Wed, 27 Oct 2021 16:07:07 -0700 Message-ID: To: Christoph Hellwig 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.79 on 10.11.54.5 X-loop: dm-devel@redhat.com Cc: Linux NVDIMM , Mike Snitzer , linux-s390 , linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs , device-mapper development , linux-fsdevel , linux-ext4 , Ira Weiny Subject: Re: [dm-devel] [PATCH 05/11] 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.84 on 10.5.11.22 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Sun, Oct 17, 2021 at 9:41 PM 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. Looks good. > > 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) { > + 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)) > @@ -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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A551AC433F5 for ; Wed, 27 Oct 2021 23:18:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 21444610CB for ; Wed, 27 Oct 2021 23:18:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 21444610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hfl3X5mcMz3gtf for ; Thu, 28 Oct 2021 10:18:00 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel-com.20210112.gappssmtp.com header.i=@intel-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=d6phRBLS; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=dan.j.williams@intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel-com.20210112.gappssmtp.com header.i=@intel-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=d6phRBLS; dkim-atps=neutral Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HfkqD6M0jz3f3K for ; Thu, 28 Oct 2021 10:07:20 +1100 (AEDT) Received: by mail-pj1-x1033.google.com with SMTP id k2-20020a17090ac50200b001a218b956aaso3229156pjt.2 for ; Wed, 27 Oct 2021 16:07:20 -0700 (PDT) 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=d6phRBLSNqEavLbFGa7qsltfCwCXOIkQGNewJdYfiMwINhHDbJ+v3Tvr+m7SXCKglh f1Y9JyoYsY7pru2o0qaf9ZrRobsN47Jue96kM8PwOADE6VAIkbXtDJTZy+mzrce1H5ii TDWfFC/E9fe8cXOG72hb4HndsLJ5qovtA1WXr8x1UXXNXsg6OU7/y9sWKZsB9Ro8FzaF 3kotXlCmovzhrPQGnkvqh1aQ4+kBEwqSKMSlKnEz5Ahj4QsLMDMTI4jX5+IsmEJsZDOu D4ACx/M3ONMf14xOrt8n/jVyvHMKdyB04vPcp4aB9RBAawLg1e2wm7UXNUEREJEycjA9 pSnQ== 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=3af0vrDw+XvQKylIm0LDLH9D6xoJ74LhsidYuXkOM7g=; b=xS2OKGWDJGi4F6sUp0fe90wc/wZ9LdGNe6bfY4JJ1vhJu81RWchRqzFINHF/5DL9Vt rI7O4LM6XJ7NB35ayPUurNzuQS6wBOavkMx8Oum/YgWzcsGPiGGhfC7Y+1DBvABi3mj0 1DvngP0LcqdOM/Vl/gU8QL3RhJMZ3p12ZhIyto9Qb4wfBjXJ/ZuSWqkqSIPP1U3D4leG xbIDd3LeNmO5Kn5JkYR6rkBbYBWkO147rqVVJqUUlG43ijbt6esC2jbbVwaICLewcV5g brx8AGeTUcEgNtT07TztPVHxUoTnokElKLAjezACvL9ECS0FHesuUJlrkI7Xqhq30TYX MWoA== X-Gm-Message-State: AOAM5331J0ESCxRGc+M4tgDmLk4tTTF3eo+jw2Vew8dxCwOyevgBxKXU u8SanhWWr1WgnYnbbrr59LrydC3A+Ak+77f0Q/v94g== X-Google-Smtp-Source: ABdhPJxTOfk9fcqxHjqgG3f1vnNsNPlrTHxqnz6/LIE7U1wpYxfkWo7JAy9TqN/B72HDrJA9DjHrJAEIhgWs2Md2+FA= X-Received: by 2002:a17:90b:350f:: with SMTP id ls15mr618659pjb.220.1635376038542; Wed, 27 Oct 2021 16:07:18 -0700 (PDT) MIME-Version: 1.0 References: <20211018044054.1779424-1-hch@lst.de> <20211018044054.1779424-6-hch@lst.de> In-Reply-To: <20211018044054.1779424-6-hch@lst.de> From: Dan Williams Date: Wed, 27 Oct 2021 16:07:07 -0700 Message-ID: Subject: Re: [PATCH 05/11] dax: move the partition alignment check into fs_dax_get_by_bdev To: Christoph Hellwig Content-Type: text/plain; charset="UTF-8" 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: Linux NVDIMM , Mike Snitzer , linux-s390 , linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs , device-mapper development , linux-fsdevel , linux-ext4 , Ira Weiny Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On Sun, Oct 17, 2021 at 9:41 PM 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. Looks good. > > 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) { > + 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)) > @@ -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 >