From patchwork Tue Feb 28 15:41: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: 9596047 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 A42C8601D7 for ; Tue, 28 Feb 2017 15:42:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 950B828534 for ; Tue, 28 Feb 2017 15:42:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89EC32853A; Tue, 28 Feb 2017 15:42:29 +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=ham 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 2D75028534 for ; Tue, 28 Feb 2017 15:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbdB1Pm1 (ORCPT ); Tue, 28 Feb 2017 10:42:27 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35114 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbdB1PmU (ORCPT ); Tue, 28 Feb 2017 10:42:20 -0500 Received: by mail-pg0-f65.google.com with SMTP id 1so1987166pgz.2; Tue, 28 Feb 2017 07:42:07 -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=R9eoCr0/nKK82J9GZFAqlHQnwGQWLrItn2E7Il2m9XNJu0uLiMvXnpi6xuOELqkV1J 7puV7Jhjw1NwjBivhq5JjeXvKWvDGmVEID89zhH93QhbbH9hzAb8bW0lxazkGrjkvGNb e2com6SpTYNLBzzN0N3ENp2M0EnoEN3CwRNowR7yVqmrBo/VVXbyvJTANBOT+hjSpLVP u7xuFGJWMztQJx+ITNpJMQjpa5Nq85VnsgjaCiZx0QucMucvt17EzzOXimJBR4ONePFf XAALmkRZ2kHf7Fna+RqXGMdQtJV9HfKWina2MeZfD5j/jOA/iesYArkZVFWZjqbUqWv5 VD5Q== 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=V/qry6iAjzEssy/90VHY5fXW61eiqrLYlmLxvyhz3/LcUSoJdLN2JKb15UeO1jmcq5 4Z10hTPTK8c6mxMIaZSmCTvQzqE5Wtag2aHY1OpkKk6xRXN5iWQhvMJkR1iWSJUwWP8s LBugyARepZSZaX8hz5oJCtm8rlFV1xL3S79rykg5Xjom6IM1cOp8oUTOLLGAo6vAsN2h n4vOPqS84M5YE5u8YHbx/D+ev78RyGk+qzERkKMvOxVqT7p3GMLmECVVFaNzo8cR5pVa zbcPYfCfcBcqe1/JLirWmBbdF38l8YKIl/RqRg6IIrsCcFCO692Trofs43x19aWcZife pmPg== X-Gm-Message-State: AMke39lDHgotLFHwXIm1bRDK99gOcloiciIbxjwOpdG5CGi1G1RPZN11C7SHgaQxwWSj/A== X-Received: by 10.98.56.2 with SMTP id f2mr3243706pfa.130.1488296526624; Tue, 28 Feb 2017 07:42:06 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id f3sm5089950pfd.10.2017.02.28.07.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 07:42:05 -0800 (PST) From: Ming Lei To: Shaohua Li , Jens Axboe , linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig Cc: Ming Lei Subject: [PATCH v2 01/13] block: introduce bio_segments_all() Date: Tue, 28 Feb 2017 23:41:31 +0800 Message-Id: <1488296503-4987-2-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488296503-4987-1-git-send-email-tom.leiming@gmail.com> References: <1488296503-4987-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 */