From patchwork Thu Feb 16 11:45:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9576965 Return-Path: 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 A87DE600C5 for ; Thu, 16 Feb 2017 11:52:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A485126E81 for ; Thu, 16 Feb 2017 11:52:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 964CC27F94; Thu, 16 Feb 2017 11:52:09 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604B526E81 for ; Thu, 16 Feb 2017 11:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754420AbdBPLqM (ORCPT ); Thu, 16 Feb 2017 06:46:12 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34278 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753434AbdBPLqK (ORCPT ); Thu, 16 Feb 2017 06:46:10 -0500 Received: by mail-pg0-f67.google.com with SMTP id v184so1827078pgv.1; Thu, 16 Feb 2017 03:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IAOdUyqWUTzp0y8Hil6KzM8fuoDVXDv7iEjQd89SkHI=; b=ucU82mim2wQaia1cdegfPz9I3x0KHGyGuhYQvzujV0uZ1X0wvHhmAKj2ZRrrcMDTGw /n5TwWaT8C7A+BlZYIZDgaz5udYnZetekIlyOTKe4yQkzVvoebS4AtFeGZx+WIlWE0ra SD66p8Ss31C9v5gxT9LCyNvHi7WZtEKoNqeECjQXquFoxPTQboSea3mw+FI9YikD+v11 x2Yy+SNxH8oWXS3+7JwLFq+4oTVVZBtXypfG8fox73x8k60yxKImpjqdjRohruie8/K2 VyNao/VKftDWwXv5UeVDsfot50BWq1GOuJdCU5wSdEYlWsQkCURqEjD0EDnGKFoCDd80 VEbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IAOdUyqWUTzp0y8Hil6KzM8fuoDVXDv7iEjQd89SkHI=; b=FKTyTh5l1xadCZfE0AXPXUY4Dd2pPTfu7M/3cGKVnenFYXGVNwhkxMblOfhoJ3Ug/Q PO+mQ2R5b9TtihxjOMZabO39inkkXEG9QmOt54Dkk8BEIxkeFk0OHuB6tkxN0N75Bla7 fXnOwklS+d78/pCTuxP/XXxnJAHpTxBsCRB//6OujfcI1jaPaHkyw83Oe+hd4+GKICIv ALCl0CYRPS1WMTg/vSXORQWtVA04QQPOAAT/dmpj1mc0rdjOI0+Ji3L5+L1wvRiD7oc1 3sJxu7T13vjvsdSuAkSLE29roBSJojUKq/fBWcblHz8QqORuJZAB113rw0QRIQPOj54X K+hQ== X-Gm-Message-State: AMke39k0AN+uIoZEYv2zZlb9t4GXrfmjAVRJgtA54gVXiolRS5n5R6X+4U/LLb7HCCmZWA== X-Received: by 10.98.159.141 with SMTP id v13mr2171739pfk.50.1487245569378; Thu, 16 Feb 2017 03:46:09 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id 88sm13314053pfr.41.2017.02.16.03.46.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 03:46:08 -0800 (PST) From: Ming Lei To: Shaohua Li , Jens Axboe , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , NeilBrown Cc: Ming Lei Subject: [PATCH 01/17] block: introduce bio_segments_all() Date: Thu, 16 Feb 2017 19:45:31 +0800 Message-Id: <1487245547-24384-2-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487245547-24384-1-git-send-email-tom.leiming@gmail.com> References: <1487245547-24384-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP So that we can replace the direct access to .bi_vcnt. Signed-off-by: Ming Lei --- include/linux/bio.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/bio.h b/include/linux/bio.h index 8e521194f6fc..3364b3ed90e7 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -293,6 +293,13 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv) bv->bv_len = iter.bi_bvec_done; } +static inline unsigned bio_segments_all(struct bio *bio) +{ + WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); + + return bio->bi_vcnt; +} + enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */