From patchwork Mon Apr 24 05:49:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 86857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2528808vqo; Sun, 23 Apr 2023 23:02:59 -0700 (PDT) X-Google-Smtp-Source: AKy350adjbfRWlVkRj/I427tX8RvjybQ1ZXk7Jat6xvcb6TA/kMX3cg6v9jR3cGmwbtm+qxcYqTo X-Received: by 2002:a05:6a20:4406:b0:f4:4ff5:11af with SMTP id ce6-20020a056a20440600b000f44ff511afmr4220200pzb.14.1682316178868; Sun, 23 Apr 2023 23:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682316178; cv=none; d=google.com; s=arc-20160816; b=W2fA0itcUqC/KMTb47FXpRjc4JIM+uJW6HO6fwQU1rppU5m7olxWlE7QtKBlJpcqUr k2rDF4ef7RDrqGdIkM2noSsY6utFWnUX2dDeTdWSHnFn/rr2tzqOKlc5pN5SsCnMu1rg Vw5SSczW7l3XfGkCndQ3+qLHrNAE0r+/d7SnEYpLJS2nhrE2s6mh6TBWObiLCDIO5tXA tnqeSEOJLSZCTVJnHSYI6cLdmB3W49VJdsKJrbkbJ/G9u3TBPoMPSxiiABKNfJHueE0U 4/ptJ6rg4dPxMoSMX/SJUsMM0EEzeMkyRNsYhxb6yxKqoNxlNzj22fwNJ9TOFIewoid0 IQ9g== 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=FmYSiKdP5y3EH7nBXTpf8bIFKknqbI4piiyOLlTcqUc=; b=qMR4vDg2exkSEYz0DACtqja1gbP7mOeeegO/IDrD2Uigsz30cu8NAuy/SEHRSIYBLl 8Lrn8usI+pDM4WzflqYU5sRs7RxFhsKJLMW4cuw16pRBzsX4T/nnCZ0Jp7DEPWh6cLQy i0e1I0P6aWCsRqf/83ZcOUgkT01OKd74RqCCDNpACbs9rm1kCb+J3FeycOpQSTd8UbVs ycIbv6kJxkeXze5i1FUis+h1XxmBcF2qoMtTOkqvKlWLDcg7LEOsSsfTcoTuGd3WIeNX OK9hRMf4Q7v3mO9u9X0NRb52ObJXcj2NoeeeAzsh1eFtnSX6Owhj75ui01kA4ijedPe7 U5Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=4lxlR6Bu; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a621b05000000b0063b8dcfdcdasi10282489pfb.37.2023.04.23.23.02.44; Sun, 23 Apr 2023 23:02:58 -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=@infradead.org header.s=bombadil.20210309 header.b=4lxlR6Bu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjDXFwB (ORCPT + 99 others); Mon, 24 Apr 2023 01:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjDXFvh (ORCPT ); Mon, 24 Apr 2023 01:51:37 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE29E44AE; Sun, 23 Apr 2023 22:50:25 -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=FmYSiKdP5y3EH7nBXTpf8bIFKknqbI4piiyOLlTcqUc=; b=4lxlR6BuJRIME1qgT/FLWEjLGd zZ93UA0UiVTZRciYnVz7BcBGh4qOlXvmDz+gYSX0gVpNssgkTRzVJ1F6XLACSvE58gCznare4IwV8 ONhbJNRO+Rb7AwP4E4aB6azTfv6WnFdtXg9Bd7cQuw7++D8vMUNKfCzGFlYk6+3rORK1s3nJno0oL 32gJ5Q9kRf7XT69Y0ns9Rw6WyLZWY36yGHyPSBD2vfFBjEti+pSoqjjyDRWgXT9qasHTXvq32XIhk aJhmCTOwekv9gG2uQmpUAPoElchnnj2w2DJgfRMI4gQ/+nTFeSLo60MajiM9lIGCzDORORrebRpsQ vbf3q+Zg==; Received: from [2001:4bb8:189:a74f:e8a5:5f73:6d2:23b8] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pqp5U-00FP8b-21; Mon, 24 Apr 2023 05:50:09 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Miklos Szeredi , "Darrick J. Wong" , Andrew Morton , David Howells , Matthew Wilcox , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/17] block: don't plug in blkdev_write_iter Date: Mon, 24 Apr 2023 07:49:22 +0200 Message-Id: <20230424054926.26927-14-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424054926.26927-1-hch@lst.de> References: <20230424054926.26927-1-hch@lst.de> MIME-Version: 1.0 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764036369265794382?= X-GMAIL-MSGID: =?utf-8?q?1764036369265794382?= Remove the no needed plug in blkdev_write_iter. For direct I/O that issues more than a single I/O, the plug is already done in __blkdev_direct_IO, and for synchronous buffered writes, the plug is done in writeback_inodes_wb / wb_writeback, while for the other cases a plug doesn't make sense. Signed-off-by: Christoph Hellwig --- block/fops.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/fops.c b/block/fops.c index c194939b851cfb..b670aa7c5bb745 100644 --- a/block/fops.c +++ b/block/fops.c @@ -520,7 +520,6 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) struct block_device *bdev = iocb->ki_filp->private_data; struct inode *bd_inode = bdev->bd_inode; loff_t size = bdev_nr_bytes(bdev); - struct blk_plug plug; size_t shorted = 0; ssize_t ret; @@ -545,12 +544,10 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) iov_iter_truncate(from, size); } - blk_start_plug(&plug); ret = __generic_file_write_iter(iocb, from); if (ret > 0) ret = generic_write_sync(iocb, ret); iov_iter_reexpand(from, iov_iter_count(from) + shorted); - blk_finish_plug(&plug); return ret; }