Message ID | 20181121032327.8434-12-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0CF713BB for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 21 Nov 2018 03:27:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1B32B40C for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 21 Nov 2018 03:27:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3312B412; Wed, 21 Nov 2018 03:27:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 687E12B415 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 21 Nov 2018 03:27:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 962916B23A8; Tue, 20 Nov 2018 22:27:33 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 913116B23AA; Tue, 20 Nov 2018 22:27:33 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 803D66B23AB; Tue, 20 Nov 2018 22:27:33 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id 4F3BE6B23A8 for <linux-mm@kvack.org>; Tue, 20 Nov 2018 22:27:33 -0500 (EST) Received: by mail-qt1-f200.google.com with SMTP id m37so2188054qte.10 for <linux-mm@kvack.org>; Tue, 20 Nov 2018 19:27:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=IlLTWLk28CoX+iGvEA9mJmelkxne3MUdqKGOcV+1Va4=; b=kqkTKKUpw9oFqVGwUzCrIVxR6yzPlFj1c41+LIBHfInHwQj0nkJVtVRsakNNw6dyje oW34kQiM+mpt/c0Su8IOpU9Vp3D7UOqf8hOkESG3TzftDEv62lRjMA4SyJNIV5umK0IG SfNhtyMYsoSIgGx5PS3YjfuhH0LXZ3kJJEpamq8skjdHwSZATLcgcFKFIbnZxB3XeBfn GxBZ5xzfAlk3ePvLqKlFlZGV/Wd4Oa4ZSnX7kJd0nbq1B7szUJ866fph6LCGrdHjRrWz iIkn03LE+o+N1Y7titAi3lAemWOrno8+ukfFFAHkBKYhwW0hCSmdBpzIbFI81jCb1Ftf GlPA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AA+aEWYdTzcxmCapAf3Bs36jf0JbX9XpoHSZOv7UJxX73rSOtJnHTBuy 5/8Elg3I3RKAC8fnUiP6mpFjbftPur8a0ZWlNQuttwlEm+8utRGs8lex8emG/QHI3QS1awpmhad 1TRWiLXGLS3wMusMF8wwVW/zFhFkFVzjPz6JoERXsQPVH2RIye1/CHOrfMyxiPbWs1g== X-Received: by 2002:a05:6214:110e:: with SMTP id e14mr4449092qvs.10.1542770853106; Tue, 20 Nov 2018 19:27:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/VXEDwy/dxNModoxIVmRAM25cEq4p26uanfjHVh/DgNpGwoMG5CgASoJzKAq+JfFHmAs70q X-Received: by 2002:a05:6214:110e:: with SMTP id e14mr4449076qvs.10.1542770852556; Tue, 20 Nov 2018 19:27:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770852; cv=none; d=google.com; s=arc-20160816; b=aqMC6HHwi2KCSwWWJ2WeyCKldRGZel5bzvrEz1+WT20zO3U5N8UQfX+DDW29WwtBXX m3SAYU8JANXXExoDzAN+B7PYKhky97IuVrGti6l21sjJwEkJ8o1Es5M7tTe+/GpmQAKq gBZrLhVeA7qFgZep9BVMHO0MV3yqGGV/SQCdxxV4815ZxcUIOsWpVNhHblSBwIsTkaJc A8yXmumruCUVaNAUAktyA/CzDnLf/74bdGvZ7fJY4PZhamgpcaiNQTzqC9YGjfBAQFUe Ep5jlqfvfXX079wQsQZftp1RFmCeuwvokwiYEuFA71DzaUTgURglbsfluvErl1HjcwIa 1xXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=IlLTWLk28CoX+iGvEA9mJmelkxne3MUdqKGOcV+1Va4=; b=Qx6dofAg10f5jB9chGepngBHtCzXDEucJlj/nozvLJ/ncKObMyE4/4Zn9uaU3+9AiH +Csdctu8hvCPrlwoHs7wQJhkVltzbsDxhAiGX+SyEeHr8BZ4LJa5Z9QpHYGskEA64Pwi CDeAET2W3Ac3uGoxmZx1PSAp8QW3DWGyg1flvg2IYL2RD81ZeGIGgWNTHzAdc+ZjwOia d8ZaHN10y/bBT9e9l/GOaXfPPxX/lG8p6YBzJ1p/zIzoRqqPI548qbOiVNbubpNI95Gd G0AQ+k0VGsxKD9GmsqgiOteFQirha4Fr5VNcUZSwnePmi78ABekFVavIwCq/rms7vipr SLUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id o14si9123169qtb.200.2018.11.20.19.27.32 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 19:27:32 -0800 (PST) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71CCD637FC; Wed, 21 Nov 2018 03:27:31 +0000 (UTC) Received: from localhost (ovpn-8-21.pek2.redhat.com [10.72.8.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAA9D60BF6; Wed, 21 Nov 2018 03:27:18 +0000 (UTC) From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk> Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o <tytso@mit.edu>, Omar Sandoval <osandov@fb.com>, Sagi Grimberg <sagi@grimberg.me>, Dave Chinner <dchinner@redhat.com>, Kent Overstreet <kent.overstreet@gmail.com>, Mike Snitzer <snitzer@redhat.com>, dm-devel@redhat.com, Alexander Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org, Shaohua Li <shli@kernel.org>, linux-raid@vger.kernel.org, David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org, "Darrick J . Wong" <darrick.wong@oracle.com>, linux-xfs@vger.kernel.org, Gao Xiang <gaoxiang25@huawei.com>, Christoph Hellwig <hch@lst.de>, linux-ext4@vger.kernel.org, Coly Li <colyli@suse.de>, linux-bcache@vger.kernel.org, Boaz Harrosh <ooo@electrozaur.com>, Bob Peterson <rpeterso@redhat.com>, cluster-devel@redhat.com, Ming Lei <ming.lei@redhat.com> Subject: [PATCH V11 11/19] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Date: Wed, 21 Nov 2018 11:23:19 +0800 Message-Id: <20181121032327.8434-12-ming.lei@redhat.com> In-Reply-To: <20181121032327.8434-1-ming.lei@redhat.com> References: <20181121032327.8434-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 21 Nov 2018 03:27:31 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
block: support multi-page bvec
|
expand
|
On Wed, Nov 21, 2018 at 11:23:19AM +0800, Ming Lei wrote: > bch_bio_alloc_pages() is always called on one new bio, so it is safe > to access the bvec table directly. Given it is the only kind of this > case, open code the bvec table access since bio_for_each_segment_all() > will be changed to support for iterating over multipage bvec. Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index 20eddeac1531..62fb917f7a4f 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -270,7 +270,11 @@ int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask) int i; struct bio_vec *bv; - bio_for_each_segment_all(bv, bio, i) { + /* + * This is called on freshly new bio, so it is safe to access the + * bvec table directly. + */ + for (i = 0, bv = bio->bi_io_vec; i < bio->bi_vcnt; bv++, i++) { bv->bv_page = alloc_page(gfp_mask); if (!bv->bv_page) { while (--bv >= bio->bi_io_vec)