From patchwork Wed May 3 10:00:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1215960vqo; Wed, 3 May 2023 03:22:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7STxKERkwWwJTvSQgdErQEiJPqacfyGBdnlFZYqAPY6nfUhuEKBYf4D3qxtyBCv9Fb2vjU X-Received: by 2002:a17:90b:4c8d:b0:246:61ae:2fbb with SMTP id my13-20020a17090b4c8d00b0024661ae2fbbmr21657244pjb.41.1683109325176; Wed, 03 May 2023 03:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109325; cv=none; d=google.com; s=arc-20160816; b=JyGDFlFKlfYCNCnwa8So3CA4l0j/aoT0AI7ImCwJKwumGGqdidn+9ACoL/ZNXloUkN /OoUrs7FebS2W/HSHgTnIYjjTnwm5/UUCY9ODArx1N7REGEPIsWyvdDQoureT8Ytlauq YTVIgkkK/L3B76yZhMgAXi04r1v1Yjp+yrZfLH9RL5//+GdrYJH6l4bEpcfuzId3xXUW zkQxpdMvGFsGTEmd/R8Uwq+AxcxoD4nnAFco3BBOhbSwee8sB9TXOVO2qPHF+crEDKXz 5GYc8KaJWOY0qy4gBuPu/6W6Lx2MccOSgqt/rGIpwt2R/3LrZfD+IGDWPBvOeQDpXHKD mOEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=Lh/JoKhqwHvgqNqdwOhUU4xB3qjfNA9DOJp/qwOaGTM=; b=eMCY/Ivy6ghIGDf6Sl7SDB9dVxuQ0Qr3n+jsYLITZr0BXskNwdf1bSdCfs3b2ceaKJ oZ2G7ldwMKnCab2SDuD5vBabzf6vScbew7ySQ/0Nwvn6COmT8n4kPlloNC0ZE5S5NrCo HciP/hk8afB2V9OxkJPgcHVhRTs0w/UARwL7aWEM8uulYDqjBOW3P9NZQxjVVGxKMsIT TvImoZH96L9uYmJtNoWkXjU9QSn+KF0zhngpWuYlyLFadXGC4ObwbMtaBcjktwequ1im Lih9ySnfOc5KGFhMRxlxmwJImV5LMJ7Mz5997Yo3sTIHggACAgGQny/4oFlWDOqF5xQC HLYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="SwzA/pbm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a17090adb8100b0024e29c5c06dsi3634137pjv.12.2023.05.03.03.21.52; Wed, 03 May 2023 03:22:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="SwzA/pbm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbjECKBB (ORCPT + 99 others); Wed, 3 May 2023 06:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjECKA6 (ORCPT ); Wed, 3 May 2023 06:00:58 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27C8B4 for ; Wed, 3 May 2023 03:00:53 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503100051epoutp03b4726934c3085c40f26e63077f623519~bmdr5pyeX1324113241epoutp03o for ; Wed, 3 May 2023 10:00:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503100051epoutp03b4726934c3085c40f26e63077f623519~bmdr5pyeX1324113241epoutp03o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108051; bh=Lh/JoKhqwHvgqNqdwOhUU4xB3qjfNA9DOJp/qwOaGTM=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=SwzA/pbmu8lEKPrQtd05GBW8GO8WrxrE1PF4buYVMm7KDgsbq82mB1d+NZ0zy0QaA tilrDndq0ZDBZkD69z2qDxnWT38yJhyGoi/SO3o0F8MmZuEl3Lk+IyJ9q3nRK5Y9ly ZJSEzifAVj0JCoq4tjLqdZ1clswtOg743ZjWXtRQ= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230503100051epcas2p4226eb26512691c9a5b0fe5e8ab873761~bmdrfzeS-1761217612epcas2p4q; Wed, 3 May 2023 10:00:51 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.88]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCBV3zyxz4x9Px; Wed, 3 May 2023 10:00:50 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-a4-645230d274be Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 70.89.08199.2D032546; Wed, 3 May 2023 19:00:50 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 01/15] block: bio: rename page_is_mergeable to bio_page_is_mergeable and make non-static 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" , "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: <20230503100049epcms2p2c830ebb7b50beaa2663abd0cd274293c@epcms2p2> Date: Wed, 03 May 2023 19:00:49 +0900 X-CMS-MailID: 20230503100049epcms2p2c830ebb7b50beaa2663abd0cd274293c X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmhe4lg6AUg797ZC1W3+1ns3h5SNNi 5eqjTBa9/VvZLPbe0ra4vGsOm8Xy4/+YHNg9Lp8t9dh9s4HN4+PTWywefVtWMXp83iQXwBqV bZORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkDdIOSQlli TilQKCCxuFhJ386mKL+0JFUhI7+4xFYptSAlp8C8QK84Mbe4NC9dLy+1xMrQwMDIFKgwITuj /fc55oKzAhXP775hbWDcx9vFyMkhIWAisXPNPZYuRi4OIYEdjBJXt/9n7WLk4OAVEJT4u0MY pEZYIEti69Kb7CC2kICSxLk1sxhBSoQFDCRu9ZqDhNkE9CR+LpnBBmKLCKxmkmh+XgMxnldi RvtTFghbWmL78q2MIDangJ/E4w23GCHiGhI/lvUyQ9iiEjdXv2WHsd8fmw9VIyLReu8sVI2g xIOfu6HikhKHDn1lAzlHQiBfYsOBQIhwjcTb5QegSvQlrnVsBDuBV8BXYtHxVrDxLAKqEvN7 ZkCtcpGY9+UxE4jNLCAvsf3tHGaQkcwCmhLrd+lDTFeWOHKLBaKCT6Lj8F92mAcbNv7Gyt4x 7wkTRKuaxKImI4iwjMTXw/PZJzAqzUIE8iwka2chrF3AyLyKUSy1oDg3PbXYqMAYHq/J+bmb GMEpUct9B+OMtx/0DjEycTAeYpTgYFYS4f1Q6JcixJuSWFmVWpQfX1Sak1p8iNEU6OGJzFKi yfnApJxXEm9oYmlgYmZmaG5kamCuJM4rbXsyWUggPbEkNTs1tSC1CKaPiYNTqoEp42zr9p+F E1Qud2pKKRwoCN/rYnhmf/unX2U5nx/wnFW/63jDv1Jgsd131ud5VevUfT06eXZPk/34f8uZ /03muycamLRLFTmobtv8I4xP+HfEhb1nHzbkKLOxntQ1i+TXUvjUbPNkntr28NqWS9oXH+3r EFZ8IdZSdCcx2yEw+cyc2Wv2tS3VfTzj6c4dRwzrq5auNFOad+xSkdPHFyuq6x7uD72qNfdd qDHbskU3rf/vZpp3duXqtK/yPnOTuTUsWr4Ymy6P7dWUl179qTTgnUmh2Nb1c9avmbBep/fM 1J38exxag2Kzo33LZb0+K6gknLf/GHWr6FV2Rfxka9GJ+fa1ZcY5py7rP562Ri9LiaU4I9FQ i7moOBEA7Q64whIEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868043468387555?= X-GMAIL-MSGID: =?utf-8?q?1764868043468387555?= page_is_meargeable() can be used to merge the page to the bio_vec of bio's integrity payload. For this, the static was removed. There is a page_is_mergeable() in F2FS filesystem, so the name was changed to bio_page_is_mergeable. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/bio.c | 8 ++++---- include/linux/bio.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..3e5ab59502e2 100644 --- a/block/bio.c +++ b/block/bio.c @@ -903,9 +903,9 @@ static inline bool bio_full(struct bio *bio, unsigned len) return false; } -static inline bool page_is_mergeable(const struct bio_vec *bv, - struct page *page, unsigned int len, unsigned int off, - bool *same_page) +bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page, + unsigned int len, unsigned int off, + bool *same_page) { size_t bv_end = bv->bv_offset + bv->bv_len; phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1; @@ -951,7 +951,7 @@ static bool __bio_try_merge_page(struct bio *bio, struct page *page, if (bio->bi_vcnt > 0) { struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; - if (page_is_mergeable(bv, page, len, off, same_page)) { + if (bio_page_is_mergeable(bv, page, len, off, same_page)) { if (bio->bi_iter.bi_size > UINT_MAX - len) { *same_page = false; return false; diff --git a/include/linux/bio.h b/include/linux/bio.h index d766be7152e1..b53a595b519a 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -418,6 +418,9 @@ struct bio *bio_alloc_clone(struct block_device *bdev, struct bio *bio_src, gfp_t gfp, struct bio_set *bs); int bio_init_clone(struct block_device *bdev, struct bio *bio, struct bio *bio_src, gfp_t gfp); +bool bio_page_is_mergeable(const struct bio_vec *bv, struct page *page, + unsigned int len, unsigned int off, + bool *same_page); extern struct bio_set fs_bio_set; From patchwork Wed May 3 10:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1217235vqo; Wed, 3 May 2023 03:24:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5glDRqExVRX8b1X2XOhe5qCnm+3L4BE4Zfr9Da2oLs9uBXNitxh3KyGxfN0NdfpIvqetmp X-Received: by 2002:a17:902:d314:b0:1a6:db0a:8003 with SMTP id b20-20020a170902d31400b001a6db0a8003mr1798094plc.23.1683109498891; Wed, 03 May 2023 03:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109498; cv=none; d=google.com; s=arc-20160816; b=bBwYF0xOYMIXfUcT0CyuRbTA65iuRtn4BYzjvCjjiQ2VpI8Qg+PNDqfMUKZMYkBVFT /kb5hLybmdJ2m2RKenAB9SO/IkEQ4t/c8Y1t8S6ZrHXItoZZU2bpXnKTIOa+dC/viqkf QkhRAxoNJ9UOTygdkt1hw0+Q7K9TJPGIwDpvxDQltQ746kQ9KJOO9f6MCKO19XKwdT7J 9fujjLrg1i8BcU02HMHYL5xsNRTbLxHG92UG4En+k9pxhgRTXFIfgvRsSFiXB36/YObH YS2/4N4BQgW+IDga0WFeStN9/WuWC3Tv8I67ooyArs1Y7n4oNh7vl8y8D5G7Tv2Gm3IO Nx2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=o/y7pqqreOOyNd3ZbjyVH5zrhKm5j2wzOS45niAlYE4=; b=bpqoRdFp8A4esk4HRCEkjRIoDpBziGYtC+UIpVVNmzybBk4zt2CHChju2ASBSHkRad E5W7+x0Bf85TrGMBsiMTOxOHmscLISjHenkvs1Inm1mev1ZnmuWjfFxm8zlGSYM1KOsG bwdt7k84Uj+5eXWvIifguUtg+IWkFHgbp1qdKI8g3H+7lgZy6kElYR/tuHKDMygk9SUF ptmr/bneUl7na6Lu7rylqJMU6LguqmkjjR+qydyfl/dT70m2o3a3W5nPcZCyYRBhz47h HFNjIg3Q40ojAMLJQjzLB6rxXiuomBz1TkqxusMS+h4ybkDFkISDki0diY5Y7AfwwGL9 BZmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qXa2dMLg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a170902dac400b001a9627e55c3si27971432plx.520.2023.05.03.03.24.45; Wed, 03 May 2023 03:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qXa2dMLg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229618AbjECKC2 (ORCPT + 99 others); Wed, 3 May 2023 06:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjECKC0 (ORCPT ); Wed, 3 May 2023 06:02:26 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F221A5 for ; Wed, 3 May 2023 03:02:24 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230503100222epoutp02d194794b92fef39f7a764f03a81667df~bmfAjG2I61591015910epoutp02F for ; Wed, 3 May 2023 10:02:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230503100222epoutp02d194794b92fef39f7a764f03a81667df~bmfAjG2I61591015910epoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108142; bh=o/y7pqqreOOyNd3ZbjyVH5zrhKm5j2wzOS45niAlYE4=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=qXa2dMLgA5s9fizPdZRKXZ2zfZHhrjlKptjJ0gAa0Yarx+cauEYQ7uDBJCjNxOg9S 887PELrA/+Dc/BsnFO9x4sqBi5lAu+30b7U9Dk9tIPKByk2Q4The8pnDf4jChUIAwi vDT8IMPjkIy3nTTH/8yLOKdt0yxYyaXjZ/cbCsPg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503100222epcas2p3cc0da536fd36757f90a1f16245acd6a4~bmfAM6Xm80396103961epcas2p3w; Wed, 3 May 2023 10:02:22 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.68]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QBCDF3Rl4z4x9Q3; Wed, 3 May 2023 10:02:21 +0000 (GMT) X-AuditID: b6c32a45-465ff70000020cc1-ca-6452312d7a18 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id BE.A9.03265.D2132546; Wed, 3 May 2023 19:02:21 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 02/15] block: blk-integiry: add helper functions for bio_integrity_add_page 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" , "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: <20230503100220epcms2p33e69fd7d5f04b305c621799792e8155f@epcms2p3> Date: Wed, 03 May 2023 19:02:20 +0900 X-CMS-MailID: 20230503100220epcms2p33e69fd7d5f04b305c621799792e8155f X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHKsWRmVeSWpSXmKPExsWy7bCmua6uYVCKwZK/Ihar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ3x pqebqWC9aMX+Bd/YGxi7BLsYOTgkBEwk7i5n72Lk4hAS2MEo8WTRN2aQOK+AoMTfHcJdjJwc wgKxEoeufmIGsYUElCTOrZnFCFIiLGAgcavXHCTMJqAn8XPJDDYQW0RgNZNE8/MaEFtCgFdi RvtTFghbWmL78q2MIDangJ/E4w23GCHiGhI/lvUyQ9iiEjdXv2WHsd8fmw9VIyLReu8sVI2g xIOfu6HikhKHDn1lg/gkX2LDgUCIcI3E2+UHoEr0Ja51bAQ7gVfAV+LjuRlg41kEVCVu3e1k g6hxkdjR0c8KYjMLyEtsfzsHHAjMApoS63fpQ0xXljhyiwWigk+i4/BfdpgHGzb+xsreMe8J E0SrmsSiJiOIsIzE18Pz2ScwKs1CBPIsJGtnIaxdwMi8ilEstaA4Nz212KjAEB6tyfm5mxjB CVHLdQfj5Lcf9A4xMnEwHmKU4GBWEuH9UOiXIsSbklhZlVqUH19UmpNafIjRFOjhicxSosn5 wJScVxJvaGJpYGJmZmhuZGpgriTOK217MllIID2xJDU7NbUgtQimj4mDU6qBqUC+lfVR5ZP/ 03h1GOM+pq052mrLcMDUyuTLsdUXd+tlnWE6oHF8AXPqZuYt/K3qcQLqU4rZXNfzbLCyLBBb eob7wClr9ZRZ3JKdOy+wPt/toTHXLfuM87/YG7O/nSydzv7q0d4S2bdPaoJmLfn5s2n76++H zh5++TRvT+JyLj8NOfb1wvd/73/em11wup3RPIohX+bn7a+7nTsqXlzdJiXFmZdtsvbuB8kD O2OmNfnvunVHd82Xw3e5jNdvDwi6phS7+uWDhHMWDJUnXntqJVnOmLujQHGvRmBywM6PlTPZ c9fWCj2eMoXfYqvZ+dN+z64/2CUVyrsyOPHk9TsXbct6TkWmzdvveTr36V2lcAklluKMREMt 5qLiRAABKXjuEQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868225771857939?= X-GMAIL-MSGID: =?utf-8?q?1764868225771857939?= Add functions that use the hardware limit to merge the page with integrity's bio_vec. Using the added functions, the physically continuous pages are made of one bio_vec. Previously, physically continuous pages were not created as one bio_vec, but separately created. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/bio-integrity.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4533eb491661..06b6a2c178d2 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -111,6 +111,64 @@ void bio_integrity_free(struct bio *bio) bio->bi_opf &= ~REQ_INTEGRITY; } +/** + * bip_full - check if the bip is full + * @bip: bip to check + * @len: length of one segment to be added + * + * Return true if @bip is full and one segment with @len bytes can't be + * added to the bip, otherwise return false + */ +static inline bool bip_full(struct bio_integrity_payload *bip, unsigned int len) +{ + if (bip->bip_vcnt >= bip->bip_max_vcnt) + return true; + if (bip->bip_iter.bi_size > UINT_MAX - len) + return true; + return false; +} + +/** + * bip_try_merge_hw_seg - try to merge a page into a segment, while + * obeying the hardware segment size limit + * @q: the target queue + * @bip: bip to check + * @page: page containing integrity metadata + * @len: number of bytes of integrity metadata in page + * @offset: start offset within page + * @same_page: return if the segment has been merged inside the same page + * + * Return true if @page is merged to @bip, otherwise return false + */ +static bool bip_try_merge_hw_seg(struct request_queue *q, + struct bio_integrity_payload *bip, + struct page *page, unsigned int len, + unsigned int offset, bool *same_page) +{ + struct bio_vec *bv = &bip->bip_vec[bip->bip_vcnt - 1]; + unsigned long mask = queue_segment_boundary(q); + phys_addr_t addr1 = page_to_phys(bv->bv_page) + bv->bv_offset; + phys_addr_t addr2 = page_to_phys(page) + offset + len - 1; + + if ((addr1 | mask) != (addr2 | mask)) + return false; + if (bv->bv_len + len > queue_max_segment_size(q)) + return false; + + if (bip->bip_vcnt > 0) { + if (bio_page_is_mergeable(bv, page, len, offset, same_page)) { + if (bip->bip_iter.bi_size > UINT_MAX - len) { + *same_page = false; + return false; + } + bv->bv_len += len; + bip->bip_iter.bi_size += len; + return true; + } + } + return false; +} + /** * bio_integrity_add_page - Attach integrity metadata * @bio: bio to update From patchwork Wed May 3 10:06:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1211198vqo; Wed, 3 May 2023 03:12:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7IdHL+RZ1kx8gWA6AtaXl5jxEe654pGfzfw8t44Ymvu3mvXjiwKsAO/M0413Slvc/pda3e X-Received: by 2002:a05:6a20:394a:b0:ec:5eb2:a2bb with SMTP id r10-20020a056a20394a00b000ec5eb2a2bbmr26561725pzg.61.1683108751581; Wed, 03 May 2023 03:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683108751; cv=none; d=google.com; s=arc-20160816; b=JE1oytTutB1ogxmkuH5qcisJi42mRQDAOF7QeWQivsHbILgVvSEb7YEG3Ej33MNGmE nE4XHJuZ7GfsW8Jai1H9TwGTx2JOnT36JH2Gz9HWE1+T1y2+Jjs4SlaE/P/1ZrtT8JTk sYjLsyUnfC8sGZc4yxQ0UAtUBLJq6dazWJPJbmKWgjmtxdn8Hzo4sWk3yj69hlTWZ4Wy WbuxcoQCakETmetW9TevsMrisR+qFRhdqwfm7Cdh1oqptIrtwoRvtFED3+SalnO7vYOg 0UIwsphMPUxB+tsPT5vZqdEe+lnmTkxOPTjEYOnDYrHV/Shb/S44Y1/bxCnHcPJuiJUK BX+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=1WhTIW3VLo5qDfXJ/0YEchijZafqk1XB4OYfht1gpEI=; b=hUycvFK0VrNqJgMptmlfRXbuXiaWKJOINhhcZDM9IrC9RlvovOWRn8BSoth8PLXIPQ YUqhJ1ZqdRqPgsxiiiQY1A7EpLWt71JCLXfGrfw3w2gNneoxwTmRH690LccarUJ+ih3h WBsnM5DoIc070mR4gKn1SFCuEEf6gIjD3RCuIxVNM5UCZYIYNG/FmyocWKkUN/kTFV2P 7vMVTm8gPVsR8yxkWxwfjkYvsvVKCHuh6RBc6FmXu05BPAzzucDzx0I2cNwo0fWd4r60 oCTKuNK7Dzy/yjJlBuyHwpQrJXwXUPjskCcGRdrRvjBn4PKHaHrjUYE6tThUbTNmwBs8 pPXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=DcUF9wb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a63eb0a000000b0052069c10102si32146094pgh.75.2023.05.03.03.12.17; Wed, 03 May 2023 03:12:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=DcUF9wb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbjECKGu (ORCPT + 99 others); Wed, 3 May 2023 06:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjECKGs (ORCPT ); Wed, 3 May 2023 06:06:48 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91FCAE43 for ; Wed, 3 May 2023 03:06:43 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503100641epoutp03f3afe4a3e1d9490e030e9a7f7cae59ae~bmiyBd5p-1770017700epoutp03a for ; Wed, 3 May 2023 10:06:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503100641epoutp03f3afe4a3e1d9490e030e9a7f7cae59ae~bmiyBd5p-1770017700epoutp03a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108401; bh=1WhTIW3VLo5qDfXJ/0YEchijZafqk1XB4OYfht1gpEI=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=DcUF9wb+SnzJEz0OCAcXzgBVuPqyetKe4JbMFY8vPe4dDVOcwtWFXmfvjWgTT0fD+ 0n0DnSrhmk1irqyipV8Cpy2JUMtQcg1kF8K4FjTH7hlJ3PjqOrZmj+mx0WY5HjyrY0 ZqP/BT9TUKFeYa6pOcJ8Z/bjUdJtAxb8oseVE8Ac= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230503100640epcas2p4a916461813c8ba6adefad44e524d4480~bmixIQo-G2064220642epcas2p4I; Wed, 3 May 2023 10:06:40 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4QBCKD1frvz4x9Py; Wed, 3 May 2023 10:06:40 +0000 (GMT) X-AuditID: b6c32a47-c29ff70000002007-a2-645232306dac Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 06.6D.08199.03232546; Wed, 3 May 2023 19:06:40 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 03/15] block: bio-integrity: modify bio_integrity_add_page() Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: Jinyoung CHOI , "axboe@kernel.dk" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "martin.petersen@oracle.com" , "kch@nvidia.com" , "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: <20230503100639epcms2p5069df7346cfce6db9718b9adf7cc3718@epcms2p5> Date: Wed, 03 May 2023 19:06:39 +0900 X-CMS-MailID: 20230503100639epcms2p5069df7346cfce6db9718b9adf7cc3718 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmha6BUVCKwc73nBar7/azWbw8pGmx cvVRJove/q1sFpMOXWO0eHp1FpPF3lvaFpd3zWGzWH78H5PFutfvWRy4PM7f28jicflsqcem VZ1sHrtvNrB59Da/Y/P4+PQWi0ffllWMHp83yQVwRGXbZKQmpqQWKaTmJeenZOal2yp5B8c7 x5uaGRjqGlpamCsp5CXmptoqufgE6Lpl5gBdqKRQlphTChQKSCwuVtK3synKLy1JVcjILy6x VUotSMkpMC/QK07MLS7NS9fLSy2xMjQwMDIFKkzIzng0/TJTQatUxe69M5kaGM+JdDFyckgI mEgcWrCMtYuRi0NIYAejxMZze4EcDg5eAUGJvzuEQWqEBXwkTj38xQpiCwkoSZxbM4sRpERY wEDiVq85SJhNQE/i55IZbCBjRAQWMUtsmjeZDWI+r8SM9qcsELa0xPblWxlBbE4BP4nHG24x QsQ1JH4s62WGsEUlbq5+yw5jvz82H6pGRKL13lmoGkGJBz93Q8UlJQ4d+soGco+EQL7EhgOB EOEaibfLD0CV6Etc69gIdgKvgK/ElwPtYKexCKhKfP8wCWqki8TWg+uYQGxmAXmJ7W/nMIOM ZBbQlFi/Sx9iurLEkVssEBV8Eh2H/7LDPNiw8TdW9o55T5ggWtUkFjUZQYRlJL4ens8+gVFp FiKUZyFZOwth7QJG5lWMYqkFxbnpqcVGBcbwiE3Oz93ECE6oWu47GGe8/aB3iJGJg/EQowQH s5II74dCvxQh3pTEyqrUovz4otKc1OJDjKZAD09klhJNzgem9LySeEMTSwMTMzNDcyNTA3Ml cV5p25PJQgLpiSWp2ampBalFMH1MHJxSDUybZz9IyQwWv3lm9qH0jnRNjpudp3n+J//rT5ky uTfCybn9bnio5V+1xj2Z3p/u/w+XjVl7P9VNMOJuz6Fc5lV7Zkz5GC14KDjvxcXKYp6vzSe5 M9tfu3IpLAjveb/Uqnhivs7R15LWRZPn9fnuXBi3Q2Vvv43/pZCI15ePJP7eJ8NvsOxnve67 TEO++HNxSpIGrvvDy3omz+C+EZP4qovjrZXAjohNYY17LtQtPB/0eIlJwMRf2atOcE+r2Wdv NvupfNzPg2EuF46ft1KesFLndGXbD2Gbf64/NE7xzC1NirliaheifyQhdIfsyq3vhHoCHJ9z XDnOrtKx1X5b/TeLjqAlj8rd85etex+zS02JpTgj0VCLuag4EQDrnXkoMQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764867442391311321?= X-GMAIL-MSGID: =?utf-8?q?1764867442391311321?= Considering the constraints of hardware, the physically continuous pages were to be composed of one bio_vec. Previously, bio_vec was created separately for each page entering the parameter. Cc: Christoph Hellwig Cc: Martin K. Petersen Fixes: 783b94bd9250 ("nvme-pci: do not build a scatterlist to map metadata") Signed-off-by: Jinyoung Choi --- block/bio-integrity.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 06b6a2c178d2..74cf9933c285 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -176,25 +176,45 @@ static bool bip_try_merge_hw_seg(struct request_queue *q, * @len: number of bytes of integrity metadata in page * @offset: start offset within page * - * Description: Attach a page containing integrity metadata to bio. + * Add a page containing integrity metadata to a bio while respecting + * the hardware max_sectors, max_segment and gap limitations. */ int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { + struct request_queue *q = bdev_get_queue(bio->bi_bdev); struct bio_integrity_payload *bip = bio_integrity(bio); - if (bip->bip_vcnt >= bip->bip_max_vcnt) { + if (((bip->bip_iter.bi_size + len) >> 9) > queue_max_hw_sectors(q)) + return 0; + + if (bip->bip_vcnt > 0) { + struct bio_vec *bv; + bool same_page = false; + + if (bip_try_merge_hw_seg(q, bip, page, len, offset, &same_page)) + return len; + + /* + * If the queue doesn't support SG gaps and adding this segment + * would create a gap, disallow it. + */ + bv = &bip->bip_vec[bip->bip_vcnt - 1]; + if (bvec_gap_to_prev(&q->limits, bv, offset)) + return 0; + } + + if (bip_full(bip, len)) { printk(KERN_ERR "%s: bip_vec full\n", __func__); return 0; } - if (bip->bip_vcnt && - bvec_gap_to_prev(&bdev_get_queue(bio->bi_bdev)->limits, - &bip->bip_vec[bip->bip_vcnt - 1], offset)) + if (bip->bip_vcnt >= queue_max_integrity_segments(q)) return 0; bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset); bip->bip_vcnt++; + bip->bip_iter.bi_size += len; return len; } @@ -307,7 +327,6 @@ bool bio_integrity_prep(struct bio *bio) } bip->bip_flags |= BIP_BLOCK_INTEGRITY; - bip->bip_iter.bi_size = len; bip_set_seed(bip, bio->bi_iter.bi_sector); if (bi->flags & BLK_INTEGRITY_IP_CHECKSUM) @@ -316,7 +335,6 @@ bool bio_integrity_prep(struct bio *bio) /* Map it */ offset = offset_in_page(buf); for (i = 0 ; i < nr_pages ; i++) { - int ret; bytes = PAGE_SIZE - offset; if (len <= 0) @@ -325,18 +343,13 @@ bool bio_integrity_prep(struct bio *bio) if (bytes > len) bytes = len; - ret = bio_integrity_add_page(bio, virt_to_page(buf), - bytes, offset); - - if (ret == 0) { + if (bio_integrity_add_page(bio, virt_to_page(buf), + bytes, offset) < bytes) { printk(KERN_ERR "could not attach integrity payload\n"); status = BLK_STS_RESOURCE; goto err_end_io; } - if (ret < bytes) - break; - buf += bytes; len -= bytes; offset = 0; From patchwork Wed May 3 10:09:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1221901vqo; Wed, 3 May 2023 03:33:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eIS4g8IRJ0//X+npZi4tM+cxwh5FPz9jd5P/e3GNuXUjcfE9JDrmif/V5OqaoWWciWgam X-Received: by 2002:a05:6a20:a5a8:b0:f6:d4d:2d with SMTP id bc40-20020a056a20a5a800b000f60d4d002dmr21342922pzb.31.1683110039097; Wed, 03 May 2023 03:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110039; cv=none; d=google.com; s=arc-20160816; b=g2rzsxlpO4/nXdwcBRapgK6nf1OBXwIunIV5JY5pzuSfVURVMbxK+ll0B5YFmJc0oL DtDrgTkxkFrf6Adn0u5vBixh5Eiht1K1p9edmi2UVY0ddFF2nHW4UOvtrtqrg77Dog8X q0OV67X3lzvlHjr85/NFjeGi8YEwyMl9k74+41iksq5d3Oon2XmRj4qJqzQVSvkk0OhC 77jmsFXKaYCVniBJT+euvO2V4d6yMLARg1U64YA1dhO+8bY6dRnPW6fWAtbMfUVFC8uI i0djh+m+Ywoo7gR2lw6f3Rl+RzosclNlYAvNk/3noQXcQbtrF7S6g14mlkhCRxfkBQkt ZsJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=kra6K6+UrYLIE+JQHy/nrTmW6GTWNgEH+aD6dQYjQ8E=; b=fIfSra0SdIq4UIb1NVM+eQ57GDTxBY+L/IJu67g1xMB6sCWfGx9yhVMnw+1XyKSU2p 337OxmMJN5beH8NOsapwGs83gmA0/914vznTj2kEcg9tDCe10+9Df1WbH+vLyPt8hTPV 6cWFexODcTjJmHrr43lgRwFdBdVvAil5IoXxgHrUOT0AXzuo/ZMXnhWCijChlOk3UItD EUrsD6OfL1Gibe0TIkKNGkTyPmB/SJJooybhtBc/JN3mIYndMsYhIuC4fHTSYt5WCgdW 6oIj9Oq4zOtu9R9weAfqvlaf4r4HaXMxYnG+JAxLmrHgtWmmOGyv0G/gpEp7vfkHiFwL UXIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WsAfJpBq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a634603000000b004ff6eee7176si32365464pga.261.2023.05.03.03.33.46; Wed, 03 May 2023 03:33:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WsAfJpBq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbjECKJO (ORCPT + 99 others); Wed, 3 May 2023 06:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjECKJM (ORCPT ); Wed, 3 May 2023 06:09:12 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409CE1A5 for ; Wed, 3 May 2023 03:09:10 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230503100908epoutp01867f3ca0a3c7af83bb94e0d3735bd054~bmk6gAcrp1497714977epoutp01c for ; Wed, 3 May 2023 10:09:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230503100908epoutp01867f3ca0a3c7af83bb94e0d3735bd054~bmk6gAcrp1497714977epoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108548; bh=kra6K6+UrYLIE+JQHy/nrTmW6GTWNgEH+aD6dQYjQ8E=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=WsAfJpBqvVnJDYUH62PLtpP/C7VxG63VKV4tLsVXFUfWa0Fup+Ut6FVbmDxfsqHjT rVyWf08TUWJtHTYDtqp2k1LU4+wsRH4BaHqKES/nXkiseGUSMKVtJydBBJLjcebNN9 b1PH+MXzvU7uLN2zzb7Ewo9VW1UxWYe2TyhdPnpg= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503100907epcas2p3449f6572ea0db3a9b054da777cfb6efc~bmk6Aaucn2526925269epcas2p33; Wed, 3 May 2023 10:09:07 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.88]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QBCN3198vz4x9Pr; Wed, 3 May 2023 10:09:07 +0000 (GMT) X-AuditID: b6c32a45-c6fb9a8000020cc1-43-645232c276f4 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 70.1D.03265.2C232546; Wed, 3 May 2023 19:09:07 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 04/15] block: bio-integiry: cleanup bio_integrity_prep 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" , "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: <20230503100906epcms2p35226430da085d7449840bb122a6b193c@epcms2p3> Date: Wed, 03 May 2023 19:09:06 +0900 X-CMS-MailID: 20230503100906epcms2p35226430da085d7449840bb122a6b193c X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmhe5ho6AUg3e9TBar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ2x a8lR9oI5fBWNW7cyNjDu4O5i5OSQEDCReLj1G3sXIxeHkMAORom+Z5+AHA4OXgFBib87hEFq hAXcJB4tucwMYgsJKEmcWzOLEaREWMBA4lavOUiYTUBP4ueSGWwgtojAaiaJ5uc1EON5JWa0 P2WBsKUlti/fyghicwr4STzecIsRIq4h8WNZLzOELSpxc/Vbdhj7/bH5UDUiEq33zkLVCEo8 +LkbKi4pcejQVzaQcyQE8iU2HAiECNdIvF1+AKpEX+Jax0awE3gFfCV29J8FO5NFQFVixdQ5 UKe5SPTPOA82nllAXmL72znMICOZBTQl1u/Sh5iuLHHkFgtEBZ9Ex+G/7DAPNmz8jZW9Y94T JohWNYlFTUYQYRmJr4fns09gVJqFCORZSNbOQli7gJF5FaNYakFxbnpqsVGBITxek/NzNzGC U6KW6w7GyW8/6B1iZOJgPMQowcGsJML7odAvRYg3JbGyKrUoP76oNCe1+BCjKdDDE5mlRJPz gUk5ryTe0MTSwMTMzNDcyNTAXEmcV9r2ZLKQQHpiSWp2ampBahFMHxMHp1QDU9/9+fNsfW+v 0f0hZrSx00uP13G3eOpkaUtd7vk/54cVfHD7ZsFXe3HS/rBHrlcZ0s+zLXP6eNLnXpznne19 0oUs89TScjs+TC5dafSZ9/ihldrP37f8kuH43+66eH/eg7NHg7qVii3XZOn4eNhozb5reF1/ yb5dDv5ssjIP7MJXdJ74v+3P35XvDt88W71U+W95amLoN6cby9NeK4vPjchMvv5Hr2rXo+4t l4OUpoSyphqd0lY76+Xo3WdnVxaqN6/35rvunYbt4mt1umrqAuMdH03L1zxlmaS4ZFX40wCd R/7LRGS6Lz/elPl/boxIkfbGfmuOR5fklsb7c9aaPLef9H1qqtCF/k6XmBhLJZbijERDLeai 4kQAQxDxARIEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868792753276080?= X-GMAIL-MSGID: =?utf-8?q?1764868792753276080?= If a problem occurs in the process of creating an integrity payload, the status of bio is always BLK_STS_RESOURCE. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi Reviewed-by: Christoph Hellwig --- block/bio-integrity.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 74cf9933c285..329c44eca83d 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -278,7 +278,6 @@ bool bio_integrity_prep(struct bio *bio) unsigned int len, nr_pages; unsigned int bytes, offset, i; unsigned int intervals; - blk_status_t status; if (!bi) return true; @@ -307,7 +306,6 @@ bool bio_integrity_prep(struct bio *bio) /* Allocate kernel buffer for protection data */ len = intervals * bi->tuple_size; buf = kmalloc(len, GFP_NOIO); - status = BLK_STS_RESOURCE; if (unlikely(buf == NULL)) { printk(KERN_ERR "could not allocate integrity buffer\n"); goto err_end_io; @@ -322,7 +320,6 @@ bool bio_integrity_prep(struct bio *bio) if (IS_ERR(bip)) { printk(KERN_ERR "could not allocate data integrity bioset\n"); kfree(buf); - status = BLK_STS_RESOURCE; goto err_end_io; } @@ -346,7 +343,6 @@ bool bio_integrity_prep(struct bio *bio) if (bio_integrity_add_page(bio, virt_to_page(buf), bytes, offset) < bytes) { printk(KERN_ERR "could not attach integrity payload\n"); - status = BLK_STS_RESOURCE; goto err_end_io; } @@ -365,10 +361,9 @@ bool bio_integrity_prep(struct bio *bio) return true; err_end_io: - bio->bi_status = status; + bio->bi_status = BLK_STS_RESOURCE; bio_endio(bio); return false; - } EXPORT_SYMBOL(bio_integrity_prep); From patchwork Wed May 3 10:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1216054vqo; Wed, 3 May 2023 03:22:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4snafexIfQN9xknIR9WF/4/ASklCokgZwA1aAvfRbCUwymM5mLdxbhF5/2s1FPT6S7hu9O X-Received: by 2002:aa7:888a:0:b0:63b:64f7:45a0 with SMTP id z10-20020aa7888a000000b0063b64f745a0mr30471277pfe.12.1683109336380; Wed, 03 May 2023 03:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109336; cv=none; d=google.com; s=arc-20160816; b=IR6da0KSVXprvEqB7uJ8rAPzQEm5F8l4i51atDF8E040zvBFTh7v+dCs9+NckRj69J iaGrGskLKWjiJK197+QYc3x9aySno1d0BQY5gbEGiXpe6IFa5ZXTUejwPwgSDZgzY1Ub uMH4WT8xEkrIW9La1tj1pcScNpJ5/ZN9cUf60bPHFRuF93fW+WzwuLyaHIZ9i403LceA D0nZ727FE1TQWNd+K/AsX1txjNl4AVP5bhAIys/XPEA0oUy+FODLdj9p0XeP4zGbtHCp Qsab+ROLfMs6bqFYRUVVM4zF+Aw9S8NqZSaVmFxxw1AG/1n6JnKhcy0C8YJzAV39A8iE 9EZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=ZtBNUgN0/grPa2YZpBQ/+703+N7AXHalnFNdUd9CK2g=; b=rYrp2Cwh8+bac8Y5/Jp06JX0HVZvTSYsuZHGo+BMH5GlusYP9rc8+M97nMbK/WixfS jAdJGSxt77fBjbbsbM8rn0u06H5kHyVYncAbY2xOLlkk4RU9h0juam3C/ZRRaWUgThbT TfrwzoxHL9gMI29FLfK9RAUv6gsN3ykmrzMwkg1wPhSHjcdM/qJMmRCrlAgDSso02hUp ZjTk1qiXfdHG/NCEd4L8l7/I4UEEbiHeZb7aMcQmTBnoxoEtsMNlCjBJHYUCVjnLtdvI oVjF9xyZzhRRuJQ7QxfufHFguEmLL5a+g/T/f0StOc0GtRjADr3X9aPEPpNETMDq+0qA y0xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QxLabi9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020aa78425000000b0063b88f52220si32638138pfn.144.2023.05.03.03.22.03; Wed, 03 May 2023 03:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QxLabi9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbjECKKy (ORCPT + 99 others); Wed, 3 May 2023 06:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbjECKKx (ORCPT ); Wed, 3 May 2023 06:10:53 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88CE21A5 for ; Wed, 3 May 2023 03:10:51 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503101050epoutp0360221e9d08d67ce3904467d150dd43a9~bmmZWb3Oz2144121441epoutp03I for ; Wed, 3 May 2023 10:10:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503101050epoutp0360221e9d08d67ce3904467d150dd43a9~bmmZWb3Oz2144121441epoutp03I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108650; bh=ZtBNUgN0/grPa2YZpBQ/+703+N7AXHalnFNdUd9CK2g=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=QxLabi9gec1onP3dLuFgF6UlEGlHek9Kjr+0GdgDzqHAwyozTdSe/wX5pwdKH4fsU KQCZ3BeiJB4WqoR9N9yrHgq42r99F9YccebPTGb743seYBQox+/cFvTubDLIwx95Tx NKw/2ksDeK4zvBFmjdKKr8Tu6vXgTqfJBByPTPVI= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503101049epcas2p38f6d0fb534262f57214878ba4a6ae640~bmmY8uVtU2866128661epcas2p3e; Wed, 3 May 2023 10:10:49 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.88]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QBCQ10n2Zz4x9Pw; Wed, 3 May 2023 10:10:49 +0000 (GMT) X-AuditID: b6c32a45-6d1fd70000020cc1-29-6452332814ef Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id B1.7D.03265.82332546; Wed, 3 May 2023 19:10:49 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 05/15] block: fix not to apply bip information in blk_rq_bio_prep() 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" , "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: <20230503101048epcms2p61d61df1431955d9517c9939999ee3478@epcms2p6> Date: Wed, 03 May 2023 19:10:48 +0900 X-CMS-MailID: 20230503101048epcms2p61d61df1431955d9517c9939999ee3478 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDKsWRmVeSWpSXmKPExsWy7bCmma6mcVCKwd1pjBar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ3x secac8E09opfK7+xNjC2sXUxcnJICJhI/Ph3m6mLkYtDSGAHo8SPX99Zuxg5OHgFBCX+7hAG MYUFQiXmL9YHKRcSUJI4t2YWI0TYQOJWrzlImE1AT+LnkhlgE0UEVjNJND+vgZjOKzGj/SkL hC0tsX35VkYQm1PAT+LxhluMEHENiR/LepkhbFGJm6vfssPY74/Nh6oRkWi9dxaqRlDiwc/d UHFJiUOHvrKBnCMhkC+x4UAgRLhG4u3yA1Al+hLXOjayQPzkK7F/VRhImEVAVWL7vecsEJ0u EhOn+4CEmQXkJba/ncMMEmYW0JRYv0sfokJZ4sgtFogKPomOw3/ZYd5r2PgbK3vHvCdMEK1q EouajCDCMhJfD89nn8CoNAsRwrOQrJ2FsHYBI/MqRrHUguLc9NRiowJDeKQm5+duYgQnQy3X HYyT337QO8TIxMF4iFGCg1lJhPdDoV+KEG9KYmVValF+fFFpTmrxIUZToH8nMkuJJucD03Fe SbyhiaWBiZmZobmRqYG5kjivtO3JZCGB9MSS1OzU1ILUIpg+Jg5OqQYmg5DXb4uWaP5g+mFt uORVxePWBvufskpP+MInH/+87PC5G+uCjok72FS87eOc9PvmsX2mj/aVuh3jSHsdsvWs3bvP C031t7f9Ztj+82fLN6vGz5czDNlsti04ENbZ5K1w6qqTbNiK8LQ9H988vCmQ7eDt2PtjYtL2 1Lt/m5cEsT5xPXtbQNohIa8z+vnEVpumnNC2rY4+9tsfiigklHPIMrBszre7vSNn+amd2/xW xP9ZeVAg4NJiLn2ZVO4DnqkZsufEl0Q9CjW32f0x9dzOpdt3ZH72rlbqOVb8R2wef96hzlt+ y9j/OJtfkNJxfMPYnr3/odXOm0YbfS9M0n0xUe+uw43muqd5J+PObRDbosRSnJFoqMVcVJwI AOw3ppIPBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868055361541160?= X-GMAIL-MSGID: =?utf-8?q?1764868055361541160?= When a request is initialized through the bio, bio's integrity information is not reflected in the request. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- include/linux/blk-mq.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 1dacb2c81fdd..cdb95e090919 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -961,6 +961,11 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio, rq->__data_len = bio->bi_iter.bi_size; rq->bio = rq->biotail = bio; rq->ioprio = bio_prio(bio); + + if (bio_integrity(bio)) { + rq->nr_integrity_segments = bio_integrity(bio)->bip_vcnt; + rq->cmd_flags |= REQ_INTEGRITY; + } } void blk_mq_hctx_set_fq_lock_class(struct blk_mq_hw_ctx *hctx, From patchwork Wed May 3 10:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1221249vqo; Wed, 3 May 2023 03:32:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wHmWoYGL73lFuU6RMBCcMaB7NfDqza0b3+H4WG4lob7y5K5gTnYgsR45cDQ35YWvPH+fP X-Received: by 2002:a17:90b:3b8b:b0:23f:9fac:6b35 with SMTP id pc11-20020a17090b3b8b00b0023f9fac6b35mr21130928pjb.39.1683109973796; Wed, 03 May 2023 03:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109973; cv=none; d=google.com; s=arc-20160816; b=WQooPJ7kaFMGFRnkf9R4WaPbjjwKLEYHeYcXD22XEFkEbvrtlN28DHAF7O1ash1ILp x7dT3PK65CQkCW1nkpAlmS+Y8YBfVKtTGhRdC7AMSedQLDkiWpvoP+G7meX+ijjmUtDi jmqen9wNR/mp4EMsn6SWIfEYVSq9S4aX6IS2/Bxpg9IU/6tbeLT8Veb7Gp4MO6nwWC2T kY0E/QuI3sbZ3G1JiYIe61MvDXHbYJ0ZWUOlQE0y5DSLjHoCRRrPbDWVXHGdYA4ClI5c IWphevfi2o518KOkrbfcHaTOtuvfGTgXsIZLfKQwRfX8D5bPlDUMsLiG9M7NpQZwSQNv XeHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=zvETEJpKps7CgoP+0aNXfFiUkdNh7m7B7nh+qhAE130=; b=yeFvg5ZSAJ4Oszybuhvv9WhDFxXWg+aQGJ00hSAAgZA0q2DidRbwxiI2fU0bbg9ZZ/ OftQeKeMEJ6aX6hG+EUxzSxBM4yZxE8s42vu2GxmRDrgGmTwgE7F4DL0QAnwe6QUM+CW 6SCuQI5Q4Jx8DxFJ7zrZjZz9ZSC6Kr18xq6cgng7w4dKAQ3R8rHvvxy3+yGfzbK2LzXz IJKI2bkqidio/ltMv8RNGoF/KbbxuiEih1Z9h6P8lyUNvIJHdrmIc+7ySelxdCHUpJUQ dykWFstW2gehKfmAGu162id0SW2HNuivM2siUFq8wggjLIyfPOyv2MDxoEGTzpY2A43n mqKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=EdUw5aMy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63f20a000000b00528c6c2ea96si3053610pgh.306.2023.05.03.03.32.41; Wed, 03 May 2023 03:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=EdUw5aMy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbjECKMQ (ORCPT + 99 others); Wed, 3 May 2023 06:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjECKMO (ORCPT ); Wed, 3 May 2023 06:12:14 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F020F3C01 for ; Wed, 3 May 2023 03:12:12 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230503101210epoutp04c1d2dbefd7b530e0f7b29f0f044b8a39~bmnkrR4-B1848018480epoutp04j for ; Wed, 3 May 2023 10:12:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230503101210epoutp04c1d2dbefd7b530e0f7b29f0f044b8a39~bmnkrR4-B1848018480epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108731; bh=zvETEJpKps7CgoP+0aNXfFiUkdNh7m7B7nh+qhAE130=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=EdUw5aMyi7rcmSIDmFkf8q0TJeS5f/+H3M5nKe1TQrTVqyjt/pDnPxG6VBQwP0dqe o+ym4JrdgBuq7uSvj1lhyrEsQKUyLQbl0WdbKlQeGnOaW/UpZcEEA83oSwV/PL0C0Y G++C3r36qCXbWsMHHsK8bEFBLCEYzJZr82wBs1FM= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503101210epcas2p348dac10e0ac642bdfafcb7aeac0625e5~bmnj-qOF71815318153epcas2p3S; Wed, 3 May 2023 10:12:10 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.89]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QBCRY4phbz4x9Pr; Wed, 3 May 2023 10:12:09 +0000 (GMT) X-AuditID: b6c32a46-8b7ff7000001438d-04-64523379883f Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 1E.74.17293.97332546; Wed, 3 May 2023 19:12:09 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 06/15] block: blk-merge: fix to add the number of integrity segments to the request twice 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" , "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: <20230503101208epcms2p217be9d66b1e07c4e2ce3741e659e158f@epcms2p2> Date: Wed, 03 May 2023 19:12:08 +0900 X-CMS-MailID: 20230503101208epcms2p217be9d66b1e07c4e2ce3741e659e158f X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHKsWRmVeSWpSXmKPExsWy7bCmqW6lcVCKQdtNRYvVd/vZLF4e0rRY ufook0Vv/1Y2i723tC0u75rDZrH8+D8mB3aPy2dLPXbfbGDz+Pj0FotH35ZVjB6fN8kFsEZl 22SkJqakFimk5iXnp2TmpdsqeQfHO8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYA3aCkUJaY UwoUCkgsLlbSt7Mpyi8tSVXIyC8usVVKLUjJKTAv0CtOzC0uzUvXy0stsTI0MDAyBSpMyM54 sH0Ga8EJtYqP02ayNjBuke9i5OSQEDCRuPqol7GLkYtDSGAHo8TqJd0sXYwcHLwCghJ/dwiD 1AgLZEv87tjMDGILCShJnFszixGkRFjAQOJWrzlImE1AT+LnkhlsILaIwGomiebnNRDjeSVm tD9lgbClJbYv38oIYnMK+Ek83nCLESKuIfFjWS8zhC0qcXP1W3YY+/2x+VA1IhKt985C1QhK PPi5GyouKXHo0Fc2kHMkBPIlNhwIhAjXSLxdfgCqRF/iWsdGqKd8JR69jQQJswioSux9vYwV osRFov1HE5jNLCAvsf3tHGaQcmYBTYn1u/QhhitLHLnFAlHBJ9Fx+C87zH8NG39jZe+Y94QJ olVNYlGTEURYRuLr4fnsExiVZiHCeBaStbMQ1i5gZF7FKJZaUJybnlpsVGAEj9bk/NxNjOCE qOW2g3HK2w96hxiZOBgPMUpwMCuJ8H4o9EsR4k1JrKxKLcqPLyrNSS0+xGgK9PBEZinR5Hxg Ss4riTc0sTQwMTMzNDcyNTBXEueVtj2ZLCSQnliSmp2aWpBaBNPHxMEp1cCk5bYpeOEal4Tl R74UfOi7KRvwQFExZlPrrBgv/tur/6ycGFsVvGJ1o2Sa+9//U+f5emc8v3zWXOftzJVP0trv MF0qyz3/bkVTjMp555JbxwTWvlulK6pxq+OlwJSbIjWBt29p2pQcmM8+a8eVxxLiU6cWpsUo 9aycpbxP5bUw13r1968+vr7+benClU/1/Gef6Jl/4aLWhos5ImWNR1WffnR9uTumKUWy2SJi ZuQLxT9P/l2OUrlWVXgxyrIgNODDrciK3TnMk9NXPeb5sehFkvCTkzltFgpX4t9rv7f6IfWO N2nDywOzGczElXd7H8s4+KTHdabqhMz5Aor3O+ZwSelZmpf/ilFe+jRCc23yDSWW4oxEQy3m ouJEAF4Mg6YRBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868723923430552?= X-GMAIL-MSGID: =?utf-8?q?1764868723923430552?= blk_integrity_merge_bio() not only performs conditional tests, but also updates the integrity segment information of request. It can be called twice when merging the bio into an existing request. bio_attempt_bio_merge() or blk_mq_sched_try_merge() blk_rq_merge_ok() blk_integrity_merge_bio() - 1 bio_attemp_{back|front}_merge() ll_{back|front}_merge_fn() ll_new_hw_segments() blk_integrity_merge_bio() - 2 The part of checking the conditions and the code to update the information of the actual request were separated. At this time, the ll_back_merge_fn was called by passth-path, so the condition check was called by all the separated functions. And after success in blk_integrity_merge_bio(), the information of the request may be wrong if it is impossible to merge due to other conditional tests. Thus, it was changed to be called immediately before merging the bio's segments. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/blk-integrity.c | 34 +++++++++++++++++++++++++++++----- block/blk-merge.c | 9 +++++---- block/blk.h | 7 +++++++ 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index d4e9b4556d14..03a85e1f6d2e 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -184,19 +184,43 @@ bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, return true; } +static inline bool blk_integrity_bypass_check(struct request *req, + struct bio *bio) +{ + return blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL; +} + +static bool __blk_integrity_mergeable(struct request_queue *q, + struct request *req, struct bio *bio) +{ + if (blk_integrity_rq(req) == 0 || bio_integrity(bio) == NULL) + return false; + + if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags) + return false; + + return true; +} + +bool blk_integrity_mergeable(struct request_queue *q, struct request *req, + struct bio *bio) +{ + if (blk_integrity_bypass_check(req, bio)) + return true; + + return __blk_integrity_mergeable(q, req, bio); +} + bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, struct bio *bio) { int nr_integrity_segs; struct bio *next = bio->bi_next; - if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL) + if (blk_integrity_bypass_check(req, bio)) return true; - if (blk_integrity_rq(req) == 0 || bio_integrity(bio) == NULL) - return false; - - if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags) + if (!__blk_integrity_mergeable(q, req, bio)) return false; bio->bi_next = NULL; diff --git a/block/blk-merge.c b/block/blk-merge.c index 65e75efa9bd3..8509f468d6d4 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -611,9 +611,6 @@ static inline int ll_new_hw_segment(struct request *req, struct bio *bio, if (!blk_cgroup_mergeable(req, bio)) goto no_merge; - if (blk_integrity_merge_bio(req->q, req, bio) == false) - goto no_merge; - /* discard request merge won't add new segment */ if (req_op(req) == REQ_OP_DISCARD) return 1; @@ -621,6 +618,10 @@ static inline int ll_new_hw_segment(struct request *req, struct bio *bio, if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req)) goto no_merge; + /* This will merge integrity segments */ + if (!blk_integrity_merge_bio(req->q, req, bio)) + goto no_merge; + /* * This will form the start of a new hw segment. Bump both * counters. @@ -934,7 +935,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) return false; /* only merge integrity protected bio into ditto rq */ - if (blk_integrity_merge_bio(rq->q, rq, bio) == false) + if (!blk_integrity_mergeable(rq->q, rq, bio)) return false; /* Only merge if the crypt contexts are compatible */ diff --git a/block/blk.h b/block/blk.h index 45547bcf1119..5923d2190d91 100644 --- a/block/blk.h +++ b/block/blk.h @@ -189,6 +189,8 @@ static inline bool bio_integrity_endio(struct bio *bio) bool blk_integrity_merge_rq(struct request_queue *, struct request *, struct request *); +bool blk_integrity_mergeable(struct request_queue *rq, struct request *r, + struct bio *b); bool blk_integrity_merge_bio(struct request_queue *, struct request *, struct bio *); @@ -221,6 +223,11 @@ static inline bool blk_integrity_merge_rq(struct request_queue *rq, { return true; } +static inline bool blk_integrity_mergeable(struct request_queue *rq, + struct request *r, struct bio *b) +{ + return true; +} static inline bool blk_integrity_merge_bio(struct request_queue *rq, struct request *r, struct bio *b) { From patchwork Wed May 3 10:13:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1220595vqo; Wed, 3 May 2023 03:31:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6X8ubetyC4hzH0hdCLpJGGtRPB6E3wzC7FHUti3Aa4KsA8ku8Tibt+cj4LfXyyn837YJKZ X-Received: by 2002:a05:6a00:1409:b0:625:ea57:389b with SMTP id l9-20020a056a00140900b00625ea57389bmr25259287pfu.5.1683109915402; Wed, 03 May 2023 03:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109915; cv=none; d=google.com; s=arc-20160816; b=iIXOG/60hngMez7KyH6GUNT2Ec63GUnKX9d1/xxb9aaGnvmarJb3OCptOyqoAIhSKo YMl91XW5S/ptrGyRxXMh4rxtwg+JQg98mwkNqeJX1PyQdaDsM7Rdw3ZpE8Jv/zj1YJUp 9cBx14tzgKDzDtHQ+UdCGLCbbvZPAMzFYcsQYpYCv4plvW8r8he5gCTqOAuCm01c7QdF RioxiREg0jGUsvHrxJI+A1VxLeKePutmsmtlV5GwDsHfj4kt9HYmvnHEOyBaDBTylh/O ZjaL0EGFR2k5SBTXPYWKbxgdtl/V3B6XJA49RZKJE6qKmkoXPno+eYOUKD9KaCjlEVrh X/WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=5spsBQ/UOnjOahi0JzD6hmV/5aBQ7IGxHCQ9KefOjyE=; b=Z8GG9s/F6FKM7BIdqSJ2sZZY5K6OJ1V9BvFUV8BCxVsAcyq8tc4c53tTyQyeeqDfnL v4FEUxYvBFK8xcWe+S645OvDR/aDx96edMj/B7OEyKivMvUdGmCZXTGdrgi27Vg4Z3wB KKLiA/sgNXnP1wZPgmJhaH9amcZZ2mURIQ8QRd5bUQn7TanEqYcnzBqBSJwKTMOPCb6X XxCIv01+eIszBVE1EMm01D7CS5rPm+rXjI4m76CvB/90+/qiRf8uCwqtux1N55uMuiif EyMrw3ZDzWTpb3lWEm6qZaCo2Lrv06a5fkYpXHv5J0ajbvFbEzrC1lw6G7ufj2+Ic9FZ /YtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=T5sgQtkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b005138fd7f1cesi33150002pgh.89.2023.05.03.03.31.42; Wed, 03 May 2023 03:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=T5sgQtkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbjECKN7 (ORCPT + 99 others); Wed, 3 May 2023 06:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbjECKNz (ORCPT ); Wed, 3 May 2023 06:13:55 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E7446AB for ; Wed, 3 May 2023 03:13:53 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503101352epoutp031b5c8741aad3a357ea56a5cc9f2f6cf6~bmpC3bK3p2141521415epoutp036 for ; Wed, 3 May 2023 10:13:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503101352epoutp031b5c8741aad3a357ea56a5cc9f2f6cf6~bmpC3bK3p2141521415epoutp036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108832; bh=5spsBQ/UOnjOahi0JzD6hmV/5aBQ7IGxHCQ9KefOjyE=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=T5sgQtkLpfPBVjNcR07b57q0MOgTYpZ55yuIkkUazLw+zQJm1hqvV36LeGkBgicdp 335d2dUOkbZ/WLFrFD1LI9FLzS8ULUjO0rm77wikVguHawEPzUYBWa40ucY8RDhb3h Dobr//mzyxWoLgZ0GwZG4qMF4Kgf/zisKe6++AI8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230503101351epcas2p40434afb19b942994ca0612bb822eeeeb~bmpCOdERn3032830328epcas2p4s; Wed, 3 May 2023 10:13:51 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCTV6GwDz4x9Pw; Wed, 3 May 2023 10:13:50 +0000 (GMT) X-AuditID: b6c32a47-c29ff70000002007-98-645233dec14f Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id DB.4F.08199.ED332546; Wed, 3 May 2023 19:13:50 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 07/15] block: blk-merge: fix merging two requests in ll_merge_requests_fn 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" , "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: <20230503101350epcms2p63c31a0642156d56853acdcd4754abb50@epcms2p6> Date: Wed, 03 May 2023 19:13:50 +0900 X-CMS-MailID: 20230503101350epcms2p63c31a0642156d56853acdcd4754abb50 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHKsWRmVeSWpSXmKPExsWy7bCmme4946AUg62X9C1W3+1ns3h5SNNi 5eqjTBa9/VvZLPbe0ra4vGsOm8Xy4/+YHNg9Lp8t9dh9s4HN4+PTWywefVtWMXp83iQXwBqV bZORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkDdIOSQlli TilQKCCxuFhJ386mKL+0JFUhI7+4xFYptSAlp8C8QK84Mbe4NC9dLy+1xMrQwMDIFKgwITvj X+8cxoJNvBUb2/rYGxgncncxcnJICJhIvNyzkLWLkYtDSGAHo8S1ZXOAHA4OXgFBib87hEFM YYFoiXtb00HKhQSUJM6tmcUIETaQuNVrDhJmE9CT+LlkBhuILSKwmkmi+XkNxHReiRntT1kg bGmJ7cu3MoLYnAJ+Eo833GKEiGtI/FjWywxhi0rcXP2WHcZ+f2w+VI2IROu9s1A1ghIPfu6G iktKHDr0lQ3kHAmBfIkNBwIhwjUSb5cfgCrRl7jWsRHsBF4BX4kVL1aAjWcRUJVo+DgZ6jQX idPXFoGNZxaQl9j+dg4zyEhmAU2J9bv0IaYrSxy5xQJRwSfRcfgvO8yDDRt/Y2XvmPeECaJV TWJRkxFEWEbi6+H57BMYlWYhwngWkrWzENYuYGRexSiWWlCcm55abFRgDI/W5PzcTYzghKjl voNxxtsPeocYmTgYDzFKcDArifB+KPRLEeJNSaysSi3Kjy8qzUktPsRoCvTwRGYp0eR8YErO K4k3NLE0MDEzMzQ3MjUwVxLnlbY9mSwkkJ5YkpqdmlqQWgTTx8TBKdXA1L5mLzfj+qCkRM8Z +25lT9zvv7fAKvzd05q1625/87n/4XXroXOHX+6sO51n6yxbZhNbU/zwxS5BhSfaInG7nnXb Tuxd3vt9efm0Xqu2A/OF/S1t7nKvDOf7lXVz5b2F2/omFnaFrt/CtkxjenFT8q27Vnbnds+1 P8QQWs46NVmfcY93TclhpVm3lJ9HT1mibPfl7Inwh3uzIwPD24OK9rKv2xe4Z+Xiz/9nztiy 94KL8jv9GK7w9KCPMp5XSw7dj1/jI/88vXZXTNLrrNntKscXXb6sZW+dYulSzCjs7in1p+zI 0QPprmUh3tNCWjU4Fj284Hkzcf+sUJGgZMN/nvciLi9uji+doX2xZH/QMiWW4oxEQy3mouJE AMEW8/cRBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868662590326696?= X-GMAIL-MSGID: =?utf-8?q?1764868662590326696?= blk_integrity_merge_rq() merges integrity segment information of two requests. However, it is only a condition check and does not perform the actual integrity information update. So this was modified. After it is called, the merge process of the requests may fail due to other conditions. At this time, there is an error in the integrity segment information of request. So the call location was also changed. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/blk-integrity.c | 2 ++ block/blk-merge.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 03a85e1f6d2e..f97b7e8a6d4d 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -181,6 +181,8 @@ bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, if (integrity_req_gap_back_merge(req, next->bio)) return false; + req->nr_integrity_segments += next->nr_integrity_segments; + return true; } diff --git a/block/blk-merge.c b/block/blk-merge.c index 8509f468d6d4..c6a0958e8df1 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -711,10 +711,11 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, if (!blk_cgroup_mergeable(req, next->bio)) return 0; - if (blk_integrity_merge_rq(q, req, next) == false) + if (!bio_crypt_ctx_merge_rq(req, next)) return 0; - if (!bio_crypt_ctx_merge_rq(req, next)) + /* this will merge integrity segments */ + if (!blk_integrity_merge_rq(q, req, next)) return 0; /* Merge is OK... */ From patchwork Wed May 3 10:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1226022vqo; Wed, 3 May 2023 03:42:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nzKWxVum4JYtBOKVZxHIBIX8Z2uLYwBDQ0nlTrJ+iwYePRtlXyuORmqjOgGTrUM1F5kfs X-Received: by 2002:a17:902:a408:b0:1a6:386f:39a3 with SMTP id p8-20020a170902a40800b001a6386f39a3mr1737329plq.31.1683110571078; Wed, 03 May 2023 03:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110571; cv=none; d=google.com; s=arc-20160816; b=DOqt2u5HNBUZbUfhuEavZk9bcUcVcCvsuspMDKEVlbO+TF1rJ+PWVxXjiAjUr41xvx sPE9djlByi2wr5RYTUqVW3KDRde61jg3kEg/CBCkbTL6jh+C0/F/RJ9FEYvG9shQ8vkd OgNbuPyjm7nk186N2B/v18l75Md/sBihQLtNYIO+BgjrlDIb5VmgOeCGqLQc+S8SgcW5 gE1s/oJK1B1KdwHPx+XnQgDaxZtRorygmT9FEjpkOS2Ryy+/9VcCm7nsSKevgA33jdCl CZdPpEhK56+QvdymzbjI5YxZyvUjtqnBqz2ULYwcTLEXuWPmrAD3QDj6UMbfCUs7lcH/ akGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=dsClYh4QK7KsYkk+2+MP7q9EBU8OpMqvWeVl/PtqLS8=; b=UgXLGVuMjRcRkVkhCpZrUqHDXcfBXqPDCPhyoZ2ipW1XYdHQtlJUT5GozXEIZz26VU lmx7zIq+hz+0le7tpvhJ7FZtl0l4ULMZOksiNLDkBUmTSrGJp5gUma2oTOK6/FI+FCjS 9Us+kLTOhL0+KLYgT83H4te9FdJbyuY4MFLGwHFivyAV+S85qQbz1sUT12KQXCpJLQ7+ bagju83vpvacIP5lAFnz1uXMEKxF0hcNmGo8YtB3lWbYzFctuo+c1yawVqUDT21pnPij SD+ZBq3VxQnWppOk6NbD14OYuXq+I6bqGWqC+iLP0ZgW4ukIYikxpwYQnfiS7jWsvKtw wEdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YeGXTCaq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001ab2337ecf5si521140plr.467.2023.05.03.03.42.37; Wed, 03 May 2023 03:42:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YeGXTCaq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbjECKQW (ORCPT + 99 others); Wed, 3 May 2023 06:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjECKQU (ORCPT ); Wed, 3 May 2023 06:16:20 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4413249E3 for ; Wed, 3 May 2023 03:16:14 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230503101612epoutp040ab5a810b8c1ff15b4323f2d32993e34~bmrFyFZsp2062520625epoutp04Q for ; Wed, 3 May 2023 10:16:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230503101612epoutp040ab5a810b8c1ff15b4323f2d32993e34~bmrFyFZsp2062520625epoutp04Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683108972; bh=dsClYh4QK7KsYkk+2+MP7q9EBU8OpMqvWeVl/PtqLS8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=YeGXTCaqh/tFo7vqlLQJjqwH3JvYRDv5alKJu+0jsrOP7xan87j/1IDxsGPjQzeKG 5u0VMJGChzEnE64xF/TNjaiBgQ81YiF/h6whbg+MT7usJddlPowvh5hEb5+a5DygfB tifqjP/h1eOQsjUHF9uvsUd1S5Df/cSpwnK5lZX8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230503101612epcas2p117ba29f6e7f6f3ec8f6119f8fa637983~bmrFh2yCv3199031990epcas2p1S; Wed, 3 May 2023 10:16:12 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCXC4cVVz4x9Pv; Wed, 3 May 2023 10:16:11 +0000 (GMT) X-AuditID: b6c32a46-b23fd7000001438d-a7-6452346b8ec5 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id DC.16.17293.B6432546; Wed, 3 May 2023 19:16:11 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 08/15] block: add helper function to get the number of integrity segments 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" , "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: <20230503101611epcms2p57098b1a64ba519b0e2d3cd132d96051a@epcms2p5> Date: Wed, 03 May 2023 19:16:11 +0900 X-CMS-MailID: 20230503101611epcms2p57098b1a64ba519b0e2d3cd132d96051a X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLKsWRmVeSWpSXmKPExsWy7bCmmW62SVCKwYJ+eYvVd/vZLF4e0rRY ufook0Vv/1Y2i723tC0u75rDZrH8+D8mB3aPy2dLPXbfbGDz+Pj0FotH35ZVjB6fN8kFsEZl 22SkJqakFimk5iXnp2TmpdsqeQfHO8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYA3aCkUJaY UwoUCkgsLlbSt7Mpyi8tSVXIyC8usVVKLUjJKTAv0CtOzC0uzUvXy0stsTI0MDAyBSpMyM6Y /OYSY8F7roop138xNzB2cXYxcnBICJhI3Dru08XIxSEksINR4sSscywgcV4BQYm/O4RBTGGB aInJ5327GDmBSpQkzq2ZxQgRNpC41WsOEmYT0JP4uWQGG4gtIrCaSaL5eQ2ILSHAKzGj/SkL hC0tsX35VkYQm1PAT+LxhluMEHENiR/LepkhbFGJm6vfssPY74/Nh6oRkWi9dxaqRlDiwc/d UHFJiUOHvrJBPJIvseFAIES4RuLt8gNQJfoS1zo2gp3AK+ArMXXfebAzWQRUJZpmbIVa5SKx 9sZ2JhCbWUBeYvvbOcwgI5kFNCXW79KHmK4sceQWC0QFn0TH4b/sMA82bPyNlb1j3hMmiFY1 iUVNRhBhGYmvh+ezT2BUmoUI41lI1s5CWLuAkXkVo1hqQXFuemqxUYERPFaT83M3MYLToZbb DsYpbz/oHWJk4mA8xCjBwawkwvuh0C9FiDclsbIqtSg/vqg0J7X4EKMp0MMTmaVEk/OBCTmv JN7QxNLAxMzM0NzI1MBcSZxX2vZkspBAemJJanZqakFqEUwfEwenVAOT0LSborkaqR+2yH8M kJzhKLNS+++ZGU3Vl1xWfCkO4mEvOXDysl/W3vkJL9p/fztTVLd82Qsr1ssiDJY3liwM+3qJ bUVxpIWBzrF/kw9PN19gqGJpudH2+nTNvo37Xvws1RJe7H7owYnvVn68ofeCHid3T7YX/+T4 yGbRUuEFQQXa7xc1CjAes1x29v+/iepXyv7E7P5nYZ96cY/87es5ZzUW7ZumKvnvmJNXSgnP f9PVTTtCD34x17X+0lAjzmi546Mh559L/Bwnzu18XLj6YohQ69kXOVc2ci3PalHm3iu4NGpJ XojS6rP+iyf69N1xOzfxUueGhubeiZrRUz79dUy/t2fCuznT10wsujahaqESS3FGoqEWc1Fx IgCslwboEAQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869350182982522?= X-GMAIL-MSGID: =?utf-8?q?1764869350182982522?= Since request always has the number of integrity segments in the process of generating and merging, a function for simply obtained this has been added. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- include/linux/blk-integrity.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index 378b2459efe2..45b9fde1fee1 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -43,6 +43,11 @@ int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, struct scatterlist *); int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); +static inline unsigned short blk_rq_nr_integrity_segments(struct request *rq) +{ + return rq->nr_integrity_segments; +} + static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) { struct blk_integrity *bi = &disk->queue->integrity; @@ -120,6 +125,10 @@ static inline int blk_rq_count_integrity_sg(struct request_queue *q, { return 0; } +static inline unsigned short blk_rq_nr_integrity_segments(struct request *rq) +{ + return 0; +} static inline int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *b, struct scatterlist *s) From patchwork Wed May 3 10:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1218483vqo; Wed, 3 May 2023 03:27:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6d6mYTSV6dpgmIKsdAaPxj+M7POh+mKvHL/gnz4GNKbI/KYpKUVUHnaiXtFFe5ZOMBiljM X-Received: by 2002:a17:902:74c1:b0:19f:2328:beee with SMTP id f1-20020a17090274c100b0019f2328beeemr1482800plt.11.1683109657215; Wed, 03 May 2023 03:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109657; cv=none; d=google.com; s=arc-20160816; b=R7YaJBckl5/hs2oZDDSZ8W4KQkYCRZPg376h8FuxVAsFfezLAGdJz28sx5nMVc/V/m B1RcLW4Mj24K6t93gRbGjhYzpAWreCF0jispFcnb34vFBvCO/VhMRKCCuD49ISWBpW4n 5/G8Sxdt0pVnJyWL/0om9HKgQ5XGnHEsD35MvxUxciQIOaeywNwOL+d0XzDeUvfiQfPA 8f8hwC8IKV6HHdV5gTrkyWyPmvRe9tdfu20+neGn4rWw9WIsrMcDO18xhmTxpphgD4hp VtYy+stKzGKMPtmsL38vD+S2HupPC6QTma4p+Q7azwG1+kT65MWmooFsCXEAgnCdXPRp jm7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=v5aifcuvT4v06m1yAYerf8h0h01yE8oqVL3cCIFGtC8=; b=eEye2ajIaCTgeKeOfqWPg8Wuh8UXbq02z7NwlgQ3cGCT8lrorZz9RbJaAZjAsEuJuO 8o76t+EsmebqOPLqxEZnQls9JlTKFyAWSqEcpHwSz/9rA1SmV10vRfsd8Dyg1MSV2vvh PT10xt5NORrAsAr556PsX52D/Aq5EIwUx4tnrUd1nSgzBTCuifh/aMqOjyk3TtqbmqL5 p5zRotK6rIRcBwMjlt2lmlcFwXqQ3gC5AqUziOKxXJOokPmwmnAFNPMpihE2ijq9rfoW Rjw4skTInw2t2Qhp44tnCt1DTPuboBgRqaxTTVGvK7mVxaoQHQ/0wOfulxM9k0UNh6rz QDdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=myswX6Ux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a170902dac400b001a9627e55c3si27971432plx.520.2023.05.03.03.27.24; Wed, 03 May 2023 03:27:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=myswX6Ux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbjECKS2 (ORCPT + 99 others); Wed, 3 May 2023 06:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjECKS0 (ORCPT ); Wed, 3 May 2023 06:18:26 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2433410F3 for ; Wed, 3 May 2023 03:18:25 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230503101823epoutp04815e1c14af75c719f65d18de3dfea4e1~bms-oWC1h2446024460epoutp04b for ; Wed, 3 May 2023 10:18:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230503101823epoutp04815e1c14af75c719f65d18de3dfea4e1~bms-oWC1h2446024460epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109103; bh=v5aifcuvT4v06m1yAYerf8h0h01yE8oqVL3cCIFGtC8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=myswX6UxBKURqrjDtEP0GJhJBNd0eaji8TVOc/qyvb+cpSkZ0z6IIBzA55CTGpsmJ WoNZ/f4vUAIC/fLMsesY4yH3pDbthdqmOX+7shEHsY8u1Cfxqn1aTSAOb2Calo+noD kMX9bsxXDjPvnh1JiYMqnWOba95gTDxG8a1B1VKM= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230503101822epcas2p41907fc7be801aa47a35830041603d10e~bms-EZHM-1649716497epcas2p4q; Wed, 3 May 2023 10:18:22 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.98]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCZk2lGCz4x9Q5; Wed, 3 May 2023 10:18:22 +0000 (GMT) X-AuditID: b6c32a46-b23fd7000001438d-ff-645234ee3fd6 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 27.C6.17293.EE432546; Wed, 3 May 2023 19:18:22 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 09/15] scsi: add scsi_alloc_integrity_sgtables() for integrity process Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: Jinyoung CHOI , "axboe@kernel.dk" , "hch@lst.de" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "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: <20230503101822epcms2p3ce469757778cee255368e213755d58d6@epcms2p3> Date: Wed, 03 May 2023 19:18:22 +0900 X-CMS-MailID: 20230503101822epcms2p3ce469757778cee255368e213755d58d6 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupik+LIzCtJLcpLzFFi42LZdljTXPedSVCKwcEdghar7/azWbw8pGmx cvVRJove/q1sFotubGOy2HtL2+LyrjlsFsuP/2Ny4PC4fLbUY8KiA4weu282sHl8fHqLxaNv yypGj8+b5ALYorJtMlITU1KLFFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8hJzU22VXHwC dN0yc4CuUVIoS8wpBQoFJBYXK+nb2RTll5akKmTkF5fYKqUWpOQUmBfoFSfmFpfmpevlpZZY GRoYGJkCFSZkZ/zsfcVW8FGyYtPJY4wNjJNEuxg5OSQETCRaF0xi72Lk4hAS2MEo0fhnN3MX IwcHr4CgxN8dwiA1wgIREr07VzCD2EICShLn1sxiBCkRFjCQuNVrDhJmE9CT+LlkBhvIGBGB G0wSez6/ZoaYzysxo/0pC4QtLbF9+VZGEJtTwE/i8YZbjBBxDYkfy3qh6kUlbq5+yw5jvz82 H6pGRKL13lmoGkGJBz93Q8UlJQ4d+soGco+EQL7EhgOBEOEaibfLD0CV6Etc69gIdgKvgK/E gf7nYDaLgKrEy4sgrSA1LhJ9z9ezgtjMAvIS29/OAYcCs4CmxPpd+hDTlSWO3GKBqOCT6Dj8 lx3mwYaNv7Gyd8x7wgTRqiaxqMkIIiwj8fXwfPYJjEqzEKE8C8naWQhrFzAyr2IUSy0ozk1P LTYqMIJHbHJ+7iZGcKLUctvBOOXtB71DjEwcjIcYJTiYlUR4PxT6pQjxpiRWVqUW5ccXleak Fh9iNAV6eCKzlGhyPjBV55XEG5pYGpiYmRmaG5kamCuJ80rbnkwWEkhPLEnNTk0tSC2C6WPi 4JRqYNpyr65/rgm7k9xiHl6XPzbfBfv2xVw+GlG5aOMzp+JP+5Q392/YVz7pUH9p8N3HnVu1 F2Zor7gZlvK66MfLK1dnz/XZvKJkzq+MjVHrfI+oMv0uE3h33+bg6/s7eG6yGnMJujzJK09r yPtR7KE9eaVhs/dv6+hHtUpyx+ebHHXa+UTPcn/wEYee1MCfsbzJJa2bTyevS9+0ZlI1x7cm /49+hcsi/623nz/t70GdriqxiSyXJmczse2q4e5inmERXiCpOsX526Qlk0SYTXLUgrbJnuqb 0FUlZCacomhx9xBT0xLXWh7mjrqdS+6fDFYpNBJdeoCr133r7hMT7H5NXfbCRKP3tFnAP/tp Evzi0kosxRmJhlrMRcWJAHg749UdBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868391880239248?= X-GMAIL-MSGID: =?utf-8?q?1764868391880239248?= Separate the integrity mapping process of scsi_alloc_sgtables() into a new function for readability. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- drivers/scsi/scsi_lib.c | 71 ++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b7c569a42aa4..89cf21345e1a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1003,6 +1003,40 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev, sdev->host->hostt->dma_need_drain(rq); } +static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) +{ + struct request *rq = scsi_cmd_to_rq(cmd); + struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; + int count, ivecs; + + if (WARN_ON_ONCE(!prot_sdb)) { + /* + * This can happen if someone (e.g. multipath) + * queues a command to a device on an adapter + * that does not support DIX. + */ + return BLK_STS_IOERR; + } + + ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); + + if (sg_alloc_table_chained(&prot_sdb->table, ivecs, + prot_sdb->table.sgl, + SCSI_INLINE_PROT_SG_CNT)) { + return BLK_STS_RESOURCE; + } + + count = blk_rq_map_integrity_sg(rq->q, rq->bio, prot_sdb->table.sgl); + + BUG_ON(count > ivecs); + BUG_ON(count > queue_max_integrity_segments(rq->q)); + + cmd->prot_sdb = prot_sdb; + cmd->prot_sdb->table.nents = count; + + return BLK_STS_OK; +} + /** * scsi_alloc_sgtables - Allocate and initialize data and integrity scatterlists * @cmd: SCSI command data structure to initialize. @@ -1021,7 +1055,7 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd) struct request *rq = scsi_cmd_to_rq(cmd); unsigned short nr_segs = blk_rq_nr_phys_segments(rq); struct scatterlist *last_sg = NULL; - blk_status_t ret; + blk_status_t ret = BLK_STS_OK; bool need_drain = scsi_cmd_needs_dma_drain(sdev, rq); int count; @@ -1071,40 +1105,11 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd) cmd->sdb.length = blk_rq_payload_bytes(rq); if (blk_integrity_rq(rq)) { - struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; - int ivecs; - - if (WARN_ON_ONCE(!prot_sdb)) { - /* - * This can happen if someone (e.g. multipath) - * queues a command to a device on an adapter - * that does not support DIX. - */ - ret = BLK_STS_IOERR; - goto out_free_sgtables; - } - - ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); - - if (sg_alloc_table_chained(&prot_sdb->table, ivecs, - prot_sdb->table.sgl, - SCSI_INLINE_PROT_SG_CNT)) { - ret = BLK_STS_RESOURCE; - goto out_free_sgtables; - } - - count = blk_rq_map_integrity_sg(rq->q, rq->bio, - prot_sdb->table.sgl); - BUG_ON(count > ivecs); - BUG_ON(count > queue_max_integrity_segments(rq->q)); - - cmd->prot_sdb = prot_sdb; - cmd->prot_sdb->table.nents = count; + ret = scsi_alloc_integrity_sgtables(cmd); + if (ret != BLK_STS_OK) + scsi_free_sgtables(cmd); } - return BLK_STS_OK; -out_free_sgtables: - scsi_free_sgtables(cmd); return ret; } EXPORT_SYMBOL(scsi_alloc_sgtables); From patchwork Wed May 3 10:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1220856vqo; Wed, 3 May 2023 03:32:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kvItvHRQm+ZA+FvGB887jq/wX8ZWhv9xwnkQ72VXPhJ4yY0aAnDTVDNXk5TU+5BEhXpwe X-Received: by 2002:a05:6a00:1a0a:b0:63b:7119:64a9 with SMTP id g10-20020a056a001a0a00b0063b711964a9mr27833718pfv.16.1683109939446; Wed, 03 May 2023 03:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683109939; cv=none; d=google.com; s=arc-20160816; b=rwirLZeFn4TSiq7W2QVDcNKhKYzbtK8NwqXmN/hyrHsXLuhfW9WebLkfEnc9XpvFic 8MfPH1hhqMEkMFDq8Z8D8E243XiMXcxmIbLYzHPlgctDBAxp40oZoKNcQzF8nTEdpH+d WiuadWNvx3tgPMc9kpXT/d2E8RHRMbTnVmdi3iLlYDJq50Cm94j+zWR6odUvXkH6J6eG qW2IWTxCsezwGwU3NtlAiNXxbcmH+UgqC9kQIKMHdarMuFNv7W4eh4yDPFmqYdPu70ei kaiM6LJz4m+3fp98xZwvryanMx4ThVSHNgpKmAsvtLouNrFnXUfjZb6K83evisGlJmdY r1jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=J1DOTjK8gn87giwmABoGcvRXxfDSssG6aRXYYY56duk=; b=NB0UZmp0FGSB70kNGm0yeWITMx2+qu/EsMx46V/d4Qxi85Fi3Ac2RD16rxOi+vDuO9 H9q6L6qZCjx4/jTSrq3VRxzwTOLKG6hK1rdFU+orBPycPSjf/eDDLcXFrtQFpUUGyAIv fZfLkTo96uYLI4Z+OhqQVvr58wVVE4aoJJZSYy41ZJi3zTcpgZDeK70YeHKs0CHvu/05 OMzTcneRnVLNXTeONolYdgF4A3xMQ6ee6lHWcwFd+vV362WS5D7pPCbsIH46OSIuPL+R pE95AggO6iCF2AlbsRXzPV0uVeuq4NQmF4Yg9fK5g76g44KyHHseao70/5ZRxqZ/6QTl CRMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SYz7FF1K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a62cf07000000b0063a149e3c85si32084645pfg.401.2023.05.03.03.31.41; Wed, 03 May 2023 03:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SYz7FF1K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjECKUn (ORCPT + 99 others); Wed, 3 May 2023 06:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbjECKUk (ORCPT ); Wed, 3 May 2023 06:20:40 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7BFC3C01 for ; Wed, 3 May 2023 03:20:36 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503102034epoutp038516e84dadbf9a7f8e767c6ff62cb6da~bmu6DyAvz2814228142epoutp03S for ; Wed, 3 May 2023 10:20:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503102034epoutp038516e84dadbf9a7f8e767c6ff62cb6da~bmu6DyAvz2814228142epoutp03S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109234; bh=J1DOTjK8gn87giwmABoGcvRXxfDSssG6aRXYYY56duk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=SYz7FF1KL6BdMYc160Ff2BtS1fSYTB0TvuSmDXSZ9jhcWA7zFLJ05/XoqOSxwq0dz ZHQkL4ufCrdiyjcenkYJU2TvFn4iXmiHOQoNudDXQpZqSVDuRbn8kkHK1kFFxBd6Vc FA/Jz595IT+vNeueLQc4D4PHN798KQ09dAmtfTfU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503102034epcas2p34b8034eb2deb907bbf5df2d4aa118ce5~bmu5juCS13143031430epcas2p3V; Wed, 3 May 2023 10:20:34 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.90]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCdF6VV4z4x9Q5; Wed, 3 May 2023 10:20:33 +0000 (GMT) X-AuditID: b6c32a47-c29ff70000002007-03-6452357195ef Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 6F.61.08199.17532546; Wed, 3 May 2023 19:20:33 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 10/15] scsi: change to use blk_rq_nr_integrity_segments() instead of blk_rq_count_integrity_sg() Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: Jinyoung CHOI , "axboe@kernel.dk" , "hch@lst.de" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "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: <20230503102033epcms2p5791708735197d3aac4fe546bcd7ac387@epcms2p5> Date: Wed, 03 May 2023 19:20:33 +0900 X-CMS-MailID: 20230503102033epcms2p5791708735197d3aac4fe546bcd7ac387 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkk+LIzCtJLcpLzFFi42LZdljTXLfQNCjF4PItY4vVd/vZLF4e0rRY ufook0Vv/1Y2i0U3tjFZ7L2lbXF51xw2i+XH/zE5cHhcPlvqMWHRAUaP3Tcb2Dw+Pr3F4tG3 ZRWjx+dNcgFsUdk2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6hpYW5koKeYm5qbZKLj4B um6ZOUDXKCmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0tslVILUnIKzAv0ihNzi0vz0vXyUkus DA0MjEyBChOyM/Zums9UsImvYuKqbewNjBN5uhg5OSQETCTOnl7D0sXIxSEksINRYu2L/6xd jBwcvAKCEn93CIOYwgJFEpPXR4OUCwkoSZxbM4sRImwgcavXHCTMJqAn8XPJDDaQKSICN5gk 9nx+zQwxnldiRvtTFghbWmL78q2MIDangJ/E4w23GCHiGhI/lvVC1YtK3Fz9lh3Gfn9sPlSN iETrvbNQNYISD37uhopLShw69JUN5B4JgXyJDQcCIcI1Em+XH4Aq0Ze41rER7AReAV+Jhvsb wGwWAVWJb1f+MUHUuEj0/l8PNp5ZQF5i+9s5zCAjmQU0Jdbv0oeYrixx5BYLRAWfRMfhv+ww DzZs/I2VvWPeEyaIVjWJRU1GEGEZia+H57NPYFSahQjkWUjWzkJYu4CReRWjWGpBcW56arFR gTE8XpPzczcxgtOklvsOxhlvP+gdYmTiYDzEKMHBrCTC+6HQL0WINyWxsiq1KD++qDQntfgQ oynQwxOZpUST84GJOq8k3tDE0sDEzMzQ3MjUwFxJnFfa9mSykEB6YklqdmpqQWoRTB8TB6dU A1PA0xgh9puejDxS6XIqbl23ryutmTVBx/VG+WlNlRlMWom3592p8hbTv7iv9dPUhazpP5sl vnQkbeFNm99j1F8XJv1/YVmx4PsPPBprF4hf9M8OOX21bv2JipKt0iqNZ1imSK11as5Z8O+D xT+nPfG1Xw9F6VuVeCgsdni+qnPbPAeWSa4GYhpbmS9ablltxMSpdeXP24QIY93+V0fP8r5Y zvWNXaFc+bTF9SWGPtMT3ld86o0t42NYnmPCOpXXfgGvyleGBbMsH1nnWMrxSPx0+Jq/Vm/K pSw2zb7pBYFuVbNfa3s6Ob7nNbbP8NeI+ZqnlB8T39a6Y15Mzs6jXX8Ny1gXrBH1193ikPVc iaU4I9FQi7moOBEAdX0yCBwEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764868688120921450?= X-GMAIL-MSGID: =?utf-8?q?1764868688120921450?= In the block layer, the number of segments is recorded in the request. It is already divided into separate segments based on hw information. Therefore, there is no need to count again. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- drivers/scsi/scsi_lib.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 89cf21345e1a..5d67b6f6854e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1006,8 +1006,9 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev, static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) { struct request *rq = scsi_cmd_to_rq(cmd); + unsigned short nr_integrity_segs = blk_rq_nr_integrity_segments(rq); struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; - int count, ivecs; + int count; if (WARN_ON_ONCE(!prot_sdb)) { /* @@ -1018,9 +1019,7 @@ static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) return BLK_STS_IOERR; } - ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); - - if (sg_alloc_table_chained(&prot_sdb->table, ivecs, + if (sg_alloc_table_chained(&prot_sdb->table, nr_integrity_segs, prot_sdb->table.sgl, SCSI_INLINE_PROT_SG_CNT)) { return BLK_STS_RESOURCE; @@ -1028,10 +1027,7 @@ static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) count = blk_rq_map_integrity_sg(rq->q, rq->bio, prot_sdb->table.sgl); - BUG_ON(count > ivecs); - BUG_ON(count > queue_max_integrity_segments(rq->q)); - - cmd->prot_sdb = prot_sdb; + BUG_ON(count > prot_sdb->table.nents); cmd->prot_sdb->table.nents = count; return BLK_STS_OK; From patchwork Wed May 3 10:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1225307vqo; Wed, 3 May 2023 03:41:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Al05Dn62H+Cs3QYAh2d1nnLafAJTQper3CSsw0UHdu+qsxZFgBMqd4fKOCCwYGXG5a/td X-Received: by 2002:a05:6a20:9f49:b0:ef:70b:42fc with SMTP id ml9-20020a056a209f4900b000ef070b42fcmr21122195pzb.38.1683110478691; Wed, 03 May 2023 03:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110478; cv=none; d=google.com; s=arc-20160816; b=k0dv5R/2iXbhRrHJZSVruwSFOX2i08s2Z9DUEi20RktOKSaitturuRfce3cbx2SaKz QmklfhXi7gZujGDWFplCs1YNypWVskEsk1dKYCfnmfKWDkQEb6YA3f2S/pYnS2XvILFI Aoz5XDErPvOoh05l+S0ax/OPQxEX3oAu1Uw8trQ6VmLPXh5zJ4aj2GcOOmEOr2LZmZrU nb2F3ANLma2gUCEp0Aur0iHXorDHrYV44utJMnu4nHvliux6AjwAh4BTwf9/zKX3Y+6l FIYACVFYUSZgs2Ck8xyyNtsJJotr33x1j/SbFzmZu5D7BwyV+sBVs/OCyXzKLcVeLNIv mzEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=ZfhC85BvKxKIuur1CoeZsaWeIlAnBRlkMNE/o0TIGEU=; b=ZUjwyjHdHWMwFplMrper/VvETGy9Za75maelSFfNyZsKgr2b7I3JG4bSMyU3rdPPFh J4sACD1RHeAZpDf1U/XxqnU2FC4o7BMzFPLAvilZMfD9hoWNh9iB/CiDwNYgufy6jnXl MRaSTjUcQ/PI4HA8bpGkBZ2uYk2OmxdzlGvDvrP+1dAmsHcneYJDBrGoBMCXZBJ2LTJY ONiiSKOP9Cui1MM8TE9FHLr/stVJ35yaDIrbgCeEXui7ovDNcMyBZNTmF8D3AhQlHV5L Jy5QI3c02Ddp6PDckbB0EtnVgZBIO7HKvjm03x1hSgazvcPaQBYWbZ3veoJDJJjo+ZWl S+wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jyNXa3IL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020aa796b0000000b0063b86ce6813si32463585pfk.41.2023.05.03.03.41.05; Wed, 03 May 2023 03:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jyNXa3IL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjECKVv (ORCPT + 99 others); Wed, 3 May 2023 06:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjECKVs (ORCPT ); Wed, 3 May 2023 06:21:48 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F36AE43 for ; Wed, 3 May 2023 03:21:47 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230503102145epoutp026c754d4c39cf36e2b10f4fa18193150a~bmv8GnkyF2929529295epoutp02f for ; Wed, 3 May 2023 10:21:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230503102145epoutp026c754d4c39cf36e2b10f4fa18193150a~bmv8GnkyF2929529295epoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109305; bh=ZfhC85BvKxKIuur1CoeZsaWeIlAnBRlkMNE/o0TIGEU=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=jyNXa3IL3Wf63GZMeW5DyDIFhXPN7xFgXXLQCFE7ziOOvvmXjUK0EeWobmCywJ+Pd C4UHvEhtFAgX5XWt4dzB7Ls22Z9RkSUyw04KdEKCHVpRyGLyGsJ4P5b2G4HD6+i4a8 emHRb2n4pvR1aFR/66ZpzfOEbYi2B1CN5B8MDsC4= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503102145epcas2p3ebef196678b9f539e5eef8d92b0100c6~bmv7h2NWR1582715827epcas2p3Z; Wed, 3 May 2023 10:21:45 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.89]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QBCfc525gz4x9Pw; Wed, 3 May 2023 10:21:44 +0000 (GMT) X-AuditID: b6c32a45-6d1fd70000020cc1-fb-645235b806a6 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id B3.70.03265.8B532546; Wed, 3 May 2023 19:21:44 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 11/15] block: blk-integrity: change how to find the number of integrity of bio 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" , "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: <20230503102144epcms2p5ba957092cb811a6ed6cce92debe6e10c@epcms2p5> Date: Wed, 03 May 2023 19:21:44 +0900 X-CMS-MailID: 20230503102144epcms2p5ba957092cb811a6ed6cce92debe6e10c X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmme4O06AUg9aVqhar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ1x dc511oINnBWdq28xNzA+Y+9i5OSQEDCR+DNzClMXIxeHkMAORokjp3oYuxg5OHgFBCX+7hAG qREWSJB43fKIFcQWElCSOLdmFliJsICBxK1ec5Awm4CexM8lM9hAbBGB1UwSzc9rIMbzSsxo f8oCYUtLbF++lRHE5hTwk3i84RYjRFxD4seyXmYIW1Ti5uq37DD2+2PzoWpEJFrvnYWqEZR4 8HM3VFxS4tChr2wg50gI5EtsOBAIEa6ReLv8AFSJvsS1jo1gJ/AK+ErMaVoNNp5FQFWi5/lS VogaF4nJM1vBbGYBeYntb+cwg4xkFtCUWL9LH2K6ssSRWywQFXwSHYf/ssM82LDxN1b2jnlP mCBa1SQWNRlBhGUkvh6ezz6BUWkWIpBnIVk7C2HtAkbmVYxiqQXFuempxUYFhvB4Tc7P3cQI TolarjsYJ7/9oHeIkYmD8RCjBAezkgjvh0K/FCHelMTKqtSi/Pii0pzU4kOMpkAPT2SWEk3O ByblvJJ4QxNLAxMzM0NzI1MDcyVxXmnbk8lCAumJJanZqakFqUUwfUwcnFINTB5sOidzuEU/ 7mE7UurH28RrvXwz92TxttpkC+9/rq+1RP2u5/4K/i9g31y+l/t479v357K65DZOltDMvW53 b02PHotc/zWHrgW9DGd1uZo4Lyo1H2tbv++uz3nP7Ss+9PN6bO//p/Hni17SwiPNVaJe1hwX 3Ru1ysqKJrt9lV63nGfCJpYVotEHZjY6xc09zb1g8c8dVku2aq/f9Hdvd/YNx97qE9rXO4q8 P0h873Hi9Cr8vLROK7e42mGLbEXTFkZT/TVmmV6eXnOq5y5nargXy3t3SmTTjdNXzR6dTSn/ 9mjJjIU3FCafsl7T4PxyDtfmvIMXC5xWab1733524/Od/6eo6PjtcCmZ2fcgVYmlOCPRUIu5 qDgRAJUtFKESBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869253299405687?= X-GMAIL-MSGID: =?utf-8?q?1764869253299405687?= The method of constructing a bip has been changed, the number of segments can be obtained through bip_vcnt. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/blk-integrity.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index f97b7e8a6d4d..64407b412947 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -217,7 +217,6 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, struct bio *bio) { int nr_integrity_segs; - struct bio *next = bio->bi_next; if (blk_integrity_bypass_check(req, bio)) return true; @@ -225,9 +224,7 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, if (!__blk_integrity_mergeable(q, req, bio)) return false; - bio->bi_next = NULL; - nr_integrity_segs = blk_rq_count_integrity_sg(q, bio); - bio->bi_next = next; + nr_integrity_segs = bio_integrity(bio)->bip_vcnt; if (req->nr_integrity_segments + nr_integrity_segs > q->limits.max_integrity_segments) From patchwork Wed May 3 10:23:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1227916vqo; Wed, 3 May 2023 03:46:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79THMqdb6z702G1kBUZDISDZm2KobxLB0t5FUFSZxQcuwqKEKTRoKP7F2v8ffpUkr8S1Wu X-Received: by 2002:a17:902:e841:b0:1ab:70b:f8f4 with SMTP id t1-20020a170902e84100b001ab070bf8f4mr2070890plg.14.1683110789031; Wed, 03 May 2023 03:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110789; cv=none; d=google.com; s=arc-20160816; b=TazK4UhxcVFx2jWurlGVUNtLWWFmHVNSgUlEdlvAEHeUiW85A9VDwfH9c0utEiFyyn feGNt9HVqr2ACFXZ1tLkNVn+PP2oCmFzR27FS4W73Mz9GQMIoD7eWMrJE9nCO8g00ZjB sIaDRaM4f4KY5trhZ1DGCq38qm1K+qb3pzI48l4RD6PtYn4T6ibHYlys2jOZWVgQF/rx fhHIL8T7uvLNXjRME/FCK3Jit2YDcT5pJdjUaLfj9375U9922uYg4W0A0ttcboGP9RVC Q84FBY6wyq0L2mOGFuXXNkUWGplKXMsp6s3G/YscGJ9Dq99YL1FpoA4jia8MuneSrO7V pxgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=ZM+sCSOwfR6BMhP2ycEflPofWbLGNzFKU7U4qcknaW8=; b=IQr9azkXCSZoqEa/OD6UImvO0VNCk08TSRKqS5AHSBzWQwJDshAE4mEFQ2I+0SepR0 HzWLZvxsBbXzF1Xvzr1y2ugYtKBeuuCjUUVfyZ09graNm7A13tG52EX2ZSjh2nD+TeQ5 de0u2KmBKuGZklwDwR9EF/SjCvUY3+4KRR8juaLlxXYQBMce1YZ3/3KG45kkeL/GWw6W MbEBSpUe/e8c/LV00OtT4WsXrGIhHOByqI3ge4q53s1CLjR5rxqGAkKpuHlx/HTXjo90 qyykxeY0r25dw8nhTeiabjUX8UbUBdHaajJVvA1nYldNpBZHituj/LZ8prTSAgGvsjNq XMkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=uMFqmCmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020a170902759100b001a511921c06si31210213pll.358.2023.05.03.03.46.13; Wed, 03 May 2023 03:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=uMFqmCmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbjECKXU (ORCPT + 99 others); Wed, 3 May 2023 06:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjECKXR (ORCPT ); Wed, 3 May 2023 06:23:17 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9DBF35A6 for ; Wed, 3 May 2023 03:23:16 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230503102315epoutp04f0b13ee2f0d05507a3f91f0ef45d9d58~bmxPaNas92811028110epoutp04Z for ; Wed, 3 May 2023 10:23:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230503102315epoutp04f0b13ee2f0d05507a3f91f0ef45d9d58~bmxPaNas92811028110epoutp04Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109395; bh=ZM+sCSOwfR6BMhP2ycEflPofWbLGNzFKU7U4qcknaW8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=uMFqmCmiUEeBZWiL9Sb6hAb6ydvxZNtemId5ZGobtPPI38INS2yHBf7GouLIc64fs h6Drg74VaNZ+cxboIWBKtVNNWF4p8w1ibL5/51gB+zzJpnhvIhGu5g2S+IoWERpepA bh43MtBAgOcGu/i+QYkUtfJoBagWscsr7doiCb5w= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230503102314epcas2p47f783c917b77e312bf1314b109badd5d~bmxOoSSjZ1780817808epcas2p4J; Wed, 3 May 2023 10:23:14 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.88]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QBChK6q5Lz4x9Px; Wed, 3 May 2023 10:23:13 +0000 (GMT) X-AuditID: b6c32a48-6d3fa70000005998-5b-645236115133 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 73.DF.22936.11632546; Wed, 3 May 2023 19:23:13 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 12/15] nvme: rdma: change how to find the number of integrity of request Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: Jinyoung CHOI , "axboe@kernel.dk" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "martin.petersen@oracle.com" , "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: <20230503102313epcms2p52eb54df61b367ae233c4dfe7c6594918@epcms2p5> Date: Wed, 03 May 2023 19:23:13 +0900 X-CMS-MailID: 20230503102313epcms2p52eb54df61b367ae233c4dfe7c6594918 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMJsWRmVeSWpSXmKPExsWy7bCmha6gWVCKwft7Jhar7/azWbw8pGmx cvVRJove/q1sFpMOXWO02HtL2+LyrjlsFsuP/2OyWPf6PYsDp8f5extZPC6fLfXYtKqTzWP3 zQY2j49Pb7F49G1ZxejxeZNcAHtUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5 kkJeYm6qrZKLT4CuW2YO0F1KCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnALzAr3i xNzi0rx0vbzUEitDAwMjU6DChOyMXZ82MxbsYa/o3jmHsYFxFVsXIyeHhICJRMOX+exdjFwc QgI7GCUaemcDJTg4eAUEJf7uEAapERaIkphzYjUTiC0koCRxbs0sRpASYQEDiVu95iBhNgE9 iZ9LZoCNFBH4yySx80U+xHheiRntT1kgbGmJ7cu3MoLYnAJ+Eo833GKEiGtI/FjWywxhi0rc XP2WHcZ+f2w+VI2IROu9s1A1ghIPfu6GiktKHDr0FexiCYF8iQ0HAiHCNRJvlx+AKtGXuNax EewEXgFfiWcz/oLZLAKqEv/mX4aqcZHoXP8DbC2zgLzE9rdzmEFGMgtoSqzfpQ8xXVniyC0W iAo+iY7Df9lhHmzY+Bsre8e8J0wQrWoSi5qMIMIyEl8Pz2efwKg0CxHIs5CsnYWwdgEj8ypG sdSC4tz01GKjAhN4vCbn525iBKdOLY8djLPfftA7xMjEwXiIUYKDWUmE90OhX4oQb0piZVVq UX58UWlOavEhRlOghycyS4km5wOTd15JvKGJpYGJmZmhuZGpgbmSOO/HDuUUIYH0xJLU7NTU gtQimD4mDk6pBqY+qSD51z6didP3dxdsaNos//e/2NujIRdFq269/eXo0PLppqPvkhC7ze8P /+ANiev94eu6deFGlW3eyU+0U2uOsmf8b5W6t/+YffPLo/PW2Zzme7X6XVN1r9A81bWySv83 zTvPkfT48CFV3VIzCaHFjPe43icbm8+8UKf3sOS94r41hQVfl/BvMHYVZ66r8jbMrmd4u6JR Ovbo7UtFexItxdOyevguOJ/TPHzk5bZD7y6uC34x/yvnbTvH3vpWy9867IsfVYSL2ji0b9Se cWCjmtQ0XTbtDoGvzL0pE25kVyQJmrf0r2JQvvgj8kZnFVPD7iuT/3bfvpjcP+3Kko61YcFu 01M359vYNR3TF1NiKc5INNRiLipOBACEuYZEJgQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869578732802629?= X-GMAIL-MSGID: =?utf-8?q?1764869578732802629?= Since the request has the number of integrity segments, change to use the relevant api. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 0eb79696fb73..237d81ad54af 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1507,7 +1507,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq, req->metadata_sgl->sg_table.sgl = (struct scatterlist *)(req->metadata_sgl + 1); ret = sg_alloc_table_chained(&req->metadata_sgl->sg_table, - blk_rq_count_integrity_sg(rq->q, rq->bio), + blk_rq_nr_integrity_segments(rq), req->metadata_sgl->sg_table.sgl, NVME_INLINE_METADATA_SG_CNT); if (unlikely(ret)) { 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: 89699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1228544vqo; Wed, 3 May 2023 03:47:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ674k7LrS8hcP2iHLVt1DVGZhjrQj4wO+JbSSBo0LovkoanEp+EoMD576um0+M28c3Lvw59 X-Received: by 2002:a05:6a20:9191:b0:f2:dc4d:935d with SMTP id v17-20020a056a20919100b000f2dc4d935dmr26381874pzd.18.1683110875900; Wed, 03 May 2023 03:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110875; cv=none; d=google.com; s=arc-20160816; b=PZUuVEeBG/JfYZs+lxpJL8uCAet6UyhJ2iK9DprH8u0q/R7b/T6e+ILUVVbjjMFAx+ ozvbYtR3mIRNnZWC3d+/11j6argIFFGb3O2Z1UtG1v2pZTWERGnfaTKbi2qhxbkH/qEl tvgiIgYAUpsbabOHyGBo7+1+CJxgeKXkDeWeZ9qheaKDtkkLBn9l9dFpW8O0CSaPu6TD vxCOoAWvs0Nsg0qJf0kKEpv4cfcNtcaDNBlb3dneFGJBjtn+QJqzc5aFfl4/0W+lzy9w jQCke5yUB9cNUZyHWKNnrrOwX910l2szbWjfRWslPsvQLrnB90MBE/j8BZ983P0dkFtd MMOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=Qu9Yx8AHfpqjx58Hv8uRZKjzvr/nHdB5F0/a51oGkO8=; b=Yt/StVXYOb2nV5pefFgjCAqQwgeMFuktOJiiVJ3dOywNlxqEbT6W9dhfkHFhQQlO1a /rndXfB0cyK+cRihKAwHfPBodMX829GfEc1tZgiPpLM0zYqxvJ5ff2gLk8V4fz5/itKW d/sOlMATKJ9vYL2wFjbnrCFhkCyD0OypzN/MHh+VTYld5SHM8vIM8Dqodpj7zdlugQoM Z2FT26LMOM1JO9FmAF8QV6AeT2H7eC3SVyzOY2W9vtk+WT6Sg/BC/0hjFakGHynXAcwk +Y75C8WrAED5KCd55jM4Ie+qXHG+4AvvioMX90Un4VYAL9qImpg3dxv+CpPZCzybJaW1 8xmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MsXLWRzS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i64-20020a638743000000b005250aba0763si26734529pge.97.2023.05.03.03.47.41; Wed, 03 May 2023 03:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MsXLWRzS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjECKZv (ORCPT + 99 others); Wed, 3 May 2023 06:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbjECKZt (ORCPT ); Wed, 3 May 2023 06:25:49 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5DA33C01 for ; Wed, 3 May 2023 03:25:45 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230503102544epoutp0330a64cf2863dd54745fbc569bec2ac34~bmzaHMjUN3193131931epoutp03n for ; Wed, 3 May 2023 10:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230503102544epoutp0330a64cf2863dd54745fbc569bec2ac34~bmzaHMjUN3193131931epoutp03n 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+NgFprLJsWRmVeSWpSXmKPExsWy7bCmue4ys6AUg94OI4vVd/vZLF4e0rRY ufook0Vv/1Y2i79d95gsnl6dxWSx95a2xeVdc9gslh//x2Tx+8ccNgcuj80rtDwuny312H2z gc2jt/kdm8fHp7dYPPq2rGL0+LxJzqP9QDdTAEdUtk1GamJKapFCal5yfkpmXrqtkndwvHO8 qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0IFKCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul 1IKUnALzAr3ixNzi0rx0vbzUEitDAwMjU6DChOyMBT+2sBU84q2Y1d7I3sC4mruLkZNDQsBE Yt2u6cxdjFwcQgI7GCVunNgM5HBw8AoISvzdIQxSIyzgL9G+9x87iC0koCRxbs0sRpASYQED iVu95iBhNgE9iZ9LZrCBjBER2MUs8fXcRiaI+bwSM9qfskDY0hLbl29lBLE5BfwkHm+4xQgR 15D4sayXGcIWlbi5+i07jP3+2HyoGhGJ1ntnoWoEJR783A0Vl5Q4dOgrG8g9EgL5EhsOBEKE ayTeLj8AVaIvca1jI9gJvAK+Ege+HmEFsVkEVCWuz2mBGukisWfFVLA4s4C8xPa3c8ChwCyg KbF+lz7EdGWJI7dYICr4JDoO/2WHebBh42+s7B3znjBBtKpJLGoyggjLSHw9PJ99AqPSLEQo z0KydhbC2gWMzKsYxVILinPTU4uNCozgEZucn7uJEZxOtdx2ME55+0HvECMTB+MhRgkOZiUR 3g+FfilCvCmJlVWpRfnxRaU5qcWHGE2BHp7ILCWanA9M6Hkl8YYmlgYmZmaG5kamBuZK4rzS tieThQTSE0tSs1NTC1KLYPqYODilGphij/3gmCJr/2jC07abSUw7XgnlXCt5FyzczPjqb7z/ +mLFWxxWU88fU9mmcZ/R5+e1wv6VqfETFp291h3nWrrs3PZF9kf1m2dxp6seWpwVmfp5qbvX +lKXp3uWFbSoJ8vt4azK5mab8v9492qzqRNLOCYyfGNkaY31Tdrz5Jt62qnOaMavnkzrIh0L I6rnnD+6bX0EY8WLgOZXG56+23Ts0ZIZC51T2IynL+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> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869669616250432?= X-GMAIL-MSGID: =?utf-8?q?1764869669616250432?= 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) \ { \ From patchwork Wed May 3 10:27:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1229541vqo; Wed, 3 May 2023 03:50:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fslhOg0mXBrWZUaMB+B9YtDSohgOzW9rrnkJG/5xpVQ/1QdOgItebuNEcem/ZZ0vx6y+c X-Received: by 2002:a17:90a:b106:b0:234:889f:c35d with SMTP id z6-20020a17090ab10600b00234889fc35dmr21527288pjq.3.1683111006672; Wed, 03 May 2023 03:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683111006; cv=none; d=google.com; s=arc-20160816; b=Cf8MY4NMLMe6u0IjufsrdXUjDNLtLH3dIjs0XnarJPhXaV3P7jb+kKM9gCOHbYxYJN G41mq3NA5cPhuCswpakqVI03kaqABEVxetRMtN1DGKbXakfSujvHg9Qzz2caWWKCFka5 R12Sm271Krqwod2r6hG790poByw84kn756Xbja4zOMytQbgYmZcxE82F0nIN86ZZx2Lo ifyzfOGKfC0JdZNJ1zrC7lFxxKkOTr6dz05FdyOvidJEJvrGZLZ+keT6y9a8c/QDij8m e6i2sonZIIp+Y+tjK2DDlKy3EfB+s4mmKyujeKhFBi2lltP5SreeyV0wUWQLYE9J59cm 1ykw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=2tjd0O0lZWt8c5dIoxfFDYaBGx6V9lKhttI7UOkE/aI=; b=fkxiRsqfSS+75zH2b+5eStVwcu2OqjURTM2dUhkhjB4Pig5YS8do2bRuxg1bmM9azJ r9I8DUfex1JeKvYbZXjM5zsOaQoHc2fLqviY+tbfOwljTeiw6A160SFB6cygnSEYdOvt cJXSq9+pQrnsZjkKYV8kyYoBD3zklXD67GNE3XAYw2jKrmesqrvtktLqR4LyNm0Y0Xjm Q1elItqFO1wT5DYzRi7Ur3RjFnh7jGKcfk/40HyAHZVqdK8DQjZ9KqbXx5gK8Zj80ji4 C8a0ZcKFZ9lrRtu9iaZsjXyH+6qoDqXzBKqngRvIpWlyZCC2pWPy5L6/uKl0zAJI21a9 M8NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=svugPknY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk4-20020a17090b4a0400b00233d10c93b9si14975939pjb.179.2023.05.03.03.49.51; Wed, 03 May 2023 03:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=svugPknY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229538AbjECK11 (ORCPT + 99 others); Wed, 3 May 2023 06:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbjECK1Z (ORCPT ); Wed, 3 May 2023 06:27:25 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F1244B2 for ; Wed, 3 May 2023 03:27:23 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230503102721epoutp0402f1460007fe98e7f00d4cc06d4e3dec~bm00QjVwE3161231612epoutp04W for ; Wed, 3 May 2023 10:27:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230503102721epoutp0402f1460007fe98e7f00d4cc06d4e3dec~bm00QjVwE3161231612epoutp04W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109641; bh=2tjd0O0lZWt8c5dIoxfFDYaBGx6V9lKhttI7UOkE/aI=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=svugPknYSM4UTmlHhT7iqGAew3dqoA/scXQ+mDa88AbXhtZKESyDXlUxbZfljlZnr MeF3ER7Z9pXyaBCbhOPYy7KXJOFyoLEY8RfcxTqY+uUKF5LkoKGoEUuV2Ts3R+w+JI psxjXTZIpRBr19E0J1iSDxG6QhhHc9G3KDXZWs9Y= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230503102720epcas2p15ada5b8e729e3e2e82e00e5bc0baba27~bm0zvRyUY0379803798epcas2p1Z; Wed, 3 May 2023 10:27:20 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.88]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4QBCn36psCz4x9Q1; Wed, 3 May 2023 10:27:19 +0000 (GMT) X-AuditID: b6c32a48-6d3fa70000005998-6c-6452370710a0 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 6E.A0.22936.70732546; Wed, 3 May 2023 19:27:19 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 14/15] block: blk-integrity: change sg-table configuration method for integrity 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" , "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: <20230503102719epcms2p457434fefd535ee43d502eff854227919@epcms2p4> Date: Wed, 03 May 2023 19:27:19 +0900 X-CMS-MailID: 20230503102719epcms2p457434fefd535ee43d502eff854227919 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmuS67eVCKwcXpxhar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ2x 4/l/9oI9ChWbpt5ja2C8ItnFyMkhIWAicenOAvYuRi4OIYEdjBJPX95g62Lk4OAVEJT4u0MY pEZYIFHi7qleNhBbSEBJ4tyaWYwgJcICBhK3es1BwmwCehI/l8wAKxERWM0k0fy8BmI8r8SM 9qcsELa0xPblWxlBbE4BP4nHG24xQsQ1JH4s62WGsEUlbq5+yw5jvz82H6pGRKL13lmoGkGJ Bz93Q8UlJQ4d+gp2sYRAvsSGA4EQ4RqJt8sPQJXoS1zr2Ah2Aq+Ar8S1FX/BzmQRUJXY/+Ie VI2LxKWjr8HizALyEtvfzmEGGcksoCmxfpc+xHRliSO3WCAq+CQ6Dv9lh3mwYeNvrOwd854w QbSqSSxqMoIIy0h8PTyffQKj0ixEIM9CsnYWwtoFjMyrGMVSC4pz01OLjQpM4PGanJ+7iRGc ErU8djDOfvtB7xAjEwfjIUYJDmYlEd4PhX4pQrwpiZVVqUX58UWlOanFhxhNgR6eyCwlmpwP TMp5JfGGJpYGJmZmhuZGpgbmSuK8HzuUU4QE0hNLUrNTUwtSi2D6mDg4pRqYZp4IZ0uR/HDE YJcjy2Gve+/bOncUz9l2m8Vsmaua0YaXVy7om1Y62vkf4n5hdnGLpWDCBksbXnG3Goe1/U61 u9bE77dkY5+V36LktHTpc+YZXadzgi7H8jSvdkj4ovfixlcFBu3laU1zD54+0Pb3+lqFwkI/ x4z+bXecv+WcPsy/J8ApwSqp7vIZhiMPPPnenzEIzn06ZeGaR9UeWvnREW+edb/Ze35zhErJ O4FI38tFTuHJW9pu/7+7/VmMWVj3XseQk/HS3msY/q1LljgT6tWb3p21IG/BvyMrDKMVN5VL Gro7GW3duvlNSMjF77ErLr/vKDb/8mu3/Y7ZGekWfR7LeduDwrRFeKptLLSVWIozEg21mIuK EwFnQNY1EgQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869806641827111?= X-GMAIL-MSGID: =?utf-8?q?1764869806641827111?= Previously, a bio_vec of bip was made of one page in the block layer, and sg_list was generated using hw information in lld. This is done in the block layer and the bio_vec has been changed to multi-page, so it is changed to configure the sg-table using the existing api, such as the sg-table setting for the bio. (e.g. multi-page map) Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/blk-integrity.c | 52 ------------------------------------------- block/blk-merge.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 64407b412947..c50954652177 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -55,58 +55,6 @@ int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio) } EXPORT_SYMBOL(blk_rq_count_integrity_sg); -/** - * blk_rq_map_integrity_sg - Map integrity metadata into a scatterlist - * @q: request queue - * @bio: bio with integrity metadata attached - * @sglist: target scatterlist - * - * Description: Map the integrity vectors in request into a - * scatterlist. The scatterlist must be big enough to hold all - * elements. I.e. sized using blk_rq_count_integrity_sg(). - */ -int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio, - struct scatterlist *sglist) -{ - struct bio_vec iv, ivprv = { NULL }; - struct scatterlist *sg = NULL; - unsigned int segments = 0; - struct bvec_iter iter; - int prev = 0; - - bio_for_each_integrity_vec(iv, bio, iter) { - - if (prev) { - if (!biovec_phys_mergeable(q, &ivprv, &iv)) - goto new_segment; - if (sg->length + iv.bv_len > queue_max_segment_size(q)) - goto new_segment; - - sg->length += iv.bv_len; - } else { -new_segment: - if (!sg) - sg = sglist; - else { - sg_unmark_end(sg); - sg = sg_next(sg); - } - - sg_set_page(sg, iv.bv_page, iv.bv_len, iv.bv_offset); - segments++; - } - - prev = 1; - ivprv = iv; - } - - if (sg) - sg_mark_end(sg); - - return segments; -} -EXPORT_SYMBOL(blk_rq_map_integrity_sg); - /** * blk_integrity_compare - Compare integrity profile of two disks * @gd1: Disk to compare diff --git a/block/blk-merge.c b/block/blk-merge.c index c6a0958e8df1..71539d88ffe6 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -524,6 +524,58 @@ __blk_segment_map_sg_merge(struct request_queue *q, struct bio_vec *bvec, return true; } +/** + * blk_rq_map_integrity_sg - Map integrity metadata into a scatterlist + * @q: request queue + * @bio: bio with integrity metadata attached + * @sglist: target scatterlist + * + * Description: Map the integrity vectors in request into a scatterlist. + * The scatterlist must be big enough to hold all elements. + */ +int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio, + struct scatterlist *sglist) +{ + struct bio_vec iv, ivprv = { NULL }; + struct scatterlist *sg = NULL; + unsigned int nsegs = 0; + struct bvec_iter iter; + bool new_bio = false; + + for_each_bio(bio) { + struct bio_integrity_payload *bip = bio->bi_integrity; + + bip_for_each_mp_bvec(iv, bip, iter) { + /* + * Only try to merge bvecs from two bios given we + * have done bio internal merge when adding pages + * to bio + */ + if (new_bio && + __blk_segment_map_sg_merge(q, &iv, &ivprv, &sg)) + goto next_iv; + + if (iv.bv_offset + iv.bv_len <= PAGE_SIZE) + nsegs += __blk_bvec_map_sg(iv, sglist, &sg); + else + nsegs += blk_bvec_map_sg(q, &iv, sglist, &sg); + next_iv: + new_bio = false; + } + + if (likely(bip->bip_iter.bi_size)) { + ivprv = iv; + new_bio = true; + } + } + + if (sg) + sg_mark_end(sg); + + return nsegs; +} +EXPORT_SYMBOL(blk_rq_map_integrity_sg); + static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, struct scatterlist *sglist, struct scatterlist **sg) From patchwork Wed May 3 10:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 89693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1225228vqo; Wed, 3 May 2023 03:41:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Q0dcjbcruJqZCKUH4dRwPy818syToRqB5ye6x7UuK2NIb7BnAQeD/U50a9fjDNud3leNH X-Received: by 2002:a05:6a20:5495:b0:f0:29d8:b073 with SMTP id i21-20020a056a20549500b000f029d8b073mr26765970pzk.42.1683110468229; Wed, 03 May 2023 03:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683110468; cv=none; d=google.com; s=arc-20160816; b=KZDnPc6azyXc3qQ/cFoaBeQvpwzDs68+NJ8bXNRb8ZTobhaYLKFPsSPrWJDZNa5BWZ n7yr6vVyeereYbJCYJ2dwMu/8g33FD1UhNfSvCfWFPH0oaf5WYv9wgmoU+ev8AkBhS7Q zUrf95O0FYO3MnVwF7yd9ffUIkomvKevYcMwcOepUR0BKXONHrF3+NLa33UAnTTJIvsH 16odDfb/W5TOw9vt4ZaAcIT0lWLAI3kcXzGWzuj+0Y7WCKfWYYFMGAERPDDInn8AYqaw QtlN0SmYGBouY6rJkYfRmKf7KariUW8yBM5YNmnfJ4eP5YdXnF6PcEWrr5EtdwCvSdl4 akyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=z1Pr/BMubVK5gm0MNy0PUzgA5DYmQXK+i/O5omA92XA=; b=rhh40yWTfNFJOYIrC6gTclwubnBHi3awZitCvjq4IUEvZG4V40Z+LbUHdHzXw6GzoT OgkQsWdugTx+W47feyBc/uGhdTgw0GThGED2BQF1UZNQJCGKnZFYDzxM6k/osJdDYdhE W4ylzxjQoEQLrMfe8w7ZmHIgenCyv5cyjuG1ZsWuz1nNct14F9BOKw0pzRP/HcNNCja8 pvh2JEC2YPZZoaIwhh5jKhlbkqYbpt7+zQnZTI+OXdDvTDlWeU/CzHw9lJIxwFMQM5MB A9A/RQaOf58gYSVty3wKzf9Hx5PvXWMZdALZD4kiibGwBGyv99YXzj3pFsJKLEvM1lZo p9MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=DfghvSUU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u130-20020a627988000000b006434d66782bsi545861pfc.321.2023.05.03.03.40.53; Wed, 03 May 2023 03:41:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=DfghvSUU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjECK2Z (ORCPT + 99 others); Wed, 3 May 2023 06:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjECK2X (ORCPT ); Wed, 3 May 2023 06:28:23 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06BD10F3 for ; Wed, 3 May 2023 03:28:21 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230503102820epoutp0130881227ee3bfab8d46b6d0f1f935703~bm1rYOfJB2902729027epoutp01V for ; Wed, 3 May 2023 10:28:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230503102820epoutp0130881227ee3bfab8d46b6d0f1f935703~bm1rYOfJB2902729027epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683109700; bh=z1Pr/BMubVK5gm0MNy0PUzgA5DYmQXK+i/O5omA92XA=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=DfghvSUUIX54ioWeOM+ZO960qSwEM4DlGHKy0OxHqVyGAfRbtPzHFx2J97sZpjl8t y64Ej5j55frDtqnQjXxWq/WoEluvVlbA9hWPsMgppBpGanyxMUWkEwQyMY6+gADH7N JpaiuNbKN6dFO1sbpQavJyJ3xNP8E5Mh4vlaCPoY= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230503102819epcas2p3d5d48480285c6355b70b4be904d57435~bm1q5sKgY2240622406epcas2p35; Wed, 3 May 2023 10:28:19 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.90]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QBCpC1Sy5z4x9Px; Wed, 3 May 2023 10:28:19 +0000 (GMT) X-AuditID: b6c32a45-465ff70000020cc1-47-64523743bffa Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 0C.12.03265.34732546; Wed, 3 May 2023 19:28:19 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 15/15] block: blk-integrity: remove blk_rq_count_integrity_sg() 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" , "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: <20230503102818epcms2p8fe187efd29182c441c2670f890c8f9c1@epcms2p8> Date: Wed, 03 May 2023 19:28:18 +0900 X-CMS-MailID: 20230503102818epcms2p8fe187efd29182c441c2670f890c8f9c1 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmha6zeVCKwY59HBar7/azWbw8pGmx cvVRJove/q1sFntvaVtc3jWHzWL58X9MDuwel8+Weuy+2cDm8fHpLRaPvi2rGD0+b5ILYI3K tslITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBukFJoSwx pxQoFJBYXKykb2dTlF9akqqQkV9cYquUWpCSU2BeoFecmFtcmpeul5daYmVoYGBkClSYkJ1x dtEZxoJuoYqVC/vZGhhf8nUxcnJICJhI7P/zgLmLkYtDSGAHo8Tt7WeAHA4OXgFBib87hEFq hAUCJa68/cIKYgsJKEmcWzOLEaREWMBA4lavOUiYTUBP4ueSGWwgtojAaiaJ5uc1EON5JWa0 P2WBsKUlti/fyghicwr4STzecIsRIq4h8WNZLzOELSpxc/Vbdhj7/bH5UDUiEq33zkLVCEo8 +LkbKi4pcejQVzaQcyQE8iU2HAiECNdIvF1+AKpEX+Jax0awE3gFfCVm7HjABGKzCKhKnFxx Auo0F4m7e86CfcgsIC+x/e0ccCAwC2hKrN+lDzFdWeLILRaICj6JjsN/2WEebNj4Gyt7x7wn TBCtahKLmowgwjISXw/PZ5/AqDQLEcizkKydhbB2ASPzKkax1ILi3PTUYqMCQ3i8JufnbmIE p0Qt1x2Mk99+0DvEyMTBeIhRgoNZSYT3Q6FfihBvSmJlVWpRfnxRaU5q8SFGU6CHJzJLiSbn A5NyXkm8oYmlgYmZmaG5kamBuZI4r7TtyWQhgfTEktTs1NSC1CKYPiYOTqkGJmuVqChxF3Up 9/gp9lssKoJiL2bLKDXNNnonfX5Og8x9s1qzYi79DZkucTKaSl+Wn5/od2FWecyqhfHXGP9t i3rYcVj1S0xr3DzJdxyqPd0vVUr+v/RiC1DY0TAze9XJSx/06yUPJjk863k3cUJGyYN/e4vO J1zImeeXtFP5tbfPS/e5M797Vf0snpBje1eym19qrmN6j/z+P1vTfS0/3+eumf1siwf3lP21 G/b/PnPd7/rSVTNbF9btTTvnrlzr99Duhl0UwyNrKb782YdYt8cVx4u4vlu518nPZ2EfQ0z6 w8otzeHmFUGXpN0PdN0+Pd9n85MrYr9+8desCdxVvbCz91n+LKMfrixrFfT2KrEUZyQaajEX FScCANZ+dCoSBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323 References: <20230503094912epcms2p4bef206eab1c41a92eba2583a69c74323@epcms2p4> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764869242448198372?= X-GMAIL-MSGID: =?utf-8?q?1764869242448198372?= blk_rq_nr_nr_integrity_segments() allows you to obtain the number of integrity. Therefore, blk_rq_count_integrity_sg() is no longer necessary. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/blk-integrity.c | 39 ----------------------------------- include/linux/blk-integrity.h | 1 - 2 files changed, 40 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index c50954652177..9bac2836c3ff 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -16,45 +16,6 @@ #include "blk.h" -/** - * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements - * @q: request queue - * @bio: bio with integrity metadata attached - * - * Description: Returns the number of elements required in a - * scatterlist corresponding to the integrity metadata in a bio. - */ -int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio) -{ - struct bio_vec iv, ivprv = { NULL }; - unsigned int segments = 0; - unsigned int seg_size = 0; - struct bvec_iter iter; - int prev = 0; - - bio_for_each_integrity_vec(iv, bio, iter) { - - if (prev) { - if (!biovec_phys_mergeable(q, &ivprv, &iv)) - goto new_segment; - if (seg_size + iv.bv_len > queue_max_segment_size(q)) - goto new_segment; - - seg_size += iv.bv_len; - } else { -new_segment: - segments++; - seg_size = iv.bv_len; - } - - prev = 1; - ivprv = iv; - } - - return segments; -} -EXPORT_SYMBOL(blk_rq_count_integrity_sg); - /** * blk_integrity_compare - Compare integrity profile of two disks * @gd1: Disk to compare diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index 45b9fde1fee1..a2a9d72e8fab 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -41,7 +41,6 @@ void blk_integrity_unregister(struct gendisk *); int blk_integrity_compare(struct gendisk *, struct gendisk *); int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, struct scatterlist *); -int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); static inline unsigned short blk_rq_nr_integrity_segments(struct request *rq) {