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.133.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 7DD50C433F5 for ; Wed, 6 Apr 2022 08:54:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-5LK0kytbNCOqq5orlAOgGQ-1; Wed, 06 Apr 2022 04:53:59 -0400 X-MC-Unique: 5LK0kytbNCOqq5orlAOgGQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53526899EC5; Wed, 6 Apr 2022 08:53:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C6377AF0; Wed, 6 Apr 2022 08:53:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D431D1940369; Wed, 6 Apr 2022 08:53:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00FF51947BBB for ; Wed, 6 Apr 2022 08:53:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D35777AE4; Wed, 6 Apr 2022 08:53:54 +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 CECB57AE8 for ; Wed, 6 Apr 2022 08:53:47 +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 A4444185A79C for ; Wed, 6 Apr 2022 08:53:47 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-eIrEUuPIMACS7351Xg4vXQ-2; Wed, 06 Apr 2022 04:53:46 -0400 X-MC-Unique: eIrEUuPIMACS7351Xg4vXQ-2 X-IronPort-AV: E=Sophos;i="5.90,239,1643644800"; d="scan'208";a="196092186" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Apr 2022 16:52:43 +0800 IronPort-SDR: EMfp12JdwWzjejd18+fwVqxukBDODbD11IUMA8yhFWa2t+kPtUpfWDvDXfovJkRXDWdlgEFDvz 2/DtZ1nuyuE5knUkWEGVew/ObDgIgKM3PCjdo6pfYhmB5Wxzx90unEP8b3+H9HF5soUm4l1jru tlaMmtiUULd/t5GIjJ8hi4pNd9sMKQ/oox7naG7/NKb04d/3yNwYafD/lMUnL115KenwDgZcsO 8/4ws75Dp+Q39PtyPABtv6DBoHZOQ6FtETgTZyQwj3yOoNBO8DAMZL3dEN8LWjxDMTlhmUTwDm UTMfNOtRycwZz0HfO2NkWqWr Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:23:23 -0700 IronPort-SDR: yG22vGsaFb1fBPPaemoPc658Nm/5U7faqQFbLGcaminxUHvKPWbYDx+tNQ6TQ2ya4Dp9Y3418k pYr2w97PTn8K3QYk3EYmCUGlmM66cWuIa/XmJ1oQNTVBLUyGQPyEjm8fzIId7TZJfnMZww0+v4 MrwMc3wfUKhiYb86jGAaazXsm+3mJhfWzsfwJRJ4RfE8T4xQsp+OA4UaNnP6jROrie9VaLLXvM YplOep7H6Uc/6YlhwzVy48tgG42Z92LwagoJ7sFihtzcvoUOkvXaCfvs3wvsV8N5ePyLo427uT 3Hg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:52:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDm63jQz1SVp2 for ; Wed, 6 Apr 2022 01:52:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id W8X_HfGUuR1K for ; Wed, 6 Apr 2022 01:52:39 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KYJDg4WyPz1Rvlx; Wed, 6 Apr 2022 01:52:35 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 To: Christoph Hellwig , Jens Axboe References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220406060516.409838-15-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.79 on 10.11.54.5 Subject: Re: [dm-devel] [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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-Language: en-US Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel