From patchwork Sat Oct 29 08:08:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403307 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 D8CB560587 for ; Sat, 29 Oct 2016 08:21:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C50BB28C7A for ; Sat, 29 Oct 2016 08:21:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8FCD29F83; Sat, 29 Oct 2016 08:21:33 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 75CA128C7A for ; Sat, 29 Oct 2016 08:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933311AbcJ2IP3 (ORCPT ); Sat, 29 Oct 2016 04:15:29 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33312 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S943136AbcJ2IPW (ORCPT ); Sat, 29 Oct 2016 04:15:22 -0400 Received: by mail-pf0-f193.google.com with SMTP id a136so3096pfa.0; Sat, 29 Oct 2016 01:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q5VdhUpAFaM80PW9xNOQ/f/xTuq7NH+Rur3K2S9QSXU=; b=hc1xz+9ujQ+AFwSVVaOWG1XPXFTkeqHojgKxOKZbfWbTbbfAUVOYHioobRR5I1t0Cs Vx/W8JTQ9Ia+skSx6EEheYv2ndXacrI4zNLz5HZcwV8Sd9ptJDWT0PkKr5iDbrq5HLyA fObrX6uMjBvN/Bmja6i29UYw+lZOeD/KPOJ0j13R8W2xdPkhMPAy1T0K+dst56kelwPr jUJhQdbuhFx2zBEEBRJuczN2VxBYM3ebu6ZUz0B65E18KlxqXQDcgs5Lkcj1KH7Q0gRC 2RvfIXSBO7lzkKhgM4TH3oDGhfiY2wt41oAZwI9fcQda9Jm/iTUKRFxQ5VpgwChWbIwZ 3NUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q5VdhUpAFaM80PW9xNOQ/f/xTuq7NH+Rur3K2S9QSXU=; b=l4EuFrJqPa1nUipW5bthJxm3oFx5j4vpr9u3WAN02YTFeep6QFcDwIS0ihP5MmqAI6 uJy3z6hGvLy0b7lpVTGcdbtb/q6NnY4r0ALI3usXHPwnFvZt1T7/E9BTt09jmZhPGaEI 0DF5cGQNxT79P4B0EPZ0EKW39CR/rXPfb+bsnyVB+BevljIsrGbTY9FbeRd9slPk+EBp L6irou8ZfWv9NWrmxK8Ul1ZsuuFdGtfSpDxu6eG+u4H/1sc6DAqlpB/KpQULdZBCC0RW mRFWbzu/3HoGs0ekkwNpriYbFwZy7UaA+YJOox2A6F9XuslyiE72XL/qc93V3HRqg072 MVsQ== X-Gm-Message-State: ABUngveSVcByGdMVQria6GVFfMya3g3fUM9AP4buMXQIrr3evyfPXVRd7kH/RarFaxlafQ== X-Received: by 10.99.101.65 with SMTP id z62mr26037411pgb.89.1477728922009; Sat, 29 Oct 2016 01:15:22 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id xs10sm23582232pac.24.2016.10.29.01.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:15:21 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Johannes Berg Subject: [PATCH 44/60] block: introduce bvec_for_each_sp_bvec() Date: Sat, 29 Oct 2016 16:08:43 +0800 Message-Id: <1477728600-12938-45-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-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 This helper can be used to iterate each singlepage bvec from one multipage bvec. Signed-off-by: Ming Lei --- include/linux/bvec.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index e12ce6bd63d7..510d1d2d79f1 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -191,4 +191,14 @@ static inline void bvec_iter_advance_mp(const struct bio_vec *bv, .bi_bvec_done = 0, \ } +#define __bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter, start) \ + for (iter = start, \ + (iter).bi_size = (mp_bvec)->bv_len; \ + (iter).bi_size && \ + ((sp_bvl = bvec_iter_bvec((mp_bvec), (iter))), 1); \ + bvec_iter_advance((mp_bvec), &(iter), (sp_bvl).bv_len)) + +#define bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter) \ + __bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter, BVEC_ITER_ALL_INIT) + #endif /* __LINUX_BVEC_ITER_H */