Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3893091pxb; Tue, 26 Jan 2021 07:21:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdXjwEWIIFcDSfhKX6PUQrp4T75sZcCAdAVIPhrgVdb40mR2pSiSov77ImBuZXXF0MsSqe X-Received: by 2002:a17:906:49c2:: with SMTP id w2mr3649787ejv.12.1611674488068; Tue, 26 Jan 2021 07:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611674488; cv=none; d=google.com; s=arc-20160816; b=qGS0+lPvags5ZVvt7wJZLrA9LkRjhMtMSr2djmANq1CuWXF/Eu0YORGyeX3oWrgPTL cIOSvHoewqlQfCE+mgpI78mWAJZp7vznY8NHrt9Um7sGaV8ecDUHOwuaAYuMCLfArFHg pq/lA9J57HjAV0KrvWIaPsOS3a9TWoAiN0Hi+6CtyFI0yhX/jkptW3Nwj/0cSvoP4dfV uLiydDVDTcyzW5PgWOf9sOBlWr9CCMskjMY/7o0KMa9wM9BxtATeIX2x/YJqUrmY4gOT Kth2XD2bLhQ2sm0/r5Tg/tmWcUNaiXFazO8kshnw3Msna/H7thkChnokm3tc8ekUpFcl 1qiw== 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=W8aYaHALoHXbZuaFOXKQTvVh+y8Fd7IAvJYrZZoNhdA=; b=yTSvXUmnIBndcekaDQJCL3PCDD1hOdYH39rFgvP/S8QqoqjXjqBY8AapF1rW16z834 S58WtUJETujJtlsSwTolc7ONK0D6JO87C3deBOwTnseAEL3kufwX9a8lQvhfR/jzp/Za Ak2A+oAVj50OsnJIU/nXWDdAvxvJkkib5dJqI3KuixkiAztPCSwTwtdlYzLaPB31qMXt PiF1/ku9kb4/bXHO2MjtWBBYL3LV+0qfKCb5B96AcZ3lpPBKc1V18lTV5TAiU4b6QoFc CvwjVTNZT78UBTIgzUHDzkY/oWZNgiwy5mAcChtoCg8vROqZsKmPHYZOi2ukuMf6INoE vyZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JGt1JH63; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si7184352ejq.441.2021.01.26.07.20.48; Tue, 26 Jan 2021 07:21:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JGt1JH63; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406252AbhAZPTI (ORCPT + 99 others); Tue, 26 Jan 2021 10:19:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406211AbhAZPTD (ORCPT ); Tue, 26 Jan 2021 10:19:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8631AC061A29; Tue, 26 Jan 2021 07:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=W8aYaHALoHXbZuaFOXKQTvVh+y8Fd7IAvJYrZZoNhdA=; b=JGt1JH63w8eiaQAEI4n5kVSxVw Yb98hQCjj4BuRaFELXNV4V1YWR5whaTFBuvsbS38JX90ZmqkewzosVaccIltP0wA2PaXodrpLDpB2 dSjrXAgSsWvpd2IUnGUtb9AYtQSvL35vq7Nk0hrDytjnDJgyME8PkByHiOhSAl9mtgqEmnzC6m+1a 27nBnbSxYEnE4x0UzJcki15gkshb+GwSUKKI0Oto59KylHdpnaNOwDbNnn+gdjEjJTFJ/NFEbW1sE 0TONqXtHBo84FuLa/h+/kr81vIkdUY2Vm7qMY41RhMKFBZje5JtOQrBJAVRfoZsXINuN6WnyqR5mx 9qSFgATA==; Received: from [2001:4bb8:191:e347:5918:ac86:61cb:8801] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l4Q1A-005nvT-6a; Tue, 26 Jan 2021 15:13:04 +0000 From: Christoph Hellwig To: Jens Axboe , Song Liu Cc: Jaegeuk Kim , Chao Yu , Philipp Reisner , Lars Ellenberg , Coly Li , Mike Snitzer , Josef Bacik , David Sterba , Damien Le Moal , Naohiro Aota , Andrew Morton , Ryusuke Konishi , linux-nilfs@vger.kernel.org, dm-devel@redhat.com, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/17] md: simplify sync_page_io Date: Tue, 26 Jan 2021 15:52:42 +0100 Message-Id: <20210126145247.1964410-13-hch@lst.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126145247.1964410-1-hch@lst.de> References: <20210126145247.1964410-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Use an on-stack bio and biovec for the single page synchronous I/O. Signed-off-by: Christoph Hellwig --- drivers/md/md.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index e2b9dbb6e888f6..6a27f52007c871 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1021,29 +1021,29 @@ int md_super_wait(struct mddev *mddev) int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, int op, int op_flags, bool metadata_op) { - struct bio *bio = md_bio_alloc_sync(rdev->mddev); - int ret; + struct bio bio; + struct bio_vec bvec; + + bio_init(&bio, &bvec, 1); if (metadata_op && rdev->meta_bdev) - bio_set_dev(bio, rdev->meta_bdev); + bio_set_dev(&bio, rdev->meta_bdev); else - bio_set_dev(bio, rdev->bdev); - bio_set_op_attrs(bio, op, op_flags); + bio_set_dev(&bio, rdev->bdev); + bio.bi_opf = op | op_flags; if (metadata_op) - bio->bi_iter.bi_sector = sector + rdev->sb_start; + bio.bi_iter.bi_sector = sector + rdev->sb_start; else if (rdev->mddev->reshape_position != MaxSector && (rdev->mddev->reshape_backwards == (sector >= rdev->mddev->reshape_position))) - bio->bi_iter.bi_sector = sector + rdev->new_data_offset; + bio.bi_iter.bi_sector = sector + rdev->new_data_offset; else - bio->bi_iter.bi_sector = sector + rdev->data_offset; - bio_add_page(bio, page, size, 0); + bio.bi_iter.bi_sector = sector + rdev->data_offset; + bio_add_page(&bio, page, size, 0); - submit_bio_wait(bio); + submit_bio_wait(&bio); - ret = !bio->bi_status; - bio_put(bio); - return ret; + return !bio.bi_status; } EXPORT_SYMBOL_GPL(sync_page_io); -- 2.29.2