Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090022rwb; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7M67fhUnOeLlNGpsGaT2B26rwkj1sI5PUt8i+dB4C9ZDj7lxtgeuxkusPGjYg1P1CypNiJ X-Received: by 2002:a17:907:12d7:b0:730:6d62:4ef7 with SMTP id vp23-20020a17090712d700b007306d624ef7mr11472866ejb.133.1660611186464; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611186; cv=none; d=google.com; s=arc-20160816; b=erV5rnDO9CTCM7sM7CpyFRQeE8ahIw8mcVzeBHzlvZ3pHit4xteoSEuHlcBSA//WI0 eWFAFfKwjZwzuH0CJB6kMeUxgahkn8RCFHrZJL4XFpEVtOFCvseSkfpwzJPlSA4mPNrF UKPfe/OpKB0nwKyB8QAcqUSEsu9x4VG5SgYMlXkKn1JvvJ+nWRzyQxOABLvehc2TBfHx TaA1bk6SoUt9NdfSv4+dBUperly5fuC1G5o/UruAR7nicuMw9TTj9HvbwWrLrsLMxuVb M3M7VeCxjsg0MTrHWYzVb35gHBqlO6L+voi1aCFz98vrpjnbvPCWOfxWtK9OO6Lfsvi8 2ZEg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+vPOX67jyUn89GlySEbeGueTS0+fS16C8d9nN/1rAnQ=; b=oaOWYrkrBzyWZrc/zUGLKSGDNvAgay4KGV0SxfIRKIePu09tzetXWpXcctHGbrq/Qh XAJmAR620YTn6XPOaUOihhhSYjYqFLBELEVF+Al/tyOdBscHtPTVo3oks7gZL8a6U3RI nSAdygoGgsQVWPvFQrTJDXPzS1TWwyUFfkB+o88xLW15FLRLBwOOzTv/7eKPpb9OMFuc iunDFMRzVY1pqBDoVKg7E7+ky0lA2kcYMNCbg2rlWEZ9TIke9XAWqn6X/0a4YfMH9h7g NOUUlEkYlnaaxHo94XftecyXsGfrfZRa/zu6UYBR5pMv7aKpdWHiM1X01u0RWBYSJY8m QZEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qBF663iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc8-20020a170907168800b007331efb8a1asi9767641ejc.44.2022.08.15.17.52.41; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=qBF663iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245164AbiHOXZB (ORCPT + 99 others); Mon, 15 Aug 2022 19:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345022AbiHOXU4 (ORCPT ); Mon, 15 Aug 2022 19:20:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F562B4EAC; Mon, 15 Aug 2022 13:04:20 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id BF1A460693; Mon, 15 Aug 2022 20:04:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01D4C433C1; Mon, 15 Aug 2022 20:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593859; bh=NGilHNjrd5uqftgXcB6CgRGd4vGCjA/xtz5PynTnumU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBF663ivHNTIZh49MIWyHHjyTHdT+tTEiUnJdnLx8TMWVOvPu3Qe1MK+RFcx+rnkx Ed1/4KnwBqr4/tCqQMzo9Dr0S9Tys4y2kowmHsc1dG6K2tdATFWVuzoNKm4+M9MDSz 4/77LrC8vsN1HIDPa1H4P4HaB3ytIxc0JqX26LmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Damien Le Moal , "Martin K. Petersen" , Johannes Thumshirn , Chaitanya Kulkarni , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 1017/1095] block: add a bdev_max_zone_append_sectors helper Date: Mon, 15 Aug 2022 20:06:56 +0200 Message-Id: <20220815180511.162001359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 2aba0d19f4d8c8929b4b3b94a9cfde2aa20e6ee2 ] 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 Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20220415045258.199825-16-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 e34718b09550..82b61acf7a72 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 15a4c7c07a3b..b68798a572fc 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -723,13 +723,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 cc6b24a5098f..34f2b88dfd6e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1190,6 +1190,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.35.1