Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp907571pxr; Mon, 11 Apr 2022 10:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHssshLUQXHmInQkTgUrxUi3tJYXUr9j+FulYG8wdlBMEobXUYtGSLma187oRrqAkM1v+V X-Received: by 2002:a05:6402:2682:b0:41d:2f74:7269 with SMTP id w2-20020a056402268200b0041d2f747269mr17609775edd.255.1649696587337; Mon, 11 Apr 2022 10:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649696587; cv=none; d=google.com; s=arc-20160816; b=h1ouBvk+2AaQzc/1Bd6AyPLSyUmO/yV0zKZUjZK3lzAQGTtfRBu//hoP0xgFFS/5q2 /x46bD35ROTL8Yf725Mw9ZFqi7EVzMnQoB4gRFo6l0CtzQv0uxstT6Hj5LTnEeCLXpvr SnAUoEq/AdZx5eY8fPPSDH0Su59j1gJT4N+2/V94Yw0c+ODaN0LbNfb9GAy+AQjcvGMi Szv9fEPM397WhlfPDWnxhpr6NYkWa0bAIbbDWr+nI+gcDZDo5Ba4zZn0SFDKMsdLbeeA PRYy8ylSzkNI3NDFnRzgQSaq47MgVRkSWuDXFSiEQKSuk0wJ+XY6WbnCkz30yX1af3lx n5ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EfN09E7KgfFk5NOTogRSBSf7jTlM22RGe5+0+tCjcRA=; b=X7XKSLhJ9lAknB0IvWdTccNIl8Vz8vCFoc/lTnNriNJBUb20LgyR6aKybTliQn7w+3 8fuzcJ/KIT4RJYJU7j7FXxHaly4n6ltcFdOMRkNW7wh828OI/rEwCzlqQYtQ1WPf1PKp MyK2O2ZCVopNGxAT7EyheQQEZHiAQl67pFShZO6Svr6E0KfDQ6Fz9ZMSEUIouQkGJm+l r/3DQzxoUYy4p+qdK/LhMrvCEMShjZyYh5IidFnmrhp6JaYlvBRWXVlafqviraxqYDue mBmLMKb8los6WWkiWqZrykwVPjGV0KBmTvoDJzBkFzoQQ7X6oLD9HzvfnyYdKiKp3+xt asrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=t0aAiQOA; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne13-20020a1709077b8d00b006e7ba12c641si7107521ejc.115.2022.04.11.10.02.32; Mon, 11 Apr 2022 10:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=t0aAiQOA; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233853AbiDIEzl (ORCPT + 99 others); Sat, 9 Apr 2022 00:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbiDIEyh (ORCPT ); Sat, 9 Apr 2022 00:54:37 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C536DB4B4; Fri, 8 Apr 2022 21:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=EfN09E7KgfFk5NOTogRSBSf7jTlM22RGe5+0+tCjcRA=; b=t0aAiQOAgYh2xfMXnvLterJAh6 EsrOU2ANVhJA83bJAg/kUS0kihbC+selaMUlp7jnEi1JX3OTLxh72lWlfgaE8eU78RLO8Gy9T5ODC DXAWEXuEQHMseAneboagWBhh9B2fR1FSBtVZj64dvRfuKz7Nu5BpqV4PvqlHtda/o34eSgrHO53ve G63mK1qyCrWopUHxcEkJvB1wZJRMW+Ln5pkg0hEttKmUntLJOMDd4Pc2WSw2oow34+WQ73I+SrMDH pspOR3Jzv2D4uwcmOaSzyhOpaHWNXDogcxcYxeAfE3yQCJHDRmr3vOgYqDt08xFB0zD2acAHWyCU2 Jy5+T74A==; Received: from 213-147-167-116.nat.highway.webapn.at ([213.147.167.116] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nd34U-00213P-4I; Sat, 09 Apr 2022 04:51:38 +0000 From: Christoph Hellwig To: Jens Axboe Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org, Damien Le Moal , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 15/27] block: add a bdev_max_zone_append_sectors helper Date: Sat, 9 Apr 2022 06:50:31 +0200 Message-Id: <20220409045043.23593-16-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Acked-by: Damien Le Moal Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- 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; -- 2.30.2