From patchwork Wed May 3 10:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 13230023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C190C77B75 for ; Wed, 3 May 2023 10:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229595AbjECKZs (ORCPT ); Wed, 3 May 2023 06:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjECKZs (ORCPT ); Wed, 3 May 2023 06:25:48 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF86F35A6 for ; Wed, 3 May 2023 03:25:45 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230503102544epoutp01ef714706a49815b25f1d41575097e60a~bmzaHO_wR2995129951epoutp01P for ; Wed, 3 May 2023 10:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230503102544epoutp01ef714706a49815b25f1d41575097e60a~bmzaHO_wR2995129951epoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109544; bh=Qu9Yx8AHfpqjx58Hv8uRZKjzvr/nHdB5F0/a51oGkO8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=MsXLWRzSWTXLUHxXqBeStKoWzjkGL85pXYRwZ6bTcsezk1Lwlk04RJfZcSpj76Oa5 CoFZ4hrb8sVi/9cZHNo02L3lummecQv1Od8Shdnkxn2AhGV5JrYnwLn9cdxScmOFlg ljaG5uQukl8GbPks/Ug+CrtV5HhPxHAPhQZz27dU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230503102543epcas2p2ca5917ded82f913c41eaf6e72457d945~bmzZgxulP0035600356epcas2p2h; Wed, 3 May 2023 10:25:43 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.90]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBClB6HYFz4x9Q5; Wed, 3 May 2023 10:25:42 +0000 (GMT) X-AuditID: b6c32a46-8b7ff7000001438d-29-645236a6590e Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id D9.88.17293.6A632546; Wed, 3 May 2023 19:25:42 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 13/15] block: add helper function for iteration of bip's bvec Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: Jinyoung CHOI , "axboe@kernel.dk" , "hch@lst.de" , "martin.petersen@oracle.com" , "kch@nvidia.com" , "johannes.thumshirn@wdc.com" , "willy@infradead.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230503102542epcms2p371143d5975c9fa4e4a081b96f6bfc2c0@epcms2p3> Date: Wed, 03 May 2023 19:25:42 +0900 X-CMS-MailID: 20230503102542epcms2p371143d5975c9fa4e4a081b96f6bfc2c0 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLJsW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ZC51T2IynL+atCI/T9zyllPv71I9+Xf/a1qXiPesi g/7fYXPZ8Di0Xo5b2P39j1ixp9cD/vUFy/RwmJZ90i/MXexVf2ujDd/D5u3JwptZfW/GRL4o W3K+J9YnQuhSflNFfG/WtWy+5v3dlkosxRmJhlrMRcWJAB06peUwBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org bip_for_each_vec() performs the iteration in a page unit. Since a bio_vec of bip is composed of multi-page in the block, a macro that can be carried out in multi-page units has been added. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- include/linux/bio.h | 4 ++++ include/linux/bvec.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/bio.h b/include/linux/bio.h index b53a595b519a..e3e437ce694c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -695,6 +695,10 @@ static inline bool bioset_initialized(struct bio_set *bs) #if defined(CONFIG_BLK_DEV_INTEGRITY) +/* iterate over multi-page bvec for integrity */ +#define bip_for_each_mp_bvec(bvl, bip, iter) \ + for_each_mp_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) + #define bip_for_each_vec(bvl, bip, iter) \ for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 555aae5448ae..9364c258513e 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -184,6 +184,12 @@ static inline void bvec_iter_advance_single(const struct bio_vec *bv, ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \ bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len)) +#define for_each_mp_bvec(bvl, bio_vec, iter, start) \ + for (iter = (start); \ + (iter).bi_size && \ + ((bvl = mp_bvec_iter_bvec((bio_vec), (iter))), 1); \ + bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len)) + /* for iterating one bio from start to end */ #define BVEC_ITER_ALL_INIT (struct bvec_iter) \ { \