Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp28055pxb; Wed, 27 Jan 2021 00:50:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNbk/CK1pjC0wcNzhArpkT5EsrIiOSHhhb/iQtc4Ti8FI3QV6ksEDGdbfVhwE3hQFuwYiD X-Received: by 2002:a17:906:1f45:: with SMTP id d5mr6187182ejk.76.1611737455458; Wed, 27 Jan 2021 00:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611737455; cv=none; d=google.com; s=arc-20160816; b=KsZzDu/Y5iNvFiJUc4LNydmN8Tdz8vMYm3wAcJ4WpSu4R9tBl09Kxip/IKY7kYUSqZ ZqUA1DGVVWQWQ833qGPdrxTsha6raIlAAeEVT0OFgCk9GKlP6vjbykqJW35iQF0aS/E6 F+UCg4wedQTGF5LnnePOtw/6VeX0DyqrSsvkhJt/m3uAOR958hHNDG76GYnxSVmdK8Iy xZbmAhzFOLE8UYssXHGRdRWi/zZeewrQIm0aG8bw5U1sTyIBtrdLRL0DTEVNjyOmt8tV MSvLbaxabvbP16Xn2VygMLDdm2Ri1c3S5FZe8g1P6eFjiz8g/zf+ULyKROZsZgJaMNJZ se3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=F7WOzbHYieYbjVRWFhSaBjp7IQ9GHp5JECpzQk1IYxs=; b=tzjdrx1y3M8mvDu5ulS4BmPGfDM+Eq1CS/+wtYMZpPrik5zv9mMxcRQJT1LqzVZw5z 6Q3QQZZ4AVWrUplQmgrED7p717wJetm8kjOsSB8MRwIxUM2B8BC+d7IIoObaFZTcJTpe P6l/aFQLxA8QCkUrhfRyKJJgWOtI6LwTNlt2lfOHFKeTf4hPxD16QS0p3AWaPiHKUAVm 14Qzohqu6QCXKt2HYxq2CGDEwXx0n1evfjk27VYPdfGNMUk712dIJflnkx48xgDNPtSC 9w6WiU1bDJy6mbjXAoZy6/K+0WaV11OHCK30yu19Rj1lb3m9OZCyuY1ACMWqgLDbfgSs Pmzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oDBiPqUD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw2si549595ejb.264.2021.01.27.00.50.31; Wed, 27 Jan 2021 00:50:55 -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=@kernel.org header.s=k20201202 header.b=oDBiPqUD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233937AbhA0HZF (ORCPT + 99 others); Wed, 27 Jan 2021 02:25:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:48468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233822AbhA0HWz (ORCPT ); Wed, 27 Jan 2021 02:22:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F3FC2074F; Wed, 27 Jan 2021 07:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611732134; bh=UmXZ4WGct5TD5g2zWBqeUZIY7+IEh1H1mojHQndD4p0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oDBiPqUDddARVPP8esIP80QkXjEj9+85T5QDZeh7nu2cYyt+eQZA8QDXikjpMwlat MNfPUAT8hEpYvyQzrx6AP5DR+ANmDLKNYdk+3I1Le4ClABg804A6YrqVAha+HDnXt3 aXXje54ZXGe396yLREjvTO7F28tQlsy1EwE9vIS6460xIuuh3AzToqKFH1MkXqxaCP /NJx/3JofqwPazejWSqyqiZGHT+4SBSDqNllnI/Q9rYdu+otPvNjz6i73xOtGWI2Ql 1f8AcHX5BqzHDL4QaB+j75p6mcXxGRjds0fAREsI+L/1LEC6UF0JYg2RbF8i9aAb9k jpAFtWZcqE2ig== Received: by mail-lf1-f44.google.com with SMTP id m22so1260324lfg.5; Tue, 26 Jan 2021 23:22:14 -0800 (PST) X-Gm-Message-State: AOAM5303XuknvkR3/10+dIV7QrBQc2plCURRi7nKrpFEWPMcqPAmjyaC WD/vu16cWM6W4HQFjxBvgfpHjbV7YZ7NAQJ19hQ= X-Received: by 2002:a05:6512:5c6:: with SMTP id o6mr4374679lfo.281.1611732132634; Tue, 26 Jan 2021 23:22:12 -0800 (PST) MIME-Version: 1.0 References: <20210126145247.1964410-1-hch@lst.de> <20210126145247.1964410-13-hch@lst.de> In-Reply-To: <20210126145247.1964410-13-hch@lst.de> From: Song Liu Date: Tue, 26 Jan 2021 23:22:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 12/17] md: simplify sync_page_io To: Christoph Hellwig Cc: Jens Axboe , 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 , Linux-Fsdevel , linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, Linux-MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Jan 26, 2021 at 7:14 AM Christoph Hellwig wrote: > > Use an on-stack bio and biovec for the single page synchronous I/O. > > Signed-off-by: Christoph Hellwig Acked-by: Song Liu > --- > 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 >