From patchwork Fri Feb 24 15:42:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9590599 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 1725160578 for ; Fri, 24 Feb 2017 15:48:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B9F022BF1 for ; Fri, 24 Feb 2017 15:48:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 009C5286CC; Fri, 24 Feb 2017 15:48:19 +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 A3A9F28687 for ; Fri, 24 Feb 2017 15:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751593AbdBXPoO (ORCPT ); Fri, 24 Feb 2017 10:44:14 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34449 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbdBXPnN (ORCPT ); Fri, 24 Feb 2017 10:43:13 -0500 Received: by mail-pf0-f193.google.com with SMTP id o64so1167718pfb.1; Fri, 24 Feb 2017 07:43:12 -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=r8giWUhwMxfBuMFR6b7i1K5yuj8CQ6bxYlvlZg/z97uzZE3HxF7JcUXLRRrvrS6h98 AuSWrdJ98VUyW2mskI8RLPhRh60vd1VnXFQH62cyxr8Ge8TsP4WzN6bUDF0uxPP4MHwH tEwhb53kdHVmXLa1SFupUEcC1GU24A+fM9b6jMUFYTebjjn8Us5GVTZpfTHFCeJONZXw HCRHCKbFQCgRUOI0DS6TtAO78oEbGVVFJOWmd9Abcx964rho1iIYp9/MFiY5yDhyuEMA el28Sch1L6TP6wm2Qtao7IHnGF+4+yRiJmhVHS2BtQmbO5FxuwrEOiY4uKXeGbnk4AMX nlwQ== 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=VH5dR2GoJrdgxF8DgLaZGRheavhOUEsxIHgmFESgdynubCyR5Bm6vVXODAyP07OsZp 88o0ofW9O9IEP+eeAygLVXugNPaIGzr3a4pkgemtKWMJfAbdILAH+LwPZ/anKDIrENmn VEFtWD8s4oon8W1XWnZ2XXXa3mGCVW538HG9NhZo13dsA/Xqw/QeF3NWxs92GVHrAegp hQJRwMwAsK70MB2AWlfLx46UFWNz3QS46g19Szz3OGw2m4EOaeof8KEIPuddTcHNW1+u lreaeB7t50nVNM8wq+klBBAJ6CfsRvqvaW6TuDiXx2D9BkxLg835LJsV3/JbjOYzk6UI X6dQ== X-Gm-Message-State: AMke39mgCt0ZYGEHRwV94YthkpImBwk5RUr2COxNWN5P0IxQo+ol1jNbBLLZ0jz96yeMjA== X-Received: by 10.98.104.4 with SMTP id d4mr4275412pfc.2.1487950992028; Fri, 24 Feb 2017 07:43:12 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id b77sm4295778pfl.2.2017.02.24.07.43.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 07:43:11 -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 Cc: Ming Lei Subject: [PATCH v1 01/14] block: introduce bio_segments_all() Date: Fri, 24 Feb 2017 23:42:38 +0800 Message-Id: <1487950971-1131-2-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487950971-1131-1-git-send-email-tom.leiming@gmail.com> References: <1487950971-1131-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 */