From patchwork Thu Sep 29 07:47:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12993660 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 6A41BC04A95 for ; Thu, 29 Sep 2022 07:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbiI2Hry (ORCPT ); Thu, 29 Sep 2022 03:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234872AbiI2Hrx (ORCPT ); Thu, 29 Sep 2022 03:47:53 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 487F213940E for ; Thu, 29 Sep 2022 00:47:52 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220929074750euoutp02e078e797210148e481bb8b5870013e28~ZRT4MBNnL0229902299euoutp02p for ; Thu, 29 Sep 2022 07:47:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220929074750euoutp02e078e797210148e481bb8b5870013e28~ZRT4MBNnL0229902299euoutp02p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664437670; bh=pZy4r7iqahFnpHPjfTyCoAjWDosoGm53ntzBPmPZ8tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2MxQuSM1UjtVP6YLM0c8dY+rnGVrFlB0x828h/aJb48m5RKfUX1ydTwTL9EO8lSN b3RbQml5SQwg2hELBZdIhzG4wwUhH8uCkBIp5zg46EIBsvlg4UEa3KDKNPje/aB6CO xn3E2cb+gB8khsP3cgbHijxUBGhaNivoZyAHoWR8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220929074748eucas1p13d26244319a6712fba0a351cad4adbe1~ZRT2xxyTw0530905309eucas1p1E; Thu, 29 Sep 2022 07:47:48 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 9C.88.29727.4AD45336; Thu, 29 Sep 2022 08:47:48 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220929074748eucas1p1145790d433b4f57cc9e9238df480091b~ZRT2VEmMa2537025370eucas1p17; Thu, 29 Sep 2022 07:47:48 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220929074748eusmtrp13f39090b305e1b84278746fbbe16ad72~ZRT2UQdNt2626326263eusmtrp1g; Thu, 29 Sep 2022 07:47:48 +0000 (GMT) X-AuditID: cbfec7f2-205ff7000001741f-30-63354da474ab Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 75.C5.10862.3AD45336; Thu, 29 Sep 2022 08:47:48 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220929074747eusmtip1bcd50b4ea3e9782fab825f111099c12a~ZRT2EkmDP2988729887eusmtip1W; Thu, 29 Sep 2022 07:47:47 +0000 (GMT) From: Pankaj Raghav To: axboe@kernel.dk, hch@lst.de Cc: gost.dev@samsung.com, linux-block@vger.kernel.org, damien.lemoal@opensource.wdc.com, Pankaj Raghav Subject: [PATCH v3 1/2] block: adapt blk_mq_plug() to not plug for writes that require a zone lock Date: Thu, 29 Sep 2022 09:47:44 +0200 Message-Id: <20220929074745.103073-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929074745.103073-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkleLIzCtJLcpLzFFi42LZduznOd0lvqbJBtefylusvtvPZvH77Hlm i5sHdjJZrFx9lMli7y1ti89LW9gd2Dwuny312H2zgc1jZ+t9Vo++LasYPT5vkgtgjeKySUnN ySxLLdK3S+DKOP/3D2vBP6GKtsdvGBsY3/J3MXJySAiYSHS2z2XqYuTiEBJYwShxavJ9dgjn C6NE77U1UJnPjBILb2xggmnpvn+KFSKxnFHi794dUM5LRomdv/4DVXFwsAloSTR2soM0iAjI S3y5vZYFxGYWqJdovvATLC4skCKx+dJzMJtFQFWif94PMJtXwEri1toV7BDL5CVmXvoOZnMK WEus+vCPFaJGUOLkzCdQM+UlmrfOZga5QUJgJYfEs+tv2SCaXSRm7ZgNdbWwxKvjW6CGykic ntzDAmFXSzy98RuquYVRon/nejaQBySAtvWdyQExmQU0Jdbv0ocod5TYdq2PEaKCT+LGW0GI E/gkJm2bzgwR5pXoaBOCqFaS2PnzCdRSCYnLTXOglnpInFqyn3kCo+IsJM/MQvLMLIS9CxiZ VzGKp5YW56anFhvmpZbrFSfmFpfmpesl5+duYgSmltP/jn/awTj31Ue9Q4xMHIyHGCU4mJVE eH8fNUwW4k1JrKxKLcqPLyrNSS0+xCjNwaIkzss2QytZSCA9sSQ1OzW1ILUIJsvEwSnVwOSe v/BAbUpW1dtk2afTuIq+LfTNn/v9U9PKih3ibv7vtfluvy0VePkrVe1KHfPDGaf/+ZcmtByb /eyD/mzzacKC8+6br3N0VE4IZVv8/eO/HzdfG7upfmxSY1hhYndyxRPv0Jj4t/l/Mmy9+/cd WRZmcj6lRPe7VsCSPpUPdv4Gs+LdIgNSThw5d6cpuz/JPPHxi+rYtMTovYl3NN4FPHD6mfXe LnuTkl7XprRp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TYfxWndGxh2csYISWdI Tje/ujgs8UiFj5Dsgr1Ly5jkXfYI1iUqK/zYvvGiEktxRqKhFnNRcSIA5xcQ2QoDAAA= X-CMS-MailID: 20220929074748eucas1p1145790d433b4f57cc9e9238df480091b X-Msg-Generator: CA X-RootMTR: 20220929074748eucas1p1145790d433b4f57cc9e9238df480091b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220929074748eucas1p1145790d433b4f57cc9e9238df480091b References: <20220929074745.103073-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The current implementation of blk_mq_plug() disables plugging for all operations that involves a transfer to the device as we just check if the last bit in op_is_write() function. Modify blk_mq_plug() to disable plugging only for REQ_OP_WRITE and REQ_OP_WRITE_ZEROS as they might require a zone lock. Suggested-by: Christoph Hellwig Suggested-by: Damien Le Moal Reviewed-by: Christoph Hellwig Signed-off-by: Pankaj Raghav Reviewed-by: Damien Le Moal Reviewed-by: Johannes Thumshirn --- block/blk-mq.h | 3 ++- block/blk-zoned.c | 9 +++------ include/linux/blkdev.h | 9 +++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.h b/block/blk-mq.h index 8ca453ac243d..0b2870839cdd 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -312,7 +312,8 @@ static inline void blk_mq_clear_mq_map(struct blk_mq_queue_map *qmap) static inline struct blk_plug *blk_mq_plug( struct bio *bio) { /* Zoned block device write operation case: do not plug the BIO */ - if (bdev_is_zoned(bio->bi_bdev) && op_is_write(bio_op(bio))) + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && + bdev_op_is_zoned_write(bio->bi_bdev, bio_op(bio))) return NULL; /* diff --git a/block/blk-zoned.c b/block/blk-zoned.c index a264621d4905..db829401d8d0 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -63,13 +63,10 @@ bool blk_req_needs_zone_write_lock(struct request *rq) if (!rq->q->disk->seq_zones_wlock) return false; - switch (req_op(rq)) { - case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE: + if (bdev_op_is_zoned_write(rq->q->disk->part0, req_op(rq))) return blk_rq_zone_is_seq(rq); - default: - return false; - } + + return false; } EXPORT_SYMBOL_GPL(blk_req_needs_zone_write_lock); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8038c5fbde40..74bc30c680d6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1300,6 +1300,15 @@ static inline bool bdev_is_zoned(struct block_device *bdev) return false; } +static inline bool bdev_op_is_zoned_write(struct block_device *bdev, + blk_opf_t op) +{ + if (!bdev_is_zoned(bdev)) + return false; + + return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES; +} + static inline sector_t bdev_zone_sectors(struct block_device *bdev) { struct request_queue *q = bdev_get_queue(bdev);