From patchwork Wed May 10 08:46:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3479694vqo; Wed, 10 May 2023 02:20:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XzdsZGH8+e3AMKBKwyL/Z8Cfj6ynk4Hu8Dj97suXjxCOHVQKzqocrbfk6rVx2PRhHqs5J X-Received: by 2002:a17:90a:b281:b0:24e:1dcd:4e73 with SMTP id c1-20020a17090ab28100b0024e1dcd4e73mr16777933pjr.0.1683710442284; Wed, 10 May 2023 02:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683710442; cv=none; d=google.com; s=arc-20160816; b=JD+LNkB8fuO7+oqNJGttYAR0ihkk3AZvna/WBSjhEu4tqP3PQzmcf7+3eCZeMVGG8H bFst7WxE4+C4mXQYKV1gqrKf4IfZLuk5RytYtUpgkl8bVq3BZYWaaciTzKyeZXVslRWS ydm2kAMr7Q5l/VqwCb3+SLIMQcb3L5Sp+jyn2j1p1Tn8uYVNO9kzukFgPfPkgY+dWXPd FE/FRXPL+3yb8V98PrGQsuTR5wrIZgoapOC1GZ9t9dXQtQpavqwSWm8NwxDGMLFhWPZ/ gsgFskDgSB44mnSlVYTU4eusRFhIV+ZJaQLqzL37TGyHHGU4HQzZbSR7FPYIcXBkMzQU 2x9g== 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=10R6BCaaEqGyGL0MgOrzq5i+lOe75yKt/yscCIlKzXQ=; b=dE7rMHCLvh0+MOlq9UuON3lXfXTzB03iZ6VN6QRnLEk6QeoCRM7PAw0DsF/g0qDppm iS+bgzro8dtOgCYlaPzBs0/WM4qKMDUld60xzMfB+tfZ27zcogMUeHfbv8FFmcKJvj3z MN0oNHpRT8sEfgjplygVrDjlBSI+ykLJ6M3qIjyjwsXztFfCsQzEFISSODnD++1qBODs nXJ+dCBjVBCw8FGvo5TDSwRS1aF9CF9l8k6J1H+MGl3whSpQhTPw3ap/lOsoweVkA3s1 owtq4D7VnDgqrvzIYC4cjJa/tjdSwbpqjWs4MjNkUu09vNltNnitsBI86c/2+QUOTIH9 mH9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kjPo5RgI; 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 j20-20020a633c14000000b005303c1de315si3614866pga.853.2023.05.10.02.20.29; Wed, 10 May 2023 02:20:42 -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=kjPo5RgI; 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 S236676AbjEJIrF (ORCPT + 99 others); Wed, 10 May 2023 04:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236008AbjEJIrD (ORCPT ); Wed, 10 May 2023 04:47:03 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DB4E69 for ; Wed, 10 May 2023 01:47:01 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230510084659epoutp03253b0f4dffb06895a9427620023d0d9b~du_MHoXQ61154311543epoutp03A for ; Wed, 10 May 2023 08:46:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230510084659epoutp03253b0f4dffb06895a9427620023d0d9b~du_MHoXQ61154311543epoutp03A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708419; bh=10R6BCaaEqGyGL0MgOrzq5i+lOe75yKt/yscCIlKzXQ=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=kjPo5RgI9b97q13fvO9lOvxgeZaXd9IhaDZDX98t7W/lbPw2sSRVFHTnTQkSv+fJ/ ethYx/0GM+YJewT5Qi3HbVXUEqErBALoiYREWkbwjCSyByEpNt5HyMQbnIISEQjr3Y cjoK0SS/8yDqh+8QDPIXsSto7/4YrWi3MBebViy8= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230510084658epcas2p1e0dd52b73331be2c655a782cc2f8c05d~du_LkEh-T1606116061epcas2p1Z; Wed, 10 May 2023 08:46:58 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.102]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTD20lk4z4x9Px; Wed, 10 May 2023 08:46:58 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-7d-645b5a01987d Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 60.F3.08199.10A5B546; Wed, 10 May 2023 17:46:58 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 01/14] block: bio: separation to reuse a part of the function 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" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510084657epcms2p69b0c426899251151a5cc7d84cedeacc7@epcms2p6> Date: Wed, 10 May 2023 17:46:57 +0900 X-CMS-MailID: 20230510084657epcms2p69b0c426899251151a5cc7d84cedeacc7 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBJsWRmVeSWpSXmKPExsWy7bCmuS5TVHSKwbnVzBar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjOW91kULJOsOPjMqoFxhkgXIyeHhICJxL/n/1m6GLk4hAR2MErs3DaZtYuRg4NX QFDi7w5hkBphgSCJCT9nsoLYQgJKEufWzGIEKREWMJC41WsOEmYT0JP4uWQGG8gYEYGdLBLf 7x9lhJjPKzGj/SkLhC0tsX35VrBeTgE/idbHlhBhDYkfy3qZIWxRiZur37LD2O+PzYcaIyLR eu8sVI2gxIOfu6HikhKHDn1lAxkpIZAvseFAIES4RuLt8gNQJfoS1zo2gl3AK+ArcW/nHrA4 i4CqxPG/LawQNS4Sc7fvBFvLLCAvsf3tHGaQkcwCmhLrd+lDTFeWOHKLBaKCT6Lj8F92mP8a Nv7Gyt4x7wkTRKuaxKImI4iwjMTXw/PZJzAqzUIE8iwka2chrF3AyLyKUSy1oDg3PbXYqMAY HqvJ+bmbGMFJWMt9B+OMtx/0DjEycTAeYpTgYFYS4fUOjUoR4k1JrKxKLcqPLyrNSS0+xGgK 9PBEZinR5HxgHsgriTc0sTQwMTMzNDcyNTBXEueVtj2ZLCSQnliSmp2aWpBaBNPHxMEp1cBU 3q4sEHqrmXXFz+LXMQnm/Z/7f8zcUmPU1j87/kFW5smlZydvuFidwZ24N8DSfc17TTe7ow0b e/fr9V0svvr42N+uYsMMkwmPDl+O/t3Zdll9zaUXErvf+NZ9CrzI3vGsZSbL1AXaNZY/Jz+0 7npRnJHwYlnUj4ht7JoZalOvX3E3nv2ycrXOOrX3y96dFfUsdO0tDKtsy0h2v7XyoLeWleTs 0Oc73vfqvlsqmLTyfu+UIyk6zy2Knj6XLLkee6C0hP+d2y/ZgF9fvItZW65pHYrLXvn+9gu2 +3JphSGbDJc/iN2pPT/j07xtzdwT7pp9aZ5fzuJWt+zd1QTun8UHnTXPhdx1NP9Rcu71dsaJ SizFGYmGWsxFxYkAmMa9d0sEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765498360683470762?= X-GMAIL-MSGID: =?utf-8?q?1765498360683470762?= __bio_try_merge_page(), which is called by the general page-add functions and the function considering the constraints of hw, was separated. Condition tests for general page-add functions were performed in bio_try_merge_page(). And when the parameters of __bio_try_merge_page() were changed, there were fewer functions affected by this. Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Jinyoung Choi --- block/bio.c | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..1be17dea603a 100644 --- a/block/bio.c +++ b/block/bio.c @@ -926,8 +926,28 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE); } +static bool __bio_try_merge_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int off, + bool *same_page) +{ + struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; + + if (!page_is_mergeable(bv, page, len, off, same_page)) + return false; + + if (bio->bi_iter.bi_size > UINT_MAX - len) { + *same_page = false; + return false; + } + + bv->bv_len += len; + bio->bi_iter.bi_size += len; + + return true; +} + /** - * __bio_try_merge_page - try appending data to an existing bvec. + * bio_try_merge_page - try appending data to an existing bvec. * @bio: destination bio * @page: start page to add * @len: length of the data to add @@ -942,26 +962,17 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, * * Return %true on success or %false on failure. */ -static bool __bio_try_merge_page(struct bio *bio, struct page *page, - unsigned int len, unsigned int off, bool *same_page) +static bool bio_try_merge_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int off, + bool *same_page) { if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED))) return false; - 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->bi_iter.bi_size > UINT_MAX - len) { - *same_page = false; - return false; - } - bv->bv_len += len; - bio->bi_iter.bi_size += len; - return true; - } - } - return false; + if (!bio->bi_vcnt) + return false; + + return __bio_try_merge_page(bio, page, len, off, same_page); } /* @@ -1129,7 +1140,7 @@ int bio_add_page(struct bio *bio, struct page *page, { bool same_page = false; - if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { + if (!bio_try_merge_page(bio, page, len, offset, &same_page)) { if (bio_full(bio, len)) return 0; __bio_add_page(bio, page, len, offset); @@ -1199,7 +1210,7 @@ static int bio_iov_add_page(struct bio *bio, struct page *page, { bool same_page = false; - if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { + if (!bio_try_merge_page(bio, page, len, offset, &same_page)) { __bio_add_page(bio, page, len, offset); return 0; } From patchwork Wed May 10 08:48:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3480114vqo; Wed, 10 May 2023 02:21:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5uI9ppFVkv+CYwbN1LRcY0VuJWYODu1295+WjKzHtEA+LTfVaeYHs9qVIz0wR6MjF4z2+d X-Received: by 2002:a05:6a20:1593:b0:101:95a4:67b with SMTP id h19-20020a056a20159300b0010195a4067bmr4863356pzj.7.1683710494600; Wed, 10 May 2023 02:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683710494; cv=none; d=google.com; s=arc-20160816; b=LraR5OQ6vk6R1FAqU0Tb/2reH8Zx+lD35QrBBS7PmymdKEvamTBL95zYtGwBXNI8pB 2vD2G3pgl7jAe8UcviHPNJjb5WTv6HfDQKQ9LsHbnCLIWDlRXXIS8YtGKfv+6KeqjN7I jP0UPX27y5AS5sHYDeq4ZN0A5jox0EkSRgpkXhjdeqW6tF/3wyEmnDmChoOu2HMWtCZq u8hlB+w830DFbehgB5/IU4/kiXKCW7xE56LMeaLYBwBE4iAuVoQSI4fGHWloVsQec6zN wPiX261BGruTPmrbOXAxG7PedcQySHvkE4MYQbdcN4UBUk6QONmv4/tszbX/Zdm1IIQs VCFg== 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=Tz77v0EHvEPWfXqlEtqfHLelknA3uibxNOyXoCv2mHI=; b=pKNQh50UyTsXsUzULMH6IldCp3wQTtaa0PsEYeGX6mnE5fKLMl3Wsy4m9neJXyjhqq MBJvbpPmopcTfXTBDVHMoX4e3/YZbl94eIXnT/4U5Em4FOC3ba5kT9v1HP++y5/8H3NA L5hd2hVrHDrs2hplrKYCmnjC/Z4EZgqIJ8rUnyO0yNL71R9V+oVc1rmHrL5PiEzconub EDNQOAWO2upEXidXSsBZJ/aoS3zVcx2uMRdq5sMBjqpnkPsed7g3irSfpbRHbKPz6Hak ajQpoplGqEVNbItRzbEF3ykmcLNhEFqJiPHIHxS90V2yr7u8qv6gx9LmY7BH+J8ECjgC 762g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="a/tkjC2Z"; 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 123-20020a620481000000b006466cd0dfffsi4376960pfe.158.2023.05.10.02.21.22; Wed, 10 May 2023 02:21:34 -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="a/tkjC2Z"; 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 S236762AbjEJItG (ORCPT + 99 others); Wed, 10 May 2023 04:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236688AbjEJItD (ORCPT ); Wed, 10 May 2023 04:49:03 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF8B96188 for ; Wed, 10 May 2023 01:48:57 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230510084856epoutp02bc5ca10fcf12b20eaeee93610509ade8~du-43bRgX3185231852epoutp02L for ; Wed, 10 May 2023 08:48:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230510084856epoutp02bc5ca10fcf12b20eaeee93610509ade8~du-43bRgX3185231852epoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708536; bh=Tz77v0EHvEPWfXqlEtqfHLelknA3uibxNOyXoCv2mHI=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=a/tkjC2Zn2ZmfdsOspgH4sqVfeqOfVRRzlVSMAF+Bj8JcAIyiIMmEeZpM5kIjGwi1 cgMW7rOFJm3RunZ9e6sGgDzcVs6ZoTcRlomQxL0Ei8sPJjzUGct4IPzuiVLC91GnE8 RoSMmLa5NlP+fbU1rIgC/ALz/00vyXKy0LVJYJDE= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510084855epcas2p23743e3f954c737e37af22c644fb94869~du-4dDxCw2852728527epcas2p2B; Wed, 10 May 2023 08:48:55 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QGTGH1kbZz4x9Pv; Wed, 10 May 2023 08:48:55 +0000 (GMT) X-AuditID: b6c32a45-465ff70000020cc1-fd-645b5a77e407 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 1B.E7.03265.77A5B546; Wed, 10 May 2023 17:48:55 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 02/14] 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" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510084854epcms2p756a3e1055399ead6bf539d3419c74c3e@epcms2p7> Date: Wed, 10 May 2023 17:48:54 +0900 X-CMS-MailID: 20230510084854epcms2p756a3e1055399ead6bf539d3419c74c3e X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmhW55VHSKwdK1HBar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjN6dl9gK7jnWTG/5StbA+Msqy5GTg4JAROJi1u+sHYxcnEICexglOh/OJupi5GD g1dAUOLvDmGQGmGBQInjB28zgdhCAkoS59bMYgQpERYwkLjVaw4SZhPQk/i5ZAYbyBgRgZ0s Et/vH2WEmM8rMaP9KQuELS2xfflWsF5OAT+J1seWEGENiR/LepkhbFGJm6vfssPY74/Nhxoj ItF67yxUjaDEg5+7oeKSEocOfWUDGSkhkC+x4UAgRLhG4u3yA1Al+hLXOjaCXcAr4Cux/PRP sDiLgKrE1CM3oVa5SGxeMwEsziwgL7H97RxmkJHMApoS63fpQ0xXljhyiwWigk+i4/Bfdpj/ Gjb+xsreMe8JE0SrmsSiJiOIsIzE18Pz2ScwKs1CBPIsJGtnIaxdwMi8ilEstaA4Nz212KjA EB6vyfm5mxjBiVjLdQfj5Lcf9A4xMnEwHmKU4GBWEuH1Do1KEeJNSaysSi3Kjy8qzUktPsRo CvTwRGYp0eR8YC7IK4k3NLE0MDEzMzQ3MjUwVxLnlbY9mSwkkJ5YkpqdmlqQWgTTx8TBKdXA lOJvf2rhU2W5Lqcb82IunTzWN2HNLK+0HRM5KgQORz3J5v/dYMEmw/rviums7uIf786cD10r ul5lifOx6Ftnq7f7aN55dzFIhTtf/NL30LkTawzlEzbvMlLK+TLjMWfscynmM0s2MIToOGi8 n7LhakbOwjgljkM8rtES9XNUtK3mL65mMiv4pTAreIXOv9uf2QzuZEw1/VHOsPkLR6vqxCA2 5YKYi/pnL+v0GCZfnMC8975KSYxfd8tO9foXwte8nCuCP/rIxS9h8laLuvXt0RPBXt3fJf3s eqf+qy+2fmd9+/GE1bOnW3m6yzssi2bl5NvcN0H3x6pfTCE9/4NWuM/d4r0m9uYCu139WkVZ SizFGYmGWsxFxYkAxjrOmE0EAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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_H2,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?1765498415497164973?= X-GMAIL-MSGID: =?utf-8?q?1765498415497164973?= 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. The page merge process for data and integrity is almost the same. Thus, the bio was not used as a parameter, but the values referred to in the merge process were passed to the parameter. At this time, the parameter could be more than seven, so the page_merge_ctx structure was added. 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 | 66 ++++++++++++++++++++++++++++++++++--------- block/bio.c | 56 +++++++++++++++++++++++------------- block/blk.h | 13 +++++++++ 3 files changed, 102 insertions(+), 33 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4533eb491661..20444ec447cb 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -111,6 +111,23 @@ 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; +} + /** * bio_integrity_add_page - Attach integrity metadata * @bio: bio to update @@ -118,25 +135,53 @@ void bio_integrity_free(struct bio *bio) * @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 = &bip->bip_vec[bip->bip_vcnt - 1]; + bool same_page = false; + struct page_merge_ctx pmc = { + .bv = bv, + .bi_vcnt = bip->bip_vcnt, + .bi_iter = &bip->bip_iter, + .page = page, + .len = len, + .offset = offset, + .same_page = &same_page, + }; + + if (bio_try_merge_hw_seg(q, &pmc)) + return len; + + /* + * If the queue doesn't support SG gaps and adding this segment + * would create a gap, disallow it. + */ + 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; } @@ -249,7 +294,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) @@ -258,7 +302,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) @@ -267,18 +310,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; diff --git a/block/bio.c b/block/bio.c index 1be17dea603a..45af9e39acff 100644 --- a/block/bio.c +++ b/block/bio.c @@ -926,22 +926,23 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE); } -static bool __bio_try_merge_page(struct bio *bio, struct page *page, - unsigned int len, unsigned int off, - bool *same_page) +static bool __bio_try_merge_page(struct page_merge_ctx *pmc) { - struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; + struct bio_vec *bv = pmc->bv; + struct bvec_iter *bi_iter = pmc->bi_iter; + unsigned int len = pmc->len; + bool *same_page = pmc->same_page; - if (!page_is_mergeable(bv, page, len, off, same_page)) + if (!page_is_mergeable(bv, pmc->page, len, pmc->offset, same_page)) return false; - if (bio->bi_iter.bi_size > UINT_MAX - len) { + if (bi_iter->bi_size > UINT_MAX - len) { *same_page = false; return false; } bv->bv_len += len; - bio->bi_iter.bi_size += len; + bi_iter->bi_size += len; return true; } @@ -966,13 +967,23 @@ static bool bio_try_merge_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off, bool *same_page) { + struct page_merge_ctx pmc; + if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED))) return false; if (!bio->bi_vcnt) return false; - return __bio_try_merge_page(bio, page, len, off, same_page); + pmc.bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; + pmc.bi_vcnt = bio->bi_vcnt; + pmc.bi_iter = &bio->bi_iter; + pmc.page = page; + pmc.len = len; + pmc.offset = off; + pmc.same_page = same_page; + + return __bio_try_merge_page(&pmc); } /* @@ -980,20 +991,19 @@ static bool bio_try_merge_page(struct bio *bio, struct page *page, * size limit. This is not for normal read/write bios, but for passthrough * or Zone Append operations that we can't split. */ -static bool bio_try_merge_hw_seg(struct request_queue *q, struct bio *bio, - struct page *page, unsigned len, - unsigned offset, bool *same_page) +bool bio_try_merge_hw_seg(struct request_queue *q, struct page_merge_ctx *pmc) { - struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; unsigned long mask = queue_segment_boundary(q); + struct bio_vec *bv = pmc->bv; + unsigned int len = pmc->len; phys_addr_t addr1 = page_to_phys(bv->bv_page) + bv->bv_offset; - phys_addr_t addr2 = page_to_phys(page) + offset + len - 1; + phys_addr_t addr2 = page_to_phys(pmc->page) + pmc->offset + len - 1; if ((addr1 | mask) != (addr2 | mask)) return false; if (bv->bv_len + len > queue_max_segment_size(q)) return false; - return __bio_try_merge_page(bio, page, len, offset, same_page); + return __bio_try_merge_page(pmc); } /** @@ -1013,8 +1023,6 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset, unsigned int max_sectors, bool *same_page) { - struct bio_vec *bvec; - if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED))) return 0; @@ -1022,15 +1030,25 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio, return 0; if (bio->bi_vcnt > 0) { - if (bio_try_merge_hw_seg(q, bio, page, len, offset, same_page)) + struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; + struct page_merge_ctx pmc = { + .bv = bv, + .bi_vcnt = bio->bi_vcnt, + .bi_iter = &bio->bi_iter, + .page = page, + .len = len, + .offset = offset, + .same_page = same_page, + }; + + if (bio_try_merge_hw_seg(q, &pmc)) return len; /* * If the queue doesn't support SG gaps and adding this segment * would create a gap, disallow it. */ - bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; - if (bvec_gap_to_prev(&q->limits, bvec, offset)) + if (bvec_gap_to_prev(&q->limits, bv, offset)) return 0; } diff --git a/block/blk.h b/block/blk.h index 45547bcf1119..dd7cbb57ce43 100644 --- a/block/blk.h +++ b/block/blk.h @@ -118,6 +118,19 @@ static inline bool bvec_gap_to_prev(const struct queue_limits *lim, return __bvec_gap_to_prev(lim, bprv, offset); } +/* page merge context */ +struct page_merge_ctx { + struct bio_vec *bv; /* bvec where @page will be merged */ + unsigned short bi_vcnt; /* how many bio_vec's */ + struct bvec_iter *bi_iter; /* actual i/o information on device */ + struct page *page; /* start page to add */ + unsigned int len; /* length of the data to add */ + unsigned int offset; /* offset of the data relative to @page */ + bool *same_page; /* return if the segment has been merged inside the same page*/ +}; + +bool bio_try_merge_hw_seg(struct request_queue *q, struct page_merge_ctx *pmc); + static inline bool rq_mergeable(struct request *rq) { if (blk_rq_is_passthrough(rq)) From patchwork Wed May 10 08:50: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: 91968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3466635vqo; Wed, 10 May 2023 01:55:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6kbE4ggzaaa1msYZel/R38CfWy1oU48WqO4ARSTFVo3737tIQWaSZD8JZQwsURgbqRzlab X-Received: by 2002:a05:6a21:3401:b0:f6:4c16:f7fb with SMTP id yn1-20020a056a21340100b000f64c16f7fbmr17925171pzb.47.1683708946235; Wed, 10 May 2023 01:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683708946; cv=none; d=google.com; s=arc-20160816; b=j55CLxzt7r0bD4QUVLIgi6CHD1vxpoqRdyJ++2NvJFvHNFCIMrjloYIXUzNwk9J76E ZL84Fnsd/2puzWOpWURYFYxa+ZJgtC4F5LcQD18IJ3+FDdG4YaKxZk471phZTL4tak7i BLHCo+jxs/PrQ3v9oDjuk0CuWqxoRDCb51OHGYU4Ni31AFDuWhkvFnFPIB4eXieXD90K GmcDfDW893J4yrg0F8T4y1kZPjbPcQYTXV0iYGUFxyIvCBb7BEjzzTnn4yQrd+yRLW/B fUrdAUO6qgWp5bo8Y76NKkU+PQuFwJwwIaIFi20y3EsBD0jcpsuUre+7IIyzPdYCCoQt I2ZA== 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=2uIhNIvaUDqD62d3MZOJy319yIzbYqTLMuJPQ32qIts=; b=XfI+uM+vTPpFbDc54SV7VdYYGHz4kUK17I/BYRwGVB2HsK03MvEmbAUmwPWyA6DwXg UTZtul7dkMh3skF7rj2lxkV0+yU6Y7bwJtjvUXmYVBVsHl/nGW2iX5cMBphrw3GJHHh0 u41h92RKGO8ueGuaM/EP/wR5ydgtI5MfC9nJHo46WX8dDCocgNF729zuA+2nRMH6xzbw UlxrNe8Fo8UqUUXqo7jho1nRU9M0kyowIqeAkGz28U4/+gMAOpKSZDj1v/VnT51cM0ml TKO63O7Zdu4MRseqrv6Sw/p2q1aMhPn1RHTmAEWELNdL1SVMTy7kKi4nGzvz9nAagThL 3zsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HI58pAC3; 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 v202-20020a6361d3000000b0050bede17e7bsi3560214pgb.347.2023.05.10.01.55.31; Wed, 10 May 2023 01:55:46 -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=HI58pAC3; 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 S236754AbjEJIu0 (ORCPT + 99 others); Wed, 10 May 2023 04:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235899AbjEJIuX (ORCPT ); Wed, 10 May 2023 04:50:23 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8FCE10C0 for ; Wed, 10 May 2023 01:50:21 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230510085020epoutp048771002cb7c6498d50e1e50e9f6a6f16~dvBHIi8TV2618026180epoutp04b for ; Wed, 10 May 2023 08:50:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230510085020epoutp048771002cb7c6498d50e1e50e9f6a6f16~dvBHIi8TV2618026180epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708620; bh=2uIhNIvaUDqD62d3MZOJy319yIzbYqTLMuJPQ32qIts=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=HI58pAC3T92fLBNh14/TrCp6S4sYxewN8NaQ5IjE1qp9pRn8N1+ywN3qcn55q6IMh qt9P/uVbTOlqgcxAtCO1s1jq4DiK3zKnPG9nk34PpvAzXD4Pp7QWzoFp0lxWBGHhsl rxb5Xjo3dCPxplkaCmRi2SIuEHPmikRoQhX6deOw= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510085019epcas2p2a3e50c925ac64ea08544707ad1f82bc2~dvBGjVMiL2936129361epcas2p2G; Wed, 10 May 2023 08:50:19 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.100]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QGTHv0bMRz4x9Pv; Wed, 10 May 2023 08:50:19 +0000 (GMT) X-AuditID: b6c32a47-c29ff70000002007-32-645b5acac020 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id E0.95.08199.ACA5B546; Wed, 10 May 2023 17:50:19 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 03/14] block: bio-integrity: cleanup bio_integrity_prep 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" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085018epcms2p5a3830e37b13e9a6799298050abdc77dc@epcms2p5> Date: Wed, 10 May 2023 17:50:18 +0900 X-CMS-MailID: 20230510085018epcms2p5a3830e37b13e9a6799298050abdc77dc X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGJsWRmVeSWpSXmKPExsWy7bCmqe7pqOgUg9tZFqvv9rNZvDykabFy 9VEmi97+rWwWi25sY7L423WPyWLSoWuMFk+vzmKy2HtL2+LyrjlsFsuP/2OyWPf6PYvF7x9z 2Bx4Pc7f28jisXmFlsfls6Uem1Z1snlMWHSA0WP3zQY2j97md2weH5/eYvHo27KK0ePzJjmP 9gPdTAHcUdk2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6Z OUDXKymUJeaUAoUCEouLlfTtbIryS0tSFTLyi0tslVILUnIKzAv0ihNzi0vz0vXyUkusDA0M jEyBChOyMz4tWc1ecJKv4uqxGywNjA+4uxg5OCQETCSOXGPtYuTkEBLYwSixcbIkSJhXQFDi 7w5hEFNYwEuiYZ4SRIWSxLk1sxghwgYSt3rNQcJsAnoSP5fMYOti5OIQEdjJIvH9/lFGkISE AK/EjPanLBC2tMT25VvBejkF/CRaH1tChDUkfizrZYawRSVurn7LDmO/PzYfaoyIROu9s1A1 ghIPfu6GiktKHDr0lQ3ij3yJDQcCIcI1Em+XH4Aq0Ze41rER7AJeAV+Jh+dWsIHYLAKqEhvX bIK6zEWie8kqsPHMAvIS29/OYQYZySygKbF+lz7EdGWJI7dYICr4JDoO/2WH+a9h42+s7B3z njBBtKpJLGoyggjLSHw9PJ99AqPSLEQYz0KydhbC2gWMzKsYxVILinPTU4uNCozhkZqcn7uJ EZyAtdx3MM54+0HvECMTB+MhRgkOZiURXu/QqBQh3pTEyqrUovz4otKc1OJDjKZAD09klhJN zgfmgLySeEMTSwMTMzNDcyNTA3MlcV5p25PJQgLpiSWp2ampBalFMH1MHJxSDUw8915FzQjf ZZTvqPxt/t75hjks68/o/pVYu31L13cbgRMp+8pzHxUfMPI78oVlMcP8fWfzZswJmV3fvEws QbYuo9DifrBhpZUTyxfbqbLhZ9p75vv+qF6pcj/CTHixxd2O2dZ+ivs3B3hrb0tkmexWkFw3 e42SmOJjr86QyrMX926s2xezmePTkdpck4NSawW5/n3a0FVb+Wc+80yF9Sa8krUz2jnYBU5z M0Q/zhM0M1kyifU/B895sQDOuq8eZp36LWdWG8tZm00K0ZgbIMgQoMAlsV3pXkGQ1H9/lcf7 KkpO2Mu+4S/wUDhuqZA68/GB3QK5j9ScNPRYKz75pjszHCtYpm6bzyfzqvWlEktxRqKhFnNR cSIAP0C7YEkEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765496792039253785?= X-GMAIL-MSGID: =?utf-8?q?1765496792039253785?= 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 Reviewed-by: Christoph Hellwig 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 20444ec447cb..c49deed67bb2 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -245,7 +245,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; @@ -274,7 +273,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; @@ -289,7 +287,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; } @@ -313,7 +310,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; } @@ -332,10 +328,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 10 08:51: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: 91986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3480585vqo; Wed, 10 May 2023 02:22:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4JSSD20OR7+2+EgC5Ovmj03GOkk0iivpvPdklyN0a4NSDGo6A+vTwbg4QgFUR3R7XBZM5J X-Received: by 2002:a17:903:2451:b0:1ab:142a:3dd7 with SMTP id l17-20020a170903245100b001ab142a3dd7mr19498486pls.68.1683710545926; Wed, 10 May 2023 02:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683710545; cv=none; d=google.com; s=arc-20160816; b=0SwVhLpiQJ9LTK1wGbl/tkEXo2gFgk26YOFtHX6NuA5IzcNyyh8zlzk+pdqU2uQM9b igg+Y90/Le0BXE7wRbFkTIlFHk6qJ8/XfKVGwsy4dvUUF0CoyIWoNOjRqODjB0Oae8Um x0LpqTU0ZCotnOa+gW+qqfuWW2Ih06fY+WEFRDJQfzwo2aFrYI/dZQvgi7jbyuysxhIq P0QKtdPHFYMLF4cjECFi3rX8obqbhXGM2+VwZ8dqIWX+c6W64gzMX0nCsZUMSiY6+7VM /zyWQNETqCsz3AADi8cjZNK/aEFlrXZaqStL7F2RqLBMLkXxA1jIVSBD5goc7iU9MC5t WgEg== 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=SMZ7aaeVPcRwQ18QiSqKaop+raZWNO8lsaDIbQ+02HA=; b=iuj7nJpsAaU3K9OOmZ9vnaxJaxDJ3BGNd0MtI6jsHRZAkRmUcon3KqJt6+QmAUM9vP DGNYam5CgBUbV5/kJrT6K342Y9aT3SmpmatjoT2Ag+4ka3h5ui8dEw+s6wtRglO/7uOg 2BOyHJpdCdHzqtkgpXyoDoqFSyV2ko9nEmLjABeA+iVMinHcgYBItI4P3s4RCT8E/w80 5jC0WcNfbL4Pn5PbIJ46Ns2iP+d7mUPIijpJyZHjcLkZXX/VqfjSAv1Ne65PsPThe0sb nGSCPBD/Is33px2PQ18sY3Z0lnC738l60WrpHGh5AD7wSgMSJgdjTHASY7m6FV/ZaC/Q iJVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TWcJKNXI; 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 j10-20020a170902690a00b001a6783cf26dsi3581819plk.255.2023.05.10.02.22.11; Wed, 10 May 2023 02:22:25 -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=TWcJKNXI; 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 S236809AbjEJIvu (ORCPT + 99 others); Wed, 10 May 2023 04:51:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbjEJIvg (ORCPT ); Wed, 10 May 2023 04:51:36 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62F847EF1 for ; Wed, 10 May 2023 01:51:15 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230510085113epoutp017a57e5a9e383615e5eccac9235cdeb5d~dvB4rnWLC1212512125epoutp01G for ; Wed, 10 May 2023 08:51:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230510085113epoutp017a57e5a9e383615e5eccac9235cdeb5d~dvB4rnWLC1212512125epoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708673; bh=SMZ7aaeVPcRwQ18QiSqKaop+raZWNO8lsaDIbQ+02HA=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=TWcJKNXImvYJvCzWTvitvOs5oXmTxT7WU4sVw38I28KIFR5u0mXaChDuIGC5YVNA2 ZRZ8sEkjyfrfkQtrWLd33NWtBza9VGTrhMXjZ8WSWlmNPpLec3fbLymM5SoSNHWF0j 3ZRJBURmSkAT6aoBv+wAvDwKsnA9TM8lDVDyqUm8= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230510085112epcas2p3c8db972028412c72bfa8006f836edd58~dvB33_zG80654406544epcas2p3z; Wed, 10 May 2023 08:51:12 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.89]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QGTJw046Cz4x9Q7; Wed, 10 May 2023 08:51:12 +0000 (GMT) X-AuditID: b6c32a47-c29ff70000002007-20-645b5affbfbf Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id A9.F5.08199.FFA5B546; Wed, 10 May 2023 17:51:11 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 04/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085111epcms2p7022e97fd97c1a32c59f935d72f8dda94@epcms2p7> Date: Wed, 10 May 2023 17:51:11 +0900 X-CMS-MailID: 20230510085111epcms2p7022e97fd97c1a32c59f935d72f8dda94 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBJsWRmVeSWpSXmKPExsWy7bCmue7/qOgUgwkXLS1W3+1ns3h5SNNi 5eqjTBa9/VvZLBbd2MZk8bfrHpPFpEPXGC2eXp3FZLH3lrbF5V1z2CyWH//HZLHu9XsWi98/ 5rA58Hqcv7eRxWPzCi2Py2dLPTat6mTzmLDoAKPH7psNbB69ze/YPD4+vcXi0bdlFaPH501y Hu0HupkCuKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTd MnOAzldSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX5qXr5aWWWBka GBiZAhUmZGes3PmauaCVq2Lv8ybGBsadHF2MnBwSAiYSxw6uZuti5OIQEtjBKDHj6SvGLkYO Dl4BQYm/O4RBTGGBCInTO0VByoUElCTOrZnFCBE2kLjVaw4SZhPQk/i5ZAbYFBGBnSwS3+8f ZYQYzysxo/0pC4QtLbF9+VawXk4BP4nWx5YQYQ2JH8t6mSFsUYmbq9+yw9jvj82HGiMi0Xrv LFSNoMSDn7uh4pIShw59ZQMZKSGQL7HhQCBEuEbi7fIDUCX6Etc6NoJdwCvgK/Fz0VYmkHIW AVWJbfukIEpcJK7MWsgKYjMLyEtsfzuHGaSEWUBTYv0ufYjhyhJHbrFAVPBJdBz+yw7zXsPG 31jZO+Y9YYJoVZNY1GQEEZaR+Hp4PvsERqVZiCCehWTtLIS1CxiZVzGKpRYU56anFhsVGMNj NTk/dxMjOAlrue9gnPH2g94hRiYOxkOMEhzMSiK83qFRKUK8KYmVValF+fFFpTmpxYcYTYH+ ncgsJZqcD8wDeSXxhiaWBiZmZobmRqYG5krivNK2J5OFBNITS1KzU1MLUotg+pg4OKUamHo6 prKLZkW5pU0J2xZ64pzGpuYLzw2WOBT7bFzt8/TFbK5FF55qpcxW4Gzeu7eIqcMm2DKj/3f8 oSYbdufpyZOW+1bLXd9ok+iyMICXIShbbsUxj7TKL4dTjfY/65jygUvw7Mm3vHeWnzp6l79m 0yp5y9WKvNrHrjn4nTaQ4L/bEbFq+/uXd1caR7Dsay5RcW9ePatp9+PAl/tT9X4U6H1Nz93T Gtf99/mumb2PKnzuHZro8fVCmVf5sZbj1QmFoWKFvUUaf1c3LJau2n9Qql0wcO7u5KnhvA1z /j/Y9ZbXOGJt+k75bUx3J8bfLV0q5eQ+J0hxxsNlzzIEbJMP5py4PLmxsWzicu6Zp7edeKzE UpyRaKjFXFScCAAYywQtSwQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765498468985743054?= X-GMAIL-MSGID: =?utf-8?q?1765498468985743054?= When a request is initialized through the bio, bio's integrity information is not reflected in the request. It seems to be missing when the codes associated with 'nr_integrity_segment' were added. the lld such as scsi does not refer to this variable. It uses integrity's bevc to calculate the number of segments for sg-list. So there seems to be no problem related to this. Cc: Christoph Hellwig Cc: Martin K. Petersen Fixes: 13f05c8d8e98 ("block/scsi: Provide a limit on the number of integrity segments") 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..9310c94577c7 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 defined(CONFIG_BLK_DEV_INTEGRITY) + if (bio_integrity(bio)) + rq->nr_integrity_segments = bio_integrity(bio)->bip_vcnt; +#endif } void blk_mq_hctx_set_fq_lock_class(struct blk_mq_hw_ctx *hctx, From patchwork Wed May 10 08:52: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: 91969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3467789vqo; Wed, 10 May 2023 01:58:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ngx+wTrE1fIc9/nBC0d+2m/JsfZNnm7J5Le7+sqsKjx01Rpu8vEEPS2NkqKypLlbYry3U X-Received: by 2002:a05:6a20:2588:b0:103:377e:439e with SMTP id k8-20020a056a20258800b00103377e439emr911320pzd.60.1683709126674; Wed, 10 May 2023 01:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709126; cv=none; d=google.com; s=arc-20160816; b=ul5AAjuNWS/ZsRnc+FTvJFS6wRseTC3I91WuRcZJTUXnc/GsrRf6OGJglvsJC7MSD7 fyzmnBWEoTNvGwv7v0uEi4mk6kRhsXpWrYgUnbbPhufO+i7yEzbvPKzk56lnD7DirUSO SPmAfqeY+ce918k6kIDB3SRjurregtzGqfpaghoaORyRqxYrI58fIHfF27Twv82i7zv9 1XrT2h27P0Jgg6ifd5IKq+Sazly/Dsk+/rJoKVbDyza8iq0VcVKsN5Ci7hxe6a7JLiRk QIx9MrGswh3USpxRvImKImVzYZVA6snVABt77m4bZRGd2rSmvcZA9grLp74IwrRb1Juc RDvw== 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=g79vP8DDxL631oXd9xY9r2nKOWI/ZL7l+cinRRVML/o=; b=f2NV57vSA6LOa2XMGzviiPXtqCUhPwwhoRmf+itBvlZnCKrL3C2CrDMhmq8Fl01bRw ierHkZz/ZgdnJwb5fWza6pv7CFqtj+2DQ0U/wLGTf8POqRDaGdWDcZIpr7ui2crCC6vC ltTjVV0PRGAWr/uhXhNvy0rsHQp5aaNrugEJelWX8nnhTUfr4n/C5RGlD14RcQIkpdrk LKO8NjBBu0GZ0ux3dg6l8EImdfVxXediqTZE8ph895Ciy+UdFFnqm2fqBpnLX678pZ+9 vyKedIf3gFTmZiqgHAUfAYPet7WdtZOGg13EOswfvUBPgbkJsuxgy3wyL6Cj2hSMDuUQ 4Crw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=igJTqMmM; 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 u1-20020a17090adb4100b002501d633225si13226481pjx.11.2023.05.10.01.58.30; Wed, 10 May 2023 01:58:46 -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=igJTqMmM; 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 S236870AbjEJIxF (ORCPT + 99 others); Wed, 10 May 2023 04:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236873AbjEJIwm (ORCPT ); Wed, 10 May 2023 04:52:42 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4C15249 for ; Wed, 10 May 2023 01:52:18 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230510085210epoutp01a7bd9e70fe8cc0f7da799eb6ac71aef7~dvCuG1ry51396213962epoutp01p for ; Wed, 10 May 2023 08:52:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230510085210epoutp01a7bd9e70fe8cc0f7da799eb6ac71aef7~dvCuG1ry51396213962epoutp01p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708730; bh=g79vP8DDxL631oXd9xY9r2nKOWI/ZL7l+cinRRVML/o=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=igJTqMmMYgBixf1/e8+PAgF87edmcv2CPfNsrFD1sGpzaotmR9fF2OXmRQ9fDyFXq 94FEPzH6grfjG94kwxpbWyxN5TzqRX+CpzfgAsSBNDiFdimJYpcMazoZM1LfMsqjHf EMRci5gZ7X+52vAY2RqbadMgCCQ6D1N/Ch1JiwJE= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510085210epcas2p2f37d467174700937f1d7d24aafd8c897~dvCtcMs_T0839608396epcas2p29; Wed, 10 May 2023 08:52:10 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.101]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QGTL1448mz4x9Q2; Wed, 10 May 2023 08:52:09 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-31-645b5b396bbe Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 4E.86.08199.93B5B546; Wed, 10 May 2023 17:52:09 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 05/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085208epcms2p52a6dec8da80152ec2101f11ce2ea5321@epcms2p5> Date: Wed, 10 May 2023 17:52:08 +0900 X-CMS-MailID: 20230510085208epcms2p52a6dec8da80152ec2101f11ce2ea5321 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmha5ldHSKwZep8har7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjO2TN7JWDBdvWLC5S72BsYf8l2MnBwSAiYSy6YeZe1i5OIQEtjBKPH+1jPmLkYO Dl4BQYm/O4RBaoQF8iQmP5zKBGILCShJnFszixGkRFjAQOJWrzlImE1AT+LnkhlsIGNEBHay SHy/f5QRYj6vxIz2pywQtrTE9uVbwXo5BfwkWh9bQoQ1JH4s62WGsEUlbq5+yw5jvz82H2qM iETrvbNQNYISD37uhopLShw69JUNZKSEQL7EhgOBEOEaibfLD0CV6Etc69gIdgGvgK/E452/ wD5hEVCVmLDiCRtEjYvEl/sPwMYzC8hLbH87BxwIzAKaEut36UNMV5Y4cosFooJPouPwX3aY /xo2/sbK3jHvCRNEq5rEoiYjiLCMxNfD89knMCrNQgTyLCRrZyGsXcDIvIpRLLWgODc9tdio wBger8n5uZsYwYlYy30H44y3H/QOMTJxMB5ilOBgVhLh9Q6NShHiTUmsrEotyo8vKs1JLT7E aAr08ERmKdHkfGAuyCuJNzSxNDAxMzM0NzI1MFcS55W2PZksJJCeWJKanZpakFoE08fEwSnV wLR+TW1occmm0BVCGW1tlz9tyjwjH1CQGRnQeXCF1+ov4U2r8mJklGsTvpqvPxIecmNxqumi OtdjD8QCVJRld7fV1JzfrtAXXjrlTMwnQ89nv/1q307mPMqqULC4I2WPyJ2wQq6wCxMEllgs 1coP8vz4YSWD5Y4/Sl0W+Vtjfu5O2uRfwnWNmZOF+VnGitD1b+5dXqV5/xLv8ZffH2evquia UDRTWzU3zLi3TXRiR1Oy7G7ZzHO6e7QijDsE9i35utch9lluftzkHXw5j+bP28k4U6zG/ub+ vHaX5K6jfIF72JUiNy6+aiSyYuGs2s8veZrt3u+alvrsDXPwknkhjzbH1Wm0bDTUZsw4cqm0 UYmlOCPRUIu5qDgRALPluVdNBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765496981229125317?= X-GMAIL-MSGID: =?utf-8?q?1765496981229125317?= 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 Fixes: 4eaf99beadce ("block: Don't merge requests if integrity flags differ") 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 dd7cbb57ce43..b7677a5bdff1 100644 --- a/block/blk.h +++ b/block/blk.h @@ -202,6 +202,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 *); @@ -234,6 +236,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 10 08:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3474664vqo; Wed, 10 May 2023 02:11:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Dvb4xEHmN/uwJ9doMs4nYg4s1sKbSQeQaqlAXF5Jn592lXrSYd2/+41Z/XgsJ2TkXIASJ X-Received: by 2002:a05:6a20:5498:b0:101:3112:c839 with SMTP id i24-20020a056a20549800b001013112c839mr6835814pzk.15.1683709868780; Wed, 10 May 2023 02:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709868; cv=none; d=google.com; s=arc-20160816; b=diEUdQXzUToUWOWW24tjXMp9H8zP7DO3yxVAUGPoU2tvZyT7mW2M8G/vPO0o+jX04/ NB2XaZ4oLZxfn55UJ+FqTnO/Ei6ztFWRj4IR1qpHS+j603M6Kbquirxi3ZKyx4FB/xpw y+un3otorEDjuTpiskGQJPQYZ2Ie8ThloF/2tOivuUGM/kyqj9E3ep1p7nQ8dgeWDdWN LxtHEyhFa6eynIe7t9Qc84Wot0IBD3SoqjVN76KolLmL8qLFpu467ED9WV7j64hsIlxC 1tW0/4RSmdHZiZQH0cMxyp0V99p+rHyyScy4F8yK5ggMyUJNWi4H7WOMUOXcNPbKESwm GrPQ== 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=hAgsUYvwnAwGZ8MCXuf3w6+KGzCXW9Ae7hJz02geX9Y=; b=FVmhgIz4feSs7vqv+orClxIPU+sQjcAVgrDA9tv4NDBupnCs6M8AbdoxrtV3bj8hot ZI8lu3XhT4W8lWDdIRPUQkm2ouE4ZnU5X466jWMMkubgOwBSY4fFY0v2zfxtJ+yZrVRc T2N3UYfKo68yzmTlWRh8VDcWQUnBP3rp3fdy4JaXARBwnIj4SBuuhgCCGYqI0Z9qszYn 9Y4AsK5z0IjDbtJh2mhGp0Ai5tgS+cr2eUJitJHfwFDbcbEIx+8xyVeBblC+AayLfUAy Z7HEZLflS3cPUbJfBpEOrexPOBQJDemUujrmeOpwjdM+MrvWGvaLn5kgZetmmyv9TKVL DUHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jR+Xf2AE; 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 k189-20020a6384c6000000b00502f0410410si3519659pgd.472.2023.05.10.02.10.56; Wed, 10 May 2023 02:11: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=jR+Xf2AE; 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 S236729AbjEJIxp (ORCPT + 99 others); Wed, 10 May 2023 04:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236898AbjEJIxa (ORCPT ); Wed, 10 May 2023 04:53:30 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0002783FF for ; Wed, 10 May 2023 01:53:10 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230510085309epoutp01ac7be1161f53ad4a179b7165bf69b673~dvDkpaouM1575315753epoutp01D for ; Wed, 10 May 2023 08:53:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230510085309epoutp01ac7be1161f53ad4a179b7165bf69b673~dvDkpaouM1575315753epoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708789; bh=hAgsUYvwnAwGZ8MCXuf3w6+KGzCXW9Ae7hJz02geX9Y=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=jR+Xf2AEHZd8CzlaLwDcpQnCsA1+wjmvoIIaxRCHWrl9ELYKhHhXPdt/jUBrj/VVA /EMTwvMd6nGYlBf6IpsH036kDENRTDz/Tvg9aYhgMgKYmb/3FFkLEIsrOWkI46t1Cs 7raEp9pSxJVoH2uY8neNDeEi1Yium1YtfN5I64lk= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230510085308epcas2p19f03621cc47872e5931aeeeb9463f545~dvDj-t8151264312643epcas2p1U; Wed, 10 May 2023 08:53:08 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.101]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QGTM80VzXz4x9Q0; Wed, 10 May 2023 08:53:08 +0000 (GMT) X-AuditID: b6c32a45-6d1fd70000020cc1-4e-645b5b7392d8 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 29.6A.03265.37B5B546; Wed, 10 May 2023 17:53:08 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 06/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085307epcms2p2118fe232ab7e7707c0fc70d5ede6aa58@epcms2p2> Date: Wed, 10 May 2023 17:53:07 +0900 X-CMS-MailID: 20230510085307epcms2p2118fe232ab7e7707c0fc70d5ede6aa58 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmhW5JdHSKwZbfjBar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjMO9R5iLOjmq+i+c5atgfEudxcjJ4eEgInE+sVX2EFsIYEdjBJTP0t2MXJw8AoI SvzdIQwSFhaIk7j0eiVUiZLEuTWzGEFKhAUMJG71moOE2QT0JH4umcHWxcjFISKwk0Xi+/2j jBDjeSVmtD9lgbClJbYv3wrWyyngJ9H62BIirCHxY1kvM4QtKnFz9Vt2GPv9sflQY0QkWu+d haoRlHjwczdUXFLi0KGvbCAjJQTyJTYcCIQI10i8XX4AqkRf4lrHRrALeAV8Jd59aAIbzyKg KtF9bR3USBeJ9SeOgdUwC8hLbH87hxlkJLOApsT6XfoQ05UljtyCquCT6Dj8lx3mv4aNv7Gy d8x7wgTRqiaxqMkIIiwj8fXwfPYJjEqzEIE8C8naWQhrFzAyr2IUSy0ozk1PLTYqMIRHa3J+ 7iZGcBrWct3BOPntB71DjEwcjIcYJTiYlUR4vUOjUoR4UxIrq1KL8uOLSnNSiw8xmgI9PJFZ SjQ5H5gJ8kriDU0sDUzMzAzNjUwNzJXEeaVtTyYLCaQnlqRmp6YWpBbB9DFxcEo1MPXzPRD3 dZHdpGGVvj+sKH1h6ddPFdKrTefYmd91F9Kxi5n6mS9PyrW0fv1Vv6eHPl9hU2fijdqyTsBs z3xLl2/cgboSt0zCNx64Xy/ccqjkH/fjn2tfNfWY+S7juKSyboNT/WztnE3bt17qXWiw4pGJ gvIfz8ePpwqx3P0SvY1nYaP7xczp2W/1Pp1OWMr7ycyT5ayp3us19y7M/fn91JN36cq+8/S1 j7xP4Xr786PJtua1wmdbPrin/zp81W3Jhcz9q1/vzFb2lLn6Wsruk0S++XPvHpV1K8XvL+34 svHP2dXm7ZY/W9/0M5/lPaDD9ltoaylzUYRrW8o0M96774rny6/iMvi/qF1oydv4bzVKLMUZ iYZazEXFiQAFrTqKTAQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765497759446109684?= X-GMAIL-MSGID: =?utf-8?q?1765497759446109684?= 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 Fixes: 13f05c8d8e98 ("block/scsi: Provide a limit on the number of integrity segments") 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 10 08:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3476769vqo; Wed, 10 May 2023 02:15:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HThXv6Dik9oHRaNFwj1qKXwUeB0HkDGceH1vvxZn/1xsc5rKPzgPau2GeEShMrdIFM9TB X-Received: by 2002:a17:90b:390c:b0:24e:edd:4d66 with SMTP id ob12-20020a17090b390c00b0024e0edd4d66mr19069120pjb.19.1683710108214; Wed, 10 May 2023 02:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683710108; cv=none; d=google.com; s=arc-20160816; b=oyDudwR6u9A4KRfTYQMfcFcfCuoKzyGmD/1arXcWNWGaeUW1YkPCV+IarYg2WQqkAY /VSk5WRmZXUV3IypZ3N1B0kmLcX9+BzNSZi+sz0w8RCozAkwlZq3Wt5dwzrV1whxpt/9 dSMCpAYwo2HI1FYd80/0ddb5SK0W4Azt9MkZvuVmIHn9AHVltFZCrtFVnvejg+3gdAJf aui/69u/ta/f3Xz69WpC5Kkfl9Lplszr5j9ZA5osY3IcGdDFAt53klz+HYX3tKFhf1Zz zqrTq6paHa4iPo53oawM3WYP51ZaoygRNam5jn1ABrP7hMuOHUZ0SpVO77PoR4Cnph5n dq7w== 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=fcqP139vDElHeNtkDXgfWG7Hn97hpdrD+Y/FZhhwdZZESjhWB8ihg0kYSn6BMOjXel +qNv/YlAI5H+fOeIQwRa3ZeliNzOWtdvKVa7HPbsQI+8aKz4u9YLsxtSYoAGqtsvyQ6T gOXb2ABlTevq9K8apfPLurt/AwycMfHkQ+r8b9xYWD0wRLjJPX6EiB92LSZ31JsAvgvm +g7d375qSS9FnNsHDJaLnKPPs9g1SqungF0Xu/yugusWxcb//81G5AQmg6RTGlBG8J0E acRbMIft+abmz2FCiD3Rm0+VIUxOLLguCPvWMaIFfruyeCc/X9ISboUkZMPyKvVi08uM 2pJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=nHbZ8YUC; 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 hi18-20020a17090b30d200b0024792a548dbsi17210565pjb.126.2023.05.10.02.14.53; Wed, 10 May 2023 02:15: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=nHbZ8YUC; 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 S236790AbjEJIy3 (ORCPT + 99 others); Wed, 10 May 2023 04:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236763AbjEJIyX (ORCPT ); Wed, 10 May 2023 04:54:23 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31FD27DA3 for ; Wed, 10 May 2023 01:54:03 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230510085401epoutp012e387331bfb2f345a3a5ff9d9e133a68~dvEVTP7_w1497914979epoutp01v for ; Wed, 10 May 2023 08:54:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230510085401epoutp012e387331bfb2f345a3a5ff9d9e133a68~dvEVTP7_w1497914979epoutp01v DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708841; bh=dsClYh4QK7KsYkk+2+MP7q9EBU8OpMqvWeVl/PtqLS8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=nHbZ8YUCOc/bj9xs1OdEEqEwoUOBBGETC9B4hiFEBrQaYD2POIkx8oSOv0LGdH720 D9yLZhAMIMeMsxU6rbK+iDDdxUlYT1fgoHUrcing7B3L4Nr/zKAZDSe7J7c5k7RqWL a7Jfpe5ikASZ704ubrw7HJr0iK6anb69/iq8g/n8= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230510085401epcas2p1ee8ea140a9d25a916316bc676335698a~dvEUuwE-00054500545epcas2p1e; Wed, 10 May 2023 08:54:01 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.69]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4QGTN82Gbyz4x9Q7; Wed, 10 May 2023 08:54:00 +0000 (GMT) X-AuditID: b6c32a46-8b7ff7000001438d-bf-645b5ba85d8f Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 5F.06.17293.8AB5B546; Wed, 10 May 2023 17:54:00 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 07/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085359epcms2p5a8e36cf9c7147054e024669f5811c782@epcms2p5> Date: Wed, 10 May 2023 17:53:59 +0900 X-CMS-MailID: 20230510085359epcms2p5a8e36cf9c7147054e024669f5811c782 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmue6K6OgUg69b+C1W3+1ns3h5SNNi 5eqjTBa9/VvZLBbd2MZk8bfrHpPFpEPXGC2eXp3FZLH3lrbF5V1z2CyWH//HZLHu9XsWi98/ 5rA58Hqcv7eRxWPzCi2Py2dLPTat6mTzmLDoAKPH7psNbB69ze/YPD4+vcXi0bdlFaPH501y Hu0HupkCuKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTd MnOAzldSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX5qXr5aWWWBka GBiZAhUmZGdMfnOJseA9V8WU67+YGxi7OLsYOTkkBEwkbn74xtbFyMUhJLCDUaJh/hQgh4OD V0BQ4u8OYZAaYYE4iQuH9rOD2EICShLn1sxiBCkRFjCQuNVrDhJmE9CT+LlkBtgYEYGdLBLf 7x9lhJjPKzGj/SkLhC0tsX35VrBeTgE/idbHlhBhDYkfy3qZIWxRiZur37LD2O+PzYcaIyLR eu8sVI2gxIOfu6HikhKHDn0Fu1hCIF9iw4FAiHCNxNvlB6BK9CWudWwEu4BXwFei7+ZDJhCb RUBV4vjna1A1LhJtr56B1TALyEtsfzuHGWQks4CmxPpd+hDTlSWO3IKq4JPoOPyXHea/ho2/ sbJ3zHvCBNGqJrGoyQgiLCPx9fB89gmMSrMQgTwLydpZCGsXMDKvYhRLLSjOTU8tNiowgsdr cn7uJkZwItZy28E45e0HvUOMTByMhxglOJiVRHi9Q6NShHhTEiurUovy44tKc1KLDzGaAj08 kVlKNDkfmAvySuINTSwNTMzMDM2NTA3MlcR5pW1PJgsJpCeWpGanphakFsH0MXFwSjUwHRPL 5A3I/SbLVRyifqNm4q37t3ZNybn2r7r/47euVL3VXbdV5L8Z23VMXO1TO7sryUti47raIKMr qbrlX7a4nnl5Z++Ekwmzri/q+HRTtK1LVOl5rJXzup1P4tRfbIzq/FlTHGm0+nPHr/AH2e9f azHOvBlndmV7mHWRk65L4Iuljqomiz3iFRhZK+JnZXK5l7JNfLFlVmL+zN4jSQtXsB/PrNl/ yd/kafvku9XJP1/fnum9QWCfb9iMj52LY/OTMnZbhugqeR65f0nE5+K04EdZB6bKXVZoXDT9 w9HLm488vtzq2Pxu3/4L4g7V79u3eAg7yZyV0p7AkHLmu81Mji9dbq8j6tcrt/3h3LCiVYml OCPRUIu5qDgRADTtrYRNBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765498010579465924?= X-GMAIL-MSGID: =?utf-8?q?1765498010579465924?= 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 10 08:56:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 92002 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3489319vqo; Wed, 10 May 2023 02:42:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ750toA8J72eSLYebLoautJPh50Ird+RVZGiCPnxIfXLzLxapcfwde3gAkThtmeS6I6nxli X-Received: by 2002:a17:903:247:b0:1ab:16cd:51a3 with SMTP id j7-20020a170903024700b001ab16cd51a3mr22331476plh.10.1683711776232; Wed, 10 May 2023 02:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683711776; cv=none; d=google.com; s=arc-20160816; b=sHuh2OFXAx09QPLfBaW+LhsqHCto2/T3ATVpZld5759S+FfiFZZ9OA5vvwztKOhHxn AdTP0go1nF16rPE4kt8i5RA9sFJpwVoMQQlSCyfCdLnD33e3wQxXuQb4PXbVaZdo1KFx mDlhpDvwpwrcTEQOpav2+k7SoED9ytxCEEd+8BwPffySu3NrL4kFtRqZo6mFTo1pYvV6 9TsUnKrpOQHGKGfvg8sGWCsgmRS7NNi2aeK8zUJc2aciiN0wGowqGdNN2KIHWr0R3jTb bkOAm5zgGUiB8FnyoIlQ+cQ6bHQQBCyioQXtM5ta2E5e2hyMjQ+T2NM94Nrvcn+uUYHP 7lxQ== 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=fLnN6tR1YWlyQywEy9qyqiTOJibm7ko0IWs1AWEr+XOW43FD2VObcmYQCorSU93WrU aHy8oH74c49YrOn4nib+fjGSNbK5H78gjegMdCarq3W14+L9KGFHp72739+kAGfUjJeH kcUEr91t0iOQ9z1A7U+vhjH1pBWzUlHFfz66+N3uijmqtqNoZqAAhcRZwVcwqWwtMZ3K JIhGHA9NiMEtui8NNSB6+pzICbxdzTab/YXvorhSCxJDwbE8N9+y8NzqGESEQYLu/iPY j4BqEF4U/CdySoBb81aMvI4douYetE4B4F/Uv9kPXsL6B5Pg/iczW3Lfs6d9uSH4oOVX /Deg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QeisWYDH; 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 d17-20020a170902c19100b001a5824e78d0si3691881pld.94.2023.05.10.02.42.43; Wed, 10 May 2023 02:42:56 -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=QeisWYDH; 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 S236813AbjEJI4V (ORCPT + 99 others); Wed, 10 May 2023 04:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236851AbjEJI4P (ORCPT ); Wed, 10 May 2023 04:56:15 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA5C7ED0 for ; Wed, 10 May 2023 01:56:11 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230510085609epoutp03305dd53153e7a5d1d50f276d45d0f9e4~dvGMxsuYv1834518345epoutp03H for ; Wed, 10 May 2023 08:56:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230510085609epoutp03305dd53153e7a5d1d50f276d45d0f9e4~dvGMxsuYv1834518345epoutp03H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683708969; bh=v5aifcuvT4v06m1yAYerf8h0h01yE8oqVL3cCIFGtC8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=QeisWYDH+pcUIb/jjZqmWj9kjOeqOborClEn2r1kgCkny2ZD12tzuTCUrkOFPgoFR vWVed2KbkcSKLifspcau6Oq85O4v+e+sA9oB9ZqWFohzOm2snELr9l/unXmCbBzrRU dZCwaCFHMwgNC6j0FrAH7YNO3zQ2I51EjoThIh40= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230510085608epcas2p1febf27b02dec1003268c5c8056bb5682~dvGL35aQq1806718067epcas2p15; Wed, 10 May 2023 08:56:08 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.92]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTQc2M0Rz4x9QB; Wed, 10 May 2023 08:56:08 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-9c-645b5c28f5cc Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 79.09.08199.82C5B546; Wed, 10 May 2023 17:56:08 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 08/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085607epcms2p3d2b2dfc5db42f77c41f570c361a41c6a@epcms2p3> Date: Wed, 10 May 2023 17:56:07 +0900 X-CMS-MailID: 20230510085607epcms2p3d2b2dfc5db42f77c41f570c361a41c6a X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmha5GTHSKwfHn/Bar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjN+9r5iK/goWbHp5DHGBsZJol2MnBwSAiYSs7/8Y+li5OIQEtjBKLH/4wGmLkYO Dl4BQYm/O4RBaoQFoiV27j3BDmILCShJnFszixGkRFjAQOJWrzlImE1AT+LnkhlsIGNEBHay SHy/f5QRYj6vxIz2pywQtrTE9uVbwXo5BfwkWh9bQoQ1JH4s62WGsEUlbq5+yw5jvz82H2qM iETrvbNQNYISD37uhopLShw69JUNZKSEQL7EhgOBEOEaibfLD0CV6Etc69gIdgGvgK/E8WML WEFsFgFViQPbf7NC1LhIzG/eCmYzC8hLbH87hxlkJLOApsT6XfoQ05Uljtxigajgk+g4/Jcd 5r+Gjb+xsnfMe8IE0aomsajJCCIsI/H18Hz2CYxKsxCBPAvJ2lkIaxcwMq9iFEstKM5NTy02 KjCGx2tyfu4mRnAi1nLfwTjj7Qe9Q4xMHIyHGCU4mJVEeL1Do1KEeFMSK6tSi/Lji0pzUosP MZoCPTyRWUo0OR+YC/JK4g1NLA1MzMwMzY1MDcyVxHmlbU8mCwmkJ5akZqemFqQWwfQxcXBK NTBNcq6b8SvAYMql6jCDuNS+7A1H+lXjdBR29tlsEPSY3ZoXp2ba5rPjxM6DZVM35W4ovyL8 K4Uj+EbWnVL/A5pXvy3MPfj81LdlD/mj/E9dcCr+N4Vn6yf/kJxd8z40PrUPfxkg9Ox9f1Tn JrVlXYY9hjub0pY1iysFbPv8VCGWPaUn/Hvkg5aYDRGF+pomSbvYxBczP/abv23Xb07+NYI8 CXwKMz7ZOoY6pPfkLAh8IhsueeO6UC6XwtNjx+yunVcQmJDpVfhk693ZVc3yz1+0KnK807ve eUZfccm2qEtXvs0Jmug1O5d3a1rYGe5v34QvnzNYs2tzwKTtVSaO2RxP4uTWG9rXSYQ3Rs35 /lmJpTgj0VCLuag4EQD4eukiTQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765499759161761767?= X-GMAIL-MSGID: =?utf-8?q?1765499759161761767?= 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 10 08:56: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: 91974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3472449vqo; Wed, 10 May 2023 02:06:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ItjYhyAFV5+SVrfezz6fX7t/D6fwO0Eq4tI2l/VQ0ZRb567vyiEmIiBY2axk8J0O7yJuu X-Received: by 2002:a17:90a:290e:b0:23c:fef0:d441 with SMTP id g14-20020a17090a290e00b0023cfef0d441mr17664823pjd.33.1683709611075; Wed, 10 May 2023 02:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709611; cv=none; d=google.com; s=arc-20160816; b=wY9rtHg4CVtk5QX0URrk+wJjYF0kIbe7CCGjRF8pPUqkRwUx8kcuxS8TW4xNF8APEZ tPKAiXtG0NqBAcVjV/BeVLLDqNaPM2tVIum8Cnm692OExl9Hj3fG0qZmUuS2mSkqFu/V dJW5Dp1obTK65R3SW0ySjPtL2BJCRATJ6vETgJEsF22wt5RPZCvTROnvym51D7KYhVog 5KOSmNJJU1Iwb46xacefyqxgqr91myyWgQ5lqAGKZmqQnjMGXgigU5f1ApnWx8GKA20Q zVGHfc1i5qbQbSGYD3WKmkfn3XIi85zL45QD5WZmfHig5lbh1R4bhgk9ZEsLzuHgCdms FyAw== 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=WT9foYZIUd0iZQY/m2yMcfR/JgKekzeFECCQWpgZTt/vRCP9jCg3969aDQj2B4PyQr Yna4F8AOJd/XXPu+qRzc52TKMBWV+zeTt1mpGMt0fuCvpNz9S67r3Y3hvmTBoGknNqGF wjuAlBtRQj2HslqgP8WsTMV5oV1ARhVseQP/5M2tVb+OONqwCVsbdOvVpMWwIAMvxFx5 NtdnDgMWhENHfcx2oRFYlWJZGiX/zIToF2VZtbsE+k6Z5dWCGa5ZFgLRDPEHyEgCR13J HNU2bbd3TkaUYfGLwuFszQRlTDRT7KoAC095UFDa903+pHQ/P5ValF/hxsTK5kEd6Pxr Wkvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=umFmWPI1; 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 k189-20020a6384c6000000b00502f0410410si3519659pgd.472.2023.05.10.02.06.36; Wed, 10 May 2023 02:06: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=umFmWPI1; 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 S236842AbjEJI44 (ORCPT + 99 others); Wed, 10 May 2023 04:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236851AbjEJI4x (ORCPT ); Wed, 10 May 2023 04:56:53 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFF51992 for ; Wed, 10 May 2023 01:56:51 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230510085650epoutp0367c7b4233af43c34da0bb3038fcf24f9~dvGyJBiop1904419044epoutp03K for ; Wed, 10 May 2023 08:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230510085650epoutp0367c7b4233af43c34da0bb3038fcf24f9~dvGyJBiop1904419044epoutp03K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709010; bh=J1DOTjK8gn87giwmABoGcvRXxfDSssG6aRXYYY56duk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=umFmWPI1h3xq6KWOn9ccYpx2SqYTYAq7IrFm01qWBs0DnJb6VIAcqq380Z18jZwUt Mo4gncJbmeFyniWZnn1BpwsDkFHl/XBNyFkDADGSeg59ERpzbK85JP5+gpfvdnlWvw F3vros25MA8PC1aMcPRRA1NLFjZR05yTA1S/csZ0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510085649epcas2p2753e134660d5d8874f0a72088df2d640~dvGxmnF2f1277712777epcas2p2o; Wed, 10 May 2023 08:56:49 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.100]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTRN6M9zz4x9Py; Wed, 10 May 2023 08:56:48 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-6d-645b5c50b6c2 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 69.69.08199.05C5B546; Wed, 10 May 2023 17:56:48 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 09/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085648epcms2p8f7a9095b798cab8746c39ea25d7f3bec@epcms2p8> Date: Wed, 10 May 2023 17:56:48 +0900 X-CMS-MailID: 20230510085648epcms2p8f7a9095b798cab8746c39ea25d7f3bec X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmuW5ATHSKQfcSE4vVd/vZLF4e0rRY ufook0Vv/1Y2i0U3tjFZ/O26x2Qx6dA1RounV2cxWey9pW1xedccNovlx/8xWax7/Z7F4veP OWwOvB7n721k8di8Qsvj8tlSj02rOtk8Jiw6wOix+2YDm0dv8zs2j49Pb7F49G1ZxejxeZOc R/uBbqYA7qhsm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23 zByg85UUyhJzSoFCAYnFxUr6djZF+aUlqQoZ+cUltkqpBSk5BeYFesWJucWleel6eaklVoYG BkamQIUJ2Rl7N81nKtjEVzFx1Tb2BsaJPF2MnBwSAiYS9488Yu9i5OIQEtjBKPHh9ibmLkYO Dl4BQYm/O4RBTGGBUomNBzNAyoUElCTOrZnFCBE2kLjVaw4SZhPQk/i5ZAYbyBQRgZ0sEt/v H2WEGM8rMaP9KQuELS2xfflWsF5OAT+J1seWEGENiR/LepkhbFGJm6vfssPY74/NhxojItF6 7yxUjaDEg5+7oeKSEocOfWUDGSkhkC+x4UAgRLhG4u3yA1Al+hLXOjaCXcAr4Ctx7PcqJhCb RUBVYunE86wQNS4Sc79uBoszC8hLbH87BxwGzAKaEut36UNMV5Y4cosFooJPouPwX3aY/xo2 /sbK3jHvCRNEq5rEoiYjiLCMxNfD89knMCrNQoTxLCRrZyGsXcDIvIpRLLWgODc9tdiowBge rcn5uZsYwWlYy30H44y3H/QOMTJxMB5ilOBgVhLh9Q6NShHiTUmsrEotyo8vKs1JLT7EaAr0 8ERmKdHkfGAmyCuJNzSxNDAxMzM0NzI1MFcS55W2PZksJJCeWJKanZpakFoE08fEwSnVwFTB vdj1pNrdux4zzT98OH7IP0fs8FyjyMKwJbYfvuQLM6f1Czj8mNYj/qeY4+WyRdmTXEo1NRlO vV+ivPHGsWKVgoZts7SLOiXqjJQVKxaUnPzGd7f5E6ukqNikrGeZJjLr7zlN4j9+M741TEPp R1hFZ4/+jB0pKhueyFq7nGb/NcFs3iX+1zFXFt5afNTPVv+rGv+5n+8Xt2fIzE7/NWn5x0vB Jx87/JwvcT5kacsn7XXGh13Vt7Bt8Nz48Zjzr8QLtbdrN606tKGvR3rm5PZ3/d3H7035Ea5V v1mT9U5pWEnqE4vjmZb6/k/7tiw9Ye2xvCb2QPOfuKajp81PyUvIp7fp/1q6TCHs75nr7+Yp sRRnJBpqMRcVJwIA9QaM7UwEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765497489427572755?= X-GMAIL-MSGID: =?utf-8?q?1765497489427572755?= 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 10 08:58: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: 91984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3480359vqo; Wed, 10 May 2023 02:22:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jnwWJ458iOPoUA7a7iGlqknClDzfhvQ9Rpp/M3bs2KTJnNdT61iye/1lDqOa80POgXEug X-Received: by 2002:a05:6a00:2d09:b0:63b:5c82:e209 with SMTP id fa9-20020a056a002d0900b0063b5c82e209mr24020165pfb.10.1683710519937; Wed, 10 May 2023 02:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683710519; cv=none; d=google.com; s=arc-20160816; b=n8TUhQ7Hi98asuaVnZ2A0tVH173Dr0DbKnIuwluaMKifUcaS+Nt5Fui9e0JaBmHk8R JhdgWy+SFZfRjAG3ZOqqkusYFEQ3H6jhM3MJqAqHgTT8LAVI1j5NboD+VYHVwcSn8aRg T1D9amuGfYerv1IfFl182emplTzRyTNvrre8ndoZSRdHH5SqNhVb3YhhnMOu7ZehIMP9 jDUd940FEjpArJCOMLcuZ4+bir20OqO4gu7cfqQPZoGCeVsmEGcYhx6RoP5dcfCG1Yuj IQgcIwtHgnoMEjXc4SX7l47AxiPPu7daO3C30UrOc10/iVz+x2C3zT6w+3meXaGMxEKk 6MGQ== 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=lINUc95u8blipffzZbWJSa4wyP7ng8MoNg9N5Vdx2mFh44GeUnZyKonlHGmsjNM8TF /9k+0x9ZeQjrMWgRDv1wfcIKCDtLKV3gJbi+d8/LtnyMXuPNKhJXcoz+nFlYTWs6SGXo CMPQb7c5QljoGdlaDidptOag1b/LgEbKCUk5PQciCjBIQsZMJhOeSwT6muRtEKQgMDUP my70iBIp7E0ocGDji4IyjWFrZz4W3vzUNR21UgB3baZ07OUlJuCiu54kXp0tEiZauMAA LLA3fKOCkG46VvreeaMErj5xKd4jFpiFqKQJT1KTFWehJM+hBNsrBQ7XWzyAzfO4JEce juJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BNuUSbKP; 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 k189-20020a6384c6000000b00502f0410410si3519659pgd.472.2023.05.10.02.21.47; Wed, 10 May 2023 02:21: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=BNuUSbKP; 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 S236829AbjEJI62 (ORCPT + 99 others); Wed, 10 May 2023 04:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236483AbjEJI60 (ORCPT ); Wed, 10 May 2023 04:58:26 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8BD12E for ; Wed, 10 May 2023 01:58:24 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230510085822epoutp01535714262ecf6126964473e60f05414c~dvIIgINYU2057320573epoutp01I for ; Wed, 10 May 2023 08:58:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230510085822epoutp01535714262ecf6126964473e60f05414c~dvIIgINYU2057320573epoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709102; bh=ZfhC85BvKxKIuur1CoeZsaWeIlAnBRlkMNE/o0TIGEU=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=BNuUSbKPs0guXiN6nW9GD9PbT17ucuEwPrqtqZ9w0U/OLfg9Gjf37ZJVDiLVlju9F 4Yu0KzlCNiRZ+d4Hh6ztEUy0UynxgXh4n/LSDotMqV4AnvKiFEVCn2LlZKnOXq3Ra/ 09i07CPwT9nF6WpxVxaSE2Up7tKZg1Im/CiG5R1w= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230510085822epcas2p12468ee6a15f4aa3e73bbe3afef6270ba~dvIIGsWkw2929929299epcas2p18; Wed, 10 May 2023 08:58:22 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.68]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4QGTT95Bp6z4x9Q3; Wed, 10 May 2023 08:58:21 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-40-645b5cadb711 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id FA.5A.08199.DAC5B546; Wed, 10 May 2023 17:58:21 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 10/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085820epcms2p899d5cfca9a0aca4bd6654d9d0189b6f8@epcms2p8> Date: Wed, 10 May 2023 17:58:20 +0900 X-CMS-MailID: 20230510085820epcms2p899d5cfca9a0aca4bd6654d9d0189b6f8 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmhe7amOgUg+ePNSxW3+1ns3h5SNNi 5eqjTBa9/VvZLBbd2MZk8bfrHpPFpEPXGC2eXp3FZLH3lrbF5V1z2CyWH//HZLHu9XsWi98/ 5rA58Hqcv7eRxWPzCi2Py2dLPTat6mTzmLDoAKPH7psNbB69ze/YPD4+vcXi0bdlFaPH501y Hu0HupkCuKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTd MnOAzldSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX5qXr5aWWWBka GBiZAhUmZGdcnXOdtWADZ0Xn6lvMDYzP2LsYOTkkBEwkrh99w9rFyMUhJLCDUWLj+5NACQ4O XgFBib87hEFqhAWSJWbP/MoEYgsJKEmcWzOLEaREWMBA4lavOUiYTUBP4ueSGWwgY0QEdrJI fL9/lBFiPq/EjPanLBC2tMT25VvBejkF/CRaH1tChDUkfizrZYawRSVurn7LDmO/PzYfaoyI ROu9s1A1ghIPfu6GiktKHDr0lQ1kpIRAvsSGA4EQ4RqJt8sPQJXoS1zr2Ah2Aa+Ar8TbKVPB xrMIqEq0r2uAWuUiseLJM1YQm1lAXmL72znMICOZBTQl1u/Sh5iuLHHkFgtEBZ9Ex+G/7DD/ NWz8jZW9Y94TJohWNYlFTUYQYRmJr4fns09gVJqFCORZSNbOQli7gJF5FaNYakFxbnpqsVGB MTxek/NzNzGCE7GW+w7GGW8/6B1iZOJgPMQowcGsJMLrHRqVIsSbklhZlVqUH19UmpNafIjR FOjhicxSosn5wFyQVxJvaGJpYGJmZmhuZGpgriTOK217MllIID2xJDU7NbUgtQimj4mDU6qB SYh1w+eev8+CP0/KzI2/9L3IRVjGjmNuNd8TXbFfr461B51fu37L3MtHj1vc37roQrrvlk/Z t1enzvywhSlxPh+XTytLo0hC+fUHJvO/rxd7vkworVOwTP7u1pr8O/XBx/0/lRUu80qc/Fvg 9OKs4iu+4vybK1SFpyrb9kxLZDGfIbfUTmOezRZOm69nY05MClu25dCf7PB19t6ma06cLrj6 /cDe3zmqhfuOf3N7m7xsz+NTZ29yacvJes3xDBZe48ZwYtvkp85nZJRMJor/sd5g5fpv1c1W 3v1xCjpes58/efD1IuvFl9MCPka/KHCWrGl2WeuV1ftW98MZyc6bU9cdzHzvc1Op+3z2mrKn T1cosRRnJBpqMRcVJwIAz4+I5E0EAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765498442253251247?= X-GMAIL-MSGID: =?utf-8?q?1765498442253251247?= 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 10 08:59:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3471332vqo; Wed, 10 May 2023 02:04:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MAeq/Y7Z6S7AbSIyJtMl7rcPnw+nidKPB8LvgEJmJHdVAF6Z4zM1/TWkqZy5JME0WtBJr X-Received: by 2002:a17:90a:8a8c:b0:24e:5344:9c9d with SMTP id x12-20020a17090a8a8c00b0024e53449c9dmr16291371pjn.38.1683709490079; Wed, 10 May 2023 02:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709490; cv=none; d=google.com; s=arc-20160816; b=KT460qsKKaur55tiDNUy+kWGDNtX+j6dYbsYkK/qptFHkui2j+HAfDnVYxGkCLoDVx qsDHo/jFgeQFEZX15W7Mxqlm8M2RZD7BrtbS0t4rJPVrnexoQynaqCiAeQ773IV+rNww J/i295EK4yh+SIuJBU7l/QgAMSlevPZVYXyT6WM2T0JwjRL5GCpSfCyFbEdTBCDxPUdw BoYpqy8PbyqBG/kzETRqB61kJYSCEbK4tJOsm0rF4AlFNDHGQoj3795c+IwI0c6VBj6D kGzw7yfPt+wXEak8FsCgF1XCpCfqACb+pclxEb8pDyfgLdhvie6TQ6fKh8pt114Qpqfj zWPQ== 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=Yqqfr3K3KIPaAQKyQbn1HemGf25ahknhXi+WIsDmVtRgcqaPIzBA1z54H0TO+BTA6H Xie3NM6/Lh4Cas+JoorbBMh5/N8yzvY9yY17vVE4mMM1AR2qcIrmsvPx8fseLLuNjLr8 GUQt85oW8uzAwaHr8z0mHL+9n0c9oT2+dZKX8CviNXqbEY28n/jrcOLCqckdOpS/RCpF Nl/Dn5N6PChoIACNZOe/VLGDVQvXtY0wbafJgtOqVKWqP8RCfLixUv5hz3iU5oscI/r4 pKg/dnO878M3NSjPGWxWZHqqFgj4F1LM73S52ZaVXlHoGaGxj7mWFtNfCcNo+7YwUjXG lhFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=uTMLtsP7; 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 in16-20020a17090b439000b0024e13530c0dsi21349807pjb.38.2023.05.10.02.04.37; Wed, 10 May 2023 02:04:50 -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=uTMLtsP7; 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 S236928AbjEJI70 (ORCPT + 99 others); Wed, 10 May 2023 04:59:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236887AbjEJI7N (ORCPT ); Wed, 10 May 2023 04:59:13 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F13525F for ; Wed, 10 May 2023 01:59:09 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230510085907epoutp04a6bbb272ee1a38d40f18824fbe6ab393~dvIyfYGJz0387403874epoutp04D for ; Wed, 10 May 2023 08:59:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230510085907epoutp04a6bbb272ee1a38d40f18824fbe6ab393~dvIyfYGJz0387403874epoutp04D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709147; bh=ZM+sCSOwfR6BMhP2ycEflPofWbLGNzFKU7U4qcknaW8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=uTMLtsP7OuMD8Qe1NqrYiLngFx3YXm+Z3OZdrpf4Dl5zxkHY4oADzvAE2qTTCJt/B LDlMc1cyDYqLs9QeSZPJn73kCtfnG+9SexheXSfl/WXeY2xoHj4us8IF2eKRMuMKUs wc2v6DMhX7Ho2TzqB9JX8TxDafVroUeFuz3MvCOo= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230510085907epcas2p38c4de637761704a263ba3a299ff61bf1~dvIx6k1yA2639126391epcas2p3f; Wed, 10 May 2023 08:59:07 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.91]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTV24ZlMz4x9Pw; Wed, 10 May 2023 08:59:06 +0000 (GMT) X-AuditID: b6c32a48-6d3fa70000005998-ee-645b5cda02e7 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.0E.22936.ADC5B546; Wed, 10 May 2023 17:59:06 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 11/14] 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" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085905epcms2p19082f99cbf2c80135d9239e998be7928@epcms2p1> Date: Wed, 10 May 2023 17:59:05 +0900 X-CMS-MailID: 20230510085905epcms2p19082f99cbf2c80135d9239e998be7928 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmqe6tmOgUg/eTVCxW3+1ns3h5SNNi 5eqjTBa9/VvZLBbd2MZk8bfrHpPFpEPXGC2eXp3FZLH3lrbF5V1z2CyWH//HZLHu9XsWi98/ 5rA58Hqcv7eRxWPzCi2Py2dLPTat6mTzmLDoAKPH7psNbB69ze/YPD4+vcXi0bdlFaPH501y Hu0HupkCuKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTd MnOAzldSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX5qXr5aWWWBka GBiZAhUmZGfs+rSZsWAPe0X3zjmMDYyr2LoYOTgkBEwkjj8t7WLk4hAS2MEose3fEiaQOK+A oMTfHcJdjJwcwgKxEm/fnmACsYUElCTOrZnFCFIiLGAgcavXHCTMJqAn8XPJDDaQMSICO1kk vt8/ygiSkBDglZjR/pQFwpaW2L58K1gvp4CfROtjS4iwhsSPZb3MELaoxM3Vb9lh7PfH5kON EZFovXcWqkZQ4sHP3VBxSYlDh75CfZIvseFAIES4RuLt8gNQJfoS1zo2gl3AK+Ar0fVnARuI zSKgKnFywytWiBoXiefbP4KtZRaQl9j+dg4zyEhmAU2J9bv0IaYrSxy5xQJRwSfRcfgvO8x/ DRt/Y2XvmPeECaJVTWJRkxFEWEbi6+H57BMYlWYhAnkWkrWzENYuYGRexSiWWlCcm55abFRg Ao/W5PzcTYzgNKzlsYNx9tsPeocYmTgYDzFKcDArifB6h0alCPGmJFZWpRblxxeV5qQWH2I0 BXp4IrOUaHI+MBPklcQbmlgamJiZGZobmRqYK4nzfuxQThESSE8sSc1OTS1ILYLpY+LglGpg 6jnwfeaXrbuUtr39J/AgZUdTjM2spKTt6dWl3akHHxm+atiw4fzLzPPC3zdOVz/zeObkc5cX +MlVPStgyJcQyXNLlq6MOBtRfmlX35Yl3y00fJdxySRNCrA9tFRMWUF6UkNc+q+vz1gitn4v +hNj0cVSuFmy5OanABm3PPYKNeWNK0weT08ySkqeKC8Wvltcvaq+zWDuSzkjV92vt40WZXXu K+18p+tzuVnT9N+1DT9OeC6Vsg/hcuUtWSzm/XNuod87/Q/6ak7PVyXctNPX6mMq5T0mbXB4 pj3L1jvMBnd6HjVsjcl4Ljl96SLlX9L8Ao+1A8VKdv2O6/9kuPFCrFPq9mI2pSepwbzffGKV WIozEg21mIuKEwGStHPFTAQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765497361923861796?= X-GMAIL-MSGID: =?utf-8?q?1765497361923861796?= 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 10 08:59:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 92003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3489334vqo; Wed, 10 May 2023 02:42:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C9uLe7r5ZtuyXl6xbI8NqETB0GpTNN2vsVWByvk2OPZDsX3pmFpZmXIIIFGWsrS7GxIuM X-Received: by 2002:a05:6a20:8425:b0:f6:d60d:dbc2 with SMTP id c37-20020a056a20842500b000f6d60ddbc2mr21250142pzd.28.1683711778173; Wed, 10 May 2023 02:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683711778; cv=none; d=google.com; s=arc-20160816; b=HBngD60VudB+WTmSns68TBK6z6QrRrzzA8MKDfHnpm7OKLHdY2SG19Xy6EJeVKvTPL s6dB3z4KbN1PypX0HaNV8KuTY+4MVMzDJOex9Tch9159/3OF8xZv6sNTzIS7ybdQm7XB xLzWxrx20xhLzqcHx/5SuBnmXHVpsub/FafHJHhbl+WSYW3ga5m1/Wo2gM/AbbaZb6VP CFAYSsc/MYk1MqReSRS/vvLCfOC+4T+i3ddPq886Ni/5AwCD7q+w98rOSkOVff8fNTvG v23ydWksFqVbvqsLHi9RO3L9yCUcw6Jf1T8VEgfT+iWFJunaulSN0VOsVEFrGCaAfgZu 19AQ== 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=sVfhvt67RI59s6Gd6R+cinzbvf6W3rrVcFHTc4WgexY=; b=XLHpA5EcVm4zXxockeZax2Ug82JjmCLf75X6iWiqT9F//aC5sLNOpf99mIiTB/qZ1a woHHMnOIlT40FupwonT4eZ0+rZ2WfUiS+/w0ai8wJ6q4b8q4Uf2erF9Nwpay8SPYZqY0 7NaW5L6ZSLvizg2oN02c1OXQ4sLs5DoCePEy+KPBfIJGRT+0NO0se6r8s1vdqyXW695T sDdasyyqgtvQQ4n9J6RQtjR7dIp1N5+Nv0aOahN+txI7zM8MJWKSF3TwMCEVqzJOiRZg mtwi3r14Khtc4pSU//wfgxZBuTUVcoT96KVW2gOA+G7Qq+Kp2VsqsGNQT/BoUI6CPH8D VH5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Jafh8pKw; 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 mq18-20020a17090b381200b0024e1c1b3004si23447658pjb.78.2023.05.10.02.42.46; Wed, 10 May 2023 02:42: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=Jafh8pKw; 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 S236738AbjEJJAG (ORCPT + 99 others); Wed, 10 May 2023 05:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236975AbjEJI77 (ORCPT ); Wed, 10 May 2023 04:59:59 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A36030CB for ; Wed, 10 May 2023 01:59:45 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230510085943epoutp02c9ea77a2d7f9de113bf76efb845ff268~dvJTlmUHi0979409794epoutp02G for ; Wed, 10 May 2023 08:59:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230510085943epoutp02c9ea77a2d7f9de113bf76efb845ff268~dvJTlmUHi0979409794epoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709183; bh=sVfhvt67RI59s6Gd6R+cinzbvf6W3rrVcFHTc4WgexY=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Jafh8pKwRrQBYFkvCStEOURS774YofUXGgUTCWXS7qxKeEJGACfhGYNp1n/s1d8Kn 8WZ7/bd8Hq5ve35JyndCPSH2gHnRetg0M5kPswdzZ5DGE9CtAsCCd4PM10vmIytAUv T5gtdtVy4jPHE6aWfFMj+/v3AplMV++1RBILfvKM= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510085942epcas2p267865a45cb0918325c9cef99237abf7e~dvJTKJJtS0405704057epcas2p21; Wed, 10 May 2023 08:59:42 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTVk0ycTz4x9Q9; Wed, 10 May 2023 08:59:42 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-9d-645b5cfe1932 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id F2.0B.08199.EFC5B546; Wed, 10 May 2023 17:59:42 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 12/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510085941epcms2p8ad574939bc3edbd65b8f208c80a85911@epcms2p8> Date: Wed, 10 May 2023 17:59:41 +0900 X-CMS-MailID: 20230510085941epcms2p8ad574939bc3edbd65b8f208c80a85911 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmqe6/mOgUg5kvmC1W3+1ns3h5SNNi 5eqjTBa9/VvZLBbd2MZk8bfrHpPFpEPXGC2eXp3FZLH3lrbF5V1z2CyWH//HZLHu9XsWi98/ 5rA58Hqcv7eRxWPzCi2Py2dLPTat6mTzmLDoAKPH7psNbB69ze/YPD4+vcXi0bdlFaPH501y Hu0HupkCuKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTd MnOAzldSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX5qXr5aWWWBka GBiZAhUmZGdc27GfqeARb8XW7ztZGxhXc3cxcnJICJhI/JxxkbGLkYtDSGAHo8TPX59Zuxg5 OHgFBCX+7hAGMYUFgiT+9bOClAsJKEmcWzOLESJsIHGr1xwkzCagJ/FzyQw2kCkiAjtZJL7f P8oIMZ5XYkb7UxYIW1pi+/KtYL2cAn4SrY8tIcIaEj+W9TJD2KISN1e/ZYex3x+bDzVGRKL1 3lmoGkGJBz93Q8UlJQ4d+soGMlJCIF9iw4FAiHCNxNvlB6BK9CWudWwEu4BXwFdi9eqNYJ+w CKhKnNv5D+oyF4nn93aAxZkF5CW2v53DDDKSWUBTYv0ufYjpyhJHbrFAVPBJdBz+yw7zX8PG 31jZO+Y9YYJoVZNY1GQEEZaR+Hp4PvsERqVZiDCehWTtLIS1CxiZVzGKpRYU56anFhsVGMOj NTk/dxMjOA1rue9gnPH2g94hRiYOxkOMEhzMSiK83qFRKUK8KYmVValF+fFFpTmpxYcYTYEe nsgsJZqcD8wEeSXxhiaWBiZmZobmRqYG5krivNK2J5OFBNITS1KzU1MLUotg+pg4OKUamPoL uPUDOePUD9/w453rYn9wjmCKssOpmUpShUVXJlrO2mGuXPHiZ/2GCPFF0xMDNkosfaM794Tw um3/CxiumZt+m3+j89W91viP5tvY9U//d9JeqveL1attaunp4s2H8zyvqqctm6XLNzMo8ueG /e/3zasp0T2hPW2tRvmZ9qUVk7jdts3XtT24v6B14mOOTVNNBb8ucjwxd09+SP7vTbuembq+ +PV+W84s7q/B8jcXebXf7635alm1aUtzdHH7A/ZTH/Y2KL0vmB92QOVOf3ltvWdL4muJwM2V LR8ELuxbpev/1lbjZ7RE9fa2N1ktUjGv9k5uvZlewfNop0q+dkTUT887jwosL37v9PvzYLIS S3FGoqEWc1FxIgCJ9ijbTAQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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_H2,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?1765499761421719298?= X-GMAIL-MSGID: =?utf-8?q?1765499761421719298?= 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 d766be7152e1..8b65463d4a55 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -692,6 +692,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 10 09:00:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 91994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3486498vqo; Wed, 10 May 2023 02:36:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+H+fAt0CwpOxTmoobCR/+KLHEHKqOOo5Xm5ccrMYUnBq6bGnzsiyl9SJxrH3+6kqbaeOb X-Received: by 2002:a05:6a00:140f:b0:63d:24d0:2c32 with SMTP id l15-20020a056a00140f00b0063d24d02c32mr20295657pfu.33.1683711364576; Wed, 10 May 2023 02:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683711364; cv=none; d=google.com; s=arc-20160816; b=0L2W/9w10WnZGQ8gbDXWOl3MeWTNTCzl+PTtIpXQrLnR200BW2+3zpYOY2XJk0zjyq 8Ydomzj7EOmxb8/Mnq4td/fArjrW2c/YRQWd3DHyZSXTrIugO6DSEvhkV6hlbYO3Xs/u LLC6OkLOX0pf588IkiaJ4YpFwbcnoG/HdkyN7x7qbk/LGUT8d4UHCJ0Rmbcm+kzDZtXr 2ONM9WNaIIQqShN8vCM/aV67kDMM6HFx/QIEFt5CnN4c93jEOoumDlbcuwwS+kZTPOSD /NMr2OrZ6chJ1+yVxlK/KrtlC4OuHNLUKb7PqJTvm9lk4Y7ogAZ9U5QFQG4ZY/QHMZwe S1+g== 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=wje4+70dQGpdS69u2rE7bX4B832hSjQqhr75qyzguy4=; b=INNp5ecAimxFfZBl1//PAvairctB4RQx6HFQUKMcDaLC8TIdyIdvpohb1IwLR95kWm T1UK0a6+CW0Ly855fxATv1tiWAyPcDkdjOE7+i6Xj5vT6JP1STshS6i09Nv7mTTIN8yQ f0LAhqn+xF2zWiVIwZVTVefLoXqYRd0GpNPep5PcCuwUmHbNrl4JfpNANtrziir53Ypm c9duAfmTWO+C3IbATqD4U31eTHOIc6DS/lv2YhEa1Xk7L7NBMza1/qGsMRU9q4ns3iU/ gkvSs3bjLUVdEH//3elwI5mv5i0qQcEz6BrZTnWEURX6VVj59EvrmMKEhtDVyDccYS63 lqPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kqhxbcPS; 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 n20-20020a638f14000000b0052c8a4f0adesi3522434pgd.526.2023.05.10.02.35.49; Wed, 10 May 2023 02:36:04 -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=kqhxbcPS; 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 S236656AbjEJJAk (ORCPT + 99 others); Wed, 10 May 2023 05:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236704AbjEJJAd (ORCPT ); Wed, 10 May 2023 05:00:33 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D13A81991 for ; Wed, 10 May 2023 02:00:31 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230510090029epoutp04ffcb8da21d6fff2967244644673de629~dvJ_zWSMz0275802758epoutp04V for ; Wed, 10 May 2023 09:00:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230510090029epoutp04ffcb8da21d6fff2967244644673de629~dvJ_zWSMz0275802758epoutp04V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709229; bh=wje4+70dQGpdS69u2rE7bX4B832hSjQqhr75qyzguy4=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=kqhxbcPSaXcHOAsTgBGMGwm6YMedZCqxm6NhZsPtvidMrw0TQYSXo3t1TL3e3V4aZ s3XjZK5KaBGeCUInbvdLn6FJvNZzS/7Qwein6X4MVcSn56wH4Kt1c+Ynba6AtS6uqJ 1V/YEzJFik18+sROJmWlMXWngEiRRf69GgrjAuhc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230510090029epcas2p4bf8726b14940f028d6ff4c6aedc737fb~dvJ_PgxYW3236532365epcas2p4S; Wed, 10 May 2023 09:00:29 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.89]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTWc466Bz4x9Q0; Wed, 10 May 2023 09:00:28 +0000 (GMT) X-AuditID: b6c32a45-465ff70000020cc1-e1-645b5d2c08f0 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 09.2F.03265.C2D5B546; Wed, 10 May 2023 18:00:28 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 13/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510090028epcms2p6bdffebacbdf4784bbf03a62b7101dd98@epcms2p6> Date: Wed, 10 May 2023 18:00:28 +0900 X-CMS-MailID: 20230510090028epcms2p6bdffebacbdf4784bbf03a62b7101dd98 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmma5ObHSKwf4Pchar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjMWNa1jLuhSrJj45xprA+MsqS5GTg4JAROJi+/72boYuTiEBHYwSmzpfsHcxcjB wSsgKPF3hzBIjbBAisS7lR3sILaQgJLEuTWzGEFKhAUMJG71moOE2QT0JH4umQE2RkRgJ4vE 9/tHGSHm80rMaH/KAmFLS2xfvhWsl1PAT6L1sSVEWEPix7JeZghbVOLm6rfsMPb7Y/OhxohI tN47C1UjKPHg526ouKTEoUNf2UBGSgjkS2w4EAgRrpF4u/wAVIm+xLWOjWAX8Ar4Ssw7eBEs ziKgKjHn5QomiBoXic3tU8DWMgvIS2x/OwccCMwCmhLrd+lDTFeWOHKLBaKCT6Lj8F92mP8a Nv7Gyt4x7wkTRKuaxKImI4iwjMTXw/PZJzAqzUIE8iwka2chrF3AyLyKUSy1oDg3PbXYqMAQ Hq/J+bmbGMGJWMt1B+Pktx/0DjEycTAeYpTgYFYS4fUOjUoR4k1JrKxKLcqPLyrNSS0+xGgK 9PBEZinR5HxgLsgriTc0sTQwMTMzNDcyNTBXEueVtj2ZLCSQnliSmp2aWpBaBNPHxMEp1cCk zntdeHOUfohO9J+NjBunlB83EtfweHv00fdizuKksl8eK2r+yyZ6OH02vHVFI0mtgD/+zamH FZ8+6urcUko4pX5pUZxFgWiiy5GO9rwlnZzrKz+wxPfWmwq6FJv8v8x7PFaOZeoCS4ttUevs +c4VzemJ82LPWXz3lWC8Z5NBSIjspRar3PDGMo2LZ0Wnatn8/Hu2pX9BnnRsuSrLr4d71mX4 ls2Y0l3fdSJd98zmbXuV0g7xdJqwnRby6YuZaR4n99rR8dH0UDPF6fM+HUpketj2bYvGDK2w qyava6pNT8y1XH2SdfZjm/+8pVO/R2yX/+ojosDctPb84kezr/7uiV++zML5kMKud6avtiqx FGckGmoxFxUnAgBw8ne9TQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765499327457322317?= X-GMAIL-MSGID: =?utf-8?q?1765499327457322317?= 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 | 54 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 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..f17e19ff3a11 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -524,6 +524,60 @@ __blk_segment_map_sg_merge(struct request_queue *q, struct bio_vec *bvec, return true; } +#if defined(CONFIG_BLK_DEV_INTEGRITY) +/** + * 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); +#endif /* CONFIG_BLK_DEV_INTEGRITY */ + static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, struct scatterlist *sglist, struct scatterlist **sg) From patchwork Wed May 10 09:01: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: 91972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3471323vqo; Wed, 10 May 2023 02:04:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61mW3Wc0mMou1TKNcFeeTsU1XqwuvcyY/KLS0M/LV1B2mo8SZ9I+lLHA/6mAETqEBeFej+ X-Received: by 2002:a05:6a20:6a0a:b0:f0:b6e3:90f2 with SMTP id p10-20020a056a206a0a00b000f0b6e390f2mr23071649pzk.13.1683709488677; Wed, 10 May 2023 02:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709488; cv=none; d=google.com; s=arc-20160816; b=UxXK0NgCWULD/LTM3pZWPxT94ku9uohxwcJmsdX/gU/L8VDhgnif2D4rOnI9lYmqnZ IO/+ywctD+lCyr4n8IHSnGSTSojdb0CKTkL+T4ZvSkCFik7Zh0mvvYqZLzYNqtU9tr+e 4fG8BfXhNGcwSw+fg7PEh9qIY1WgTjShTL3e4s+wIbi1gZir2r1wJWqS9KFmyeA26IqG WwiHpCmg5Jlx0UMcyndpOP/vqhxgcNLYMN3nP2pssNNNp3zMRUXpxWCVxNpO2roFz9wa +nG5J8cMzw9wuCU0/bvVN6MWg9gEC62mbYru98OUl/0fz8KnSyDmXYSunLBZ9IPAS/N9 9dkA== 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=CRZ4gwtTwRPB5GOKBdAqyRYKY7eq5ltQfw0ZKGSuWH1HHYrdvbeCkl51Opr+Snzxf8 9HsXKdes9WWpxWVaLlwZQ4JeYz1ZgOBVVq7uD7+eSeIOnewBzh+6CxdXtnchKv3vAXiD IJgNAW0kPJxkzQfK1uZR+ITEZNUlgv6yVmn5jOR3SZluYmfnieBkmVvNMntywq7dJ/pS E8i3UIbn12Js79gYllEHmxsWmvSRQm3kU1rNYYl6GVDt/yuqoAtPji7PiaxdPXoL8VJG hwiK4h5cwC8rCTe6woJF7b4ocg5B4C+rIMTSUOrvyeWGCkBNCLSeL5/L33E51t94gC9n 8g6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="Ur//sbmP"; 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 o18-20020a639212000000b0051b6f110ab8si3734312pgd.303.2023.05.10.02.04.36; Wed, 10 May 2023 02:04:48 -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="Ur//sbmP"; 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 S236863AbjEJJB2 (ORCPT + 99 others); Wed, 10 May 2023 05:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236901AbjEJJBV (ORCPT ); Wed, 10 May 2023 05:01:21 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FF9530D5 for ; Wed, 10 May 2023 02:01:10 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230510090108epoutp0302d7688a387a80e8ab1a0f310f69f3c1~dvKjBk19G2631026310epoutp039 for ; Wed, 10 May 2023 09:01:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230510090108epoutp0302d7688a387a80e8ab1a0f310f69f3c1~dvKjBk19G2631026310epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709268; bh=z1Pr/BMubVK5gm0MNy0PUzgA5DYmQXK+i/O5omA92XA=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Ur//sbmPlheyjRb/jGdMMFtWBDOXIcVc9PpOnEkdyaKTVyBEWfqZ4rH04zONMmVFP OcRo7HxITKgZET3RKCTCchg5Mal6gNt9P1yznhDWslp9ei9kkOMuLk6Ruu1d5jwwKK +KuHAwuP6+xESzKLdIiMi9PTpmlJljdPgHQkXhzg= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230510090107epcas2p39eda11ef0936574572a88fbb7d09ff2f~dvKiRERyR0699206992epcas2p38; Wed, 10 May 2023 09:01:07 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.98]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QGTXM2DDjz4x9Pr; Wed, 10 May 2023 09:01:07 +0000 (GMT) X-AuditID: b6c32a46-b23fd7000001438d-2c-645b5d5361cb Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 42.AB.17293.35D5B546; Wed, 10 May 2023 18:01:07 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 14/14] 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" , "kbusch@kernel.org" , "hch@lst.de" , "sagi@grimberg.me" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "johannes.thumshirn@wdc.com" , "kch@nvidia.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: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> 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: <20230510090106epcms2p74a9f34d7f2202c8e5336615cc12b89a6@epcms2p7> Date: Wed, 10 May 2023 18:01:06 +0900 X-CMS-MailID: 20230510090106epcms2p74a9f34d7f2202c8e5336615cc12b89a6 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmmW5wbHSKwdK1Ahar7/azWbw8pGmx cvVRJove/q1sFotubGOy+Nt1j8li0qFrjBZPr85isth7S9vi8q45bBbLj/9jslj3+j2Lxe8f c9gceD3O39vI4rF5hZbH5bOlHptWdbJ5TFh0gNFj980GNo/e5ndsHh+f3mLx6NuyitHj8yY5 j/YD3UwB3FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlA5ysplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjPOLjrDWNAtVLFyYT9bA+NLvi5GTg4JAROJnY+XsnUxcnEICexglHjXOpuxi5GD g1dAUOLvDmGQGmGBEIkNfc+YQGwhASWJc2tmgZUICxhI3Oo1BwmzCehJ/FwyA2yMiMBOFonv 948yQsznlZjR/pQFwpaW2L58K1gvp4CfROtjS4iwhsSPZb3MELaoxM3Vb9lh7PfH5kONEZFo vXcWqkZQ4sHP3VBxSYlDh76ygYyUEMiX2HAgECJcI/F2+QGoEn2Jax0bwS7gFfCV2L9wG5jN IqAqse/bX6iRLhJ/Hs8FizMLyEtsfzuHGWQks4CmxPpd+hDTlSWO3IKq4JPoOPyXHea/ho2/ sbJ3zHvCBNGqJrGoyQgiLCPx9fB89gmMSrMQgTwLydpZCGsXMDKvYhRLLSjOTU8tNiowgsdr cn7uJkZwItZy28E45e0HvUOMTByMhxglOJiVRHi9Q6NShHhTEiurUovy44tKc1KLDzGaAj08 kVlKNDkfmAvySuINTSwNTMzMDM2NTA3MlcR5pW1PJgsJpCeWpGanphakFsH0MXFwSjUwLbn9 TMn0xfKSuiclt3PurdEomXYyo/zjhKtNqQ8/+885c/6zaPZnLTkjz47NKb7uN5uzbpRWzzzl YHo+2W2nEeO0Ka2G113+Vu6cfEvei+Xn38/n26T+LFOO27l1t8rmiN6FInF7588KqzVtk/t8 R7vziVWMbcdS+zJRp68XuBZb3PGa03x1Yxn/UQf52exbNsXI+9U8vX7oYnyjoY9o2yvFWu9P G+zvT6nfHdRmpHmi9Z/oo8X2d9dVem3eOnkR/6ucG/X9AnO4nCQFVtW1hDa9DO4LFnz7699p q8qpis6aizc4rIiQXp962n33juJajdl3436Luv4yfLTXYWEck9H/DP+GaTPLctv4fRaaK7EU ZyQaajEXFScCAG/Gcr1NBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-Spam-Status: No, score=-4.4 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?1765497360838035890?= X-GMAIL-MSGID: =?utf-8?q?1765497360838035890?= 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) {