Message ID | 20180525034621.31147-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.web.codeaurora.org (Postfix) with ESMTP id BFB96602D8 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 25 May 2018 03:48:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF66A2942D for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 25 May 2018 03:48:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3934295A1; Fri, 25 May 2018 03:48:59 +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=ham 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 32E0C2942D for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 25 May 2018 03:48:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 262646B02A0; Thu, 24 May 2018 23:48:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 212316B02A2; Thu, 24 May 2018 23:48:58 -0400 (EDT) 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 101296B02A3; Thu, 24 May 2018 23:48:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id DA8986B02A0 for <linux-mm@kvack.org>; Thu, 24 May 2018 23:48:57 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id m7-v6so2924581qtg.1 for <linux-mm@kvack.org>; Thu, 24 May 2018 20:48:57 -0700 (PDT) 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=g1Nce4EVHoE7GDykqgSfVWgzqZfe5XWTufisBuK1Lhw=; b=jVa6tbDGKH60xCRo3Jw90DLAXiFSQDeGvWSAg6QHcJvAeZ57lunPNsdhSm0fYIjpBj VJZLUTFvla8q1Y5U4Hg26Db4xEhdvMluSoFGVohd/NmIAeRUmTLAxKacGRLB9OViTR84 eR4OsOpwxxgGoovshNDaesTRBGMqgDYsXo/mSbawDzrdO1t/i+VAqfDSo2OBVbI56uVR qcknQkSRIsLdocWXvWg1CluXLsUlhOzguKluPt1poTQINda1AhbHvASISPsUDHPIHi21 EyJQr6QE2sVWg9Ez1FBu+PaBbl89245DzKSOWDQVHkTFJC4Xl5cX+gkiZFb7jB5l6kgx GA3Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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: ALKqPwdjEG8VVuRocUHQ4cFMabQ3EBwt8Kj5vNp0A1N1wH29vDpYVBFB LEpbwPJAjIavLCoqJqiN3dH4xP+7FzyKmFSPwueNfAWcQfIa9xlszaiE/abVYNkETdkJpwDuMg+ 2lvEUMamaLoV6sSqyixztoWqI5CRB/k1AWt2KS71KN+JBv+vocw4LD5jkjqSzQxlFiA== X-Received: by 2002:a0c:f78a:: with SMTP id s10-v6mr618717qvn.180.1527220137697; Thu, 24 May 2018 20:48:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJN8tA1cGqXs0aeBsB64Ome7ZjDY8aselUYsDo8MF558efEqyn55IXDRgP1kE6PxYY019ee X-Received: by 2002:a0c:f78a:: with SMTP id s10-v6mr618707qvn.180.1527220137244; Thu, 24 May 2018 20:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220137; cv=none; d=google.com; s=arc-20160816; b=M1Vx1Us4COaFFRQF/cNuqMe0uS849hdN+805jKOngCqpNmO7e9LysP0bUhPP4YWzhb t0/YS34GdV6dxC5rTioWm/hgUChg8qsuKtqRf4gV4FMTR4JwruGYpfJWfug2xzlhTMXq 4slS4kzDAjCkj8sMT+dcV0g8Y/lO5EUpyCxNnMtAPpU2f0KNwFmPY53NOiq/d2dhbfbY MsSto0L4rT42kjeAF+w9q08EezjOvjnYBVdqSTYaLo45qd8YFgG5bg7KJQmNtqsKDbBy s7gphttCTo30muf0Ji3/ARY/zIyfdPJctTqZPGlZrny3FG2RWk6k602zEQhSJ0YKn9oe 4Aug== 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 :arc-authentication-results; bh=g1Nce4EVHoE7GDykqgSfVWgzqZfe5XWTufisBuK1Lhw=; b=Cuv/9FfnURo4gNSw34dZA4jX2ynGSWpUfg2tmhM7krk+SZgJGOyTpx3nHLoP6HYQ/A 7IVEVXYXi/1o9Ak5LCXAOvQ52JERCtUPmd6mTuIotPEAzRh7wap80LwNHAcLI5xK+gpO GmePWg3vN0KIX3WsIlxbDUjB+qVQan3Tu2YT76MW/A3QSrvO6pToYhHLsCwVLkdWbbrH jBkz51jZYFFmwU+2F0IbyGp+TOGVDhUkaOw1XPXNiptHzGyJu7UBA3wgOu95mzEEgeeI a0rLTgPf4AHbt93Xsov8O+3Q92SNiK3nOa3g0jNjH1QsSE42YqgxJkfHA43YIFBHPpeb BJlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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 (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id z60-v6si523950qvz.49.2018.05.24.20.48.57 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 20:48:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFE43401EF03; Fri, 25 May 2018 03:48:56 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AABBE2166BB2; Fri, 25 May 2018 03:48:48 +0000 (UTC) From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@infradead.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Kent Overstreet <kent.overstreet@gmail.com> Cc: David Sterba <dsterba@suse.cz>, Huang Ying <ying.huang@intel.com>, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o <tytso@mit.edu>, "Darrick J . Wong" <darrick.wong@oracle.com>, Coly Li <colyli@suse.de>, Filipe Manana <fdmanana@gmail.com>, Ming Lei <ming.lei@redhat.com> Subject: [RESEND PATCH V5 11/33] block: implement bio_pages_all() via bio_for_each_page_all() Date: Fri, 25 May 2018 11:45:59 +0800 Message-Id: <20180525034621.31147-12-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:48:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:48:56 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' 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 |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 3d3795b9a353..08af9272687f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -334,8 +334,14 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv) static inline unsigned bio_pages_all(struct bio *bio) { + unsigned i; + struct bio_vec *bv; + WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); - return bio->bi_vcnt; + + bio_for_each_page_all(bv, bio, i) + ; + return i; } static inline struct bio_vec *bio_first_bvec_all(struct bio *bio)
As multipage bvec will be enabled soon, bio->bi_vcnt isn't same with page count in the bio any more, so use bio_for_each_page_all() to compute the number. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- include/linux/bio.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)