From patchwork Thu Aug 3 02:48:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 130322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp948452vqx; Wed, 2 Aug 2023 23:34:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzmHtN3TZI3a3FtZHeeu3lSxY+0DXy/W38TRF+Mb796b93VLpPrtkdbaLpW5zeSPuVGPZq X-Received: by 2002:a05:6808:1926:b0:3a7:16f3:a46e with SMTP id bf38-20020a056808192600b003a716f3a46emr14288731oib.2.1691044453215; Wed, 02 Aug 2023 23:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691044453; cv=none; d=google.com; s=arc-20160816; b=WRorJ0MhUFiAfEU6WGjESAbnh0WH3SU7JFX4CIin+JVa2Cjffsze9py7agIhh6GpSR nK/PTwtlIbrMZw+x7aY7D1+brLUOeO7HDUllmTxQ3hd9q+xd2PHbUP3SazjSmmle9hdw MPbM/fO1f/HksG7ymdUTm0QZqHUVXHIRJ1fNGzhPvlYt4ZvpBItkYdtP6Qj4wk5+iDl/ hryt69UBr5awNXh3qIKQTPnJpJIRYTlawW6nhdwGOBRHM0mq+yamCe1AljeRcfN9Zf83 CnuVHqnmaJt0U4jvNqtZTzT6VL/emkFegxnfAMffQtvhWwDJAeJhPFeEvTqabggqE//8 dfOA== 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=CwBsuvROgaXCJ8AMDL4SdXVgyJ0v6aiqhJAaPpU3dPk=; fh=2nA8Bd9fZC8KEvdXhb0F45QLjkZMf4/KYP3/wuqyZa0=; b=C++kX47ozzrBudtZfy6JCJbLqr2hwhhDOLf0SDNiAZoM6Q7QXa1TI8PmfjHa0SDsyH dTShPmv0seKbj+P627LQMTY97nZ02gMQnWBxkN7Xi5Nf/zEQIi+v9cP5HtUu55D2h7oi Lf+LtLV/aeq9h+X9ZJrb2hOxC6KO792j4xYJ2DMmWPnWFEcpaEUBU2PM7m61uWe4COzc lLR4CKd+3H2n/Qtf4Lx8+5KUxvmLSBYs8SKRe6l0vgg6X/zIRuMvvK6yWhkfR8HpkLpY njyxymOB+SlfnXyHT28wEEoB92QS9/4JLllcEB2R27ib1en0Gv3c1PPkQAfuvezi1EgR 9Oag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=G7CQKH3g; 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 h24-20020a63f918000000b0055fc77ed00bsi12001826pgi.579.2023.08.02.23.33.59; Wed, 02 Aug 2023 23:34:13 -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=G7CQKH3g; 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 S233682AbjHCCsg (ORCPT + 99 others); Wed, 2 Aug 2023 22:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232170AbjHCCsd (ORCPT ); Wed, 2 Aug 2023 22:48:33 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17A81AA for ; Wed, 2 Aug 2023 19:48:31 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230803024829epoutp0475e0e32981c097cfd23a0856b8ab0e45~3v6cwSvZE1686416864epoutp04R for ; Thu, 3 Aug 2023 02:48:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230803024829epoutp0475e0e32981c097cfd23a0856b8ab0e45~3v6cwSvZE1686416864epoutp04R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691030909; bh=CwBsuvROgaXCJ8AMDL4SdXVgyJ0v6aiqhJAaPpU3dPk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=G7CQKH3gIpIIWY7zdwYmI1MuoQOnskpH802WAnQjJsZK1J4fOJ30Y5vhe9p5T8bTm E1+xrwTZUH2BtKsG222bBjbEuivyO7I7MSDII5dgAP+qVr3/8VUu5WiW1zdCKTZGMg ggxKvriatT+jiwVutJ3GnUu95AnLCXRA5kxK4oxo= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230803024829epcas2p34e6b1542e6e1e5849517c7ca28ab2287~3v6cOK3eI2760627606epcas2p36; Thu, 3 Aug 2023 02:48:29 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.97]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4RGYF85ZKbz4x9Pv; Thu, 3 Aug 2023 02:48:28 +0000 (GMT) X-AuditID: b6c32a43-84dfa7000000c342-61-64cb157c45d9 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 9D.23.49986.C751BC46; Thu, 3 Aug 2023 11:48:28 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 1/4] block: make bvec_try_merge_hw_page() non-static Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: Christoph Hellwig , "axboe@kernel.dk" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "sagi@grimberg.me" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "martin.petersen@oracle.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230803024827epcms2p838d9e9131492c86a159fff25d195658f@epcms2p8> Date: Thu, 03 Aug 2023 11:48:27 +0900 X-CMS-MailID: 20230803024827epcms2p838d9e9131492c86a159fff25d195658f X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOJsWRmVeSWpSXmKPExsWy7bCmqW6N6OkUgx9vtCxW3+1ns5h1+zWL xctDmhanJyxisph06Bqjxd5b2haXd81hs1h+/B+TxbrX71kcOD3O39vI4rF5hZbH5bOlHptW dbJ5fHx6i8Wjb8sqRo/Pm+Q82g90MwVwRGXbZKQmpqQWKaTmJeenZOal2yp5B8c7x5uaGRjq GlpamCsp5CXmptoqufgE6Lpl5gDdpqRQlphTChQKSCwuVtK3synKLy1JVcjILy6xVUotSMkp MC/QK07MLS7NS9fLSy2xMjQwMDIFKkzIzti0w7ugh6di+5uz7A2M3VxdjJwcEgImEvMez2MD sYUEdjBKbD9a1MXIwcErICjxd4cwSFhYwF1iR/MCqBIliXNrZjFCxA0kWm63sYDYbAJ6Ejue 72bvYuTiEBGYwyxxac0yVoj5vBIz2p+yQNjSEtuXbwVr5hTwk7g0bTZUXEPix7JeZghbVOLm 6rfsMPb7Y/MZIWwRidZ7Z6FqBCUe/NwNFZeUOHToKxvIzRIC+RIbDgRChGsk2n69hyrXl7jW sRFsFa+Ar8SyWSuZQGwWAVWJdZ/vQp3pIrHn/n0wm1lAXmL72znMICOZBTQl1u/Sh5iuLHHk FgtEBZ9Ex+G/7DAPNmz8jZW9Y94TJohWNYlFTUYQYRmJr4fns09gVJqFCOZZSNbOQli7gJF5 FaNYakFxbnpqslGBITxek/NzNzGCU6iW8w7GK/P/6R1iZOJgPMQowcGsJMIr/ft4ihBvSmJl VWpRfnxRaU5q8SFGU6CHJzJLiSbnA5N4Xkm8oYmlgYmZmaG5kamBuZI4773WuSlCAumJJanZ qakFqUUwfUwcnFINTL17riy0TXn2LbBtx4NvX4O+LTz9OF72wJ30qTnLq2xyzAz4d+guKnN6 6NiqcPel/8rQPIWd6tdc3m22XN6utjFlRubJ2h1xss0OqyKqH/2Xr4wMKZJf3pxuyao5+1zp t9yD6nfOx67/ZlZ3q1WGsSHWnOfa9f38d2+GuvWsOjP7bVxJe3VGziH9ki3V5nMNbLZflvaz XSnHty9tuuyVNmdhyfTVdVkrDJr3trevqLbW/13ye2/cxtvNAskdM3u5tefz+VySTPrL4HLy fcTJb63F9+s+TfksdqOMx9ZVZvuu+yVVN7hXfl9e1s0w/VmiYqNp+/uolniFotLFtX5fmxUC uGwPH2pZuaysO0hOiaU4I9FQi7moOBEA51Mc+yoEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 References: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> 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 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: INBOX X-GMAIL-THRID: 1773188628679305939 X-GMAIL-MSGID: 1773188628679305939 This will be used for multi-page configuration for integrity payload. Cc: Christoph Hellwig Cc: Martin K. Petersen Reviewed-by: Christoph Hellwig Signed-off-by: Jinyoung Choi --- block/bio.c | 2 +- block/blk.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index c92dda962449..8d1533af7c60 100644 --- a/block/bio.c +++ b/block/bio.c @@ -934,7 +934,7 @@ static bool bvec_try_merge_page(struct bio_vec *bv, 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 bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, +bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, struct page *page, unsigned len, unsigned offset, bool *same_page) { diff --git a/block/blk.h b/block/blk.h index 686712e13835..9d22ec3a53bc 100644 --- a/block/blk.h +++ b/block/blk.h @@ -75,6 +75,10 @@ struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs, gfp_t gfp_mask); void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs); +bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, + struct page *page, unsigned len, unsigned offset, + bool *same_page); + static inline bool biovec_phys_mergeable(struct request_queue *q, struct bio_vec *vec1, struct bio_vec *vec2) { From patchwork Thu Aug 3 02:49:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 130300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp895995vqx; Wed, 2 Aug 2023 21:06:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHLFKl6yt39YTou0rF1HclBgjR4dX/c2GyWRnLSDsCvvmQs15OMX+sckh0FGtMSVGVU3uK X-Received: by 2002:a17:90a:e42:b0:268:4dd4:a991 with SMTP id p2-20020a17090a0e4200b002684dd4a991mr13352565pja.1.1691035575517; Wed, 02 Aug 2023 21:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691035575; cv=none; d=google.com; s=arc-20160816; b=PMp+OInudIBcoF4cUK208UI4R83dp2s8eYzSsjZwx/nLfVbvzXJKG1VzHoaUDmPzn9 OhcGDlM936zQSbUXzT0GBpT0bgs4ux3x4+SSCkiMXZyHeY8+mcAIYSC6aT/aiHUKM9Ha nhFSdJipnnics60GOjYkfarq2ykuDrA7N5ZJJWrNr4AD+TPImfY9vw8ggmQ6RQvbANY7 Y9zMhFUJetpo0oqd5ly+VeSvZ87EyzrBjweFfhaFd1blZCkDeCVPPe/pB8BM8qBx/pUS 7iEP+xr3iqsowNcjlPsOGQMuzpEih15dvj6ie42hTn3+n0p0/u9VR23XcHRtw0J5syD8 e+Nw== 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=lONrHNsEkCBmY0gtyPzxjck/4+ABThiyZREGBOSdSJI=; fh=2nA8Bd9fZC8KEvdXhb0F45QLjkZMf4/KYP3/wuqyZa0=; b=qo3BGvFvwk/KWAl0pzZQk6pMswCM5bIrIlardWSff9A1CjbqMcs3DM4ZK7s3glYtH2 sGSIRSutWMWI02SpoSojzhxyovdu8SxFGgWmSj+lBljR6nfY8w3hoVLYH3WKPZDRk03e NY/sJIsr/JPoTUJVusdf3zRgUQ2GMhSVmy1MhMey5KQQv+IWdO3ziOmtYfF3SdHG8t9u HTw5q86m+punS9IlhPrYdsmFqpUAImEvHupKcFCGX0vFmBqg89JYA0HLxjBHrgvW8JdB 6lOqLh8SBEtrIhaN3hUueEr8WBOWtZCj072Merwi6R2ympD+C0VrI6xAu+IjyG406jX2 Bo5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="V+eK/hB4"; 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 w18-20020a17090a8a1200b00267ba1c43adsi2240739pjn.101.2023.08.02.21.06.00; Wed, 02 Aug 2023 21:06:15 -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="V+eK/hB4"; 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 S232435AbjHCCuL (ORCPT + 99 others); Wed, 2 Aug 2023 22:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbjHCCuE (ORCPT ); Wed, 2 Aug 2023 22:50:04 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262E0E53 for ; Wed, 2 Aug 2023 19:50:00 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230803024958epoutp01e4c80c46a922b2f3e9a76f1dae53e0a9~3v7vQiZZM2949529495epoutp01T for ; Thu, 3 Aug 2023 02:49:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230803024958epoutp01e4c80c46a922b2f3e9a76f1dae53e0a9~3v7vQiZZM2949529495epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691030998; bh=lONrHNsEkCBmY0gtyPzxjck/4+ABThiyZREGBOSdSJI=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=V+eK/hB4X46Gop1awZNZec0RgAqITRz+SZs6DQildHdoA0sSwHyvmhOuAaMeEGYk0 YIe46OyoK7RdHYEcL9IVFXrjAYTPgtaQwFueDy8agdChIjdY4sz+zUcoO3OIchIX1W h9m3k/g+bzumNw77oNOKLgRFa3FbDatOV5vFoIAc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230803024957epcas2p31983d25d59b29e60b32e8101169c09af~3v7usJOwG2133421334epcas2p3I; Thu, 3 Aug 2023 02:49:57 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.102]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RGYGs2487z4x9Pt; Thu, 3 Aug 2023 02:49:57 +0000 (GMT) X-AuditID: b6c32a45-83dfd7000000c2f9-9c-64cb15d5f7f2 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id F0.AA.49913.5D51BC46; Thu, 3 Aug 2023 11:49:57 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 2/4] bio-integrity: update the payload size in bio_integrity_add_page() Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: Christoph Hellwig , "axboe@kernel.dk" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "sagi@grimberg.me" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "martin.petersen@oracle.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230803024827epcms2p838d9e9131492c86a159fff25d195658f@epcms2p8> 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: <20230803024956epcms2p38186a17392706650c582d38ef3dbcd32@epcms2p3> Date: Thu, 03 Aug 2023 11:49:56 +0900 X-CMS-MailID: 20230803024956epcms2p38186a17392706650c582d38ef3dbcd32 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBJsWRmVeSWpSXmKPExsWy7bCmue5V0dMpBt/f8FisvtvPZjHr9msW i5eHNC1OT1jEZDHp0DVGi723tC0u75rDZrH8+D8mi3Wv37M4cHqcv7eRxWPzCi2Py2dLPTat 6mTz+Pj0FotH35ZVjB6fN8l5tB/oZgrgiMq2yUhNTEktUkjNS85PycxLt1XyDo53jjc1MzDU NbS0MFdSyEvMTbVVcvEJ0HXLzAG6TUmhLDGnFCgUkFhcrKRvZ1OUX1qSqpCRX1xiq5RakJJT YF6gV5yYW1yal66Xl1piZWhgYGQKVJiQnbFy+1H2gosKFTuW7WRrYNwg3cXIySEhYCIxc+Zv 1i5GLg4hgR2MEq3L9rB1MXJw8AoISvzdIQxiCgvESHzdygJSLiSgJHFuzSxGEFtYwECi5XYb WJxNQE9ix/Pd7CBjRATmMEtcWrOMFWI+r8SM9qcsELa0xPblW8GaOQX8JKZMbGSEiGtI/FjW ywxhi0rcXP2WHcZ+f2w+VI2IROu9s1A1ghIPfu6GiktKHDr0FexkCYF8iQ0HAiHCNRJtv95D letLXOvYCHYCr4CvxK+vb8FaWQRUJZou74U6zUViatt8sJOZBeQltr+dwwwykllAU2L9Ln2I 6coSR26xQFTwSXQc/ssO82DDxt9Y2TvmPWGCaFWTWNRkBBGWkfh6eD77BEalWYhQnoVk7SyE tQsYmVcxiqUWFOempxYbFRjCIzY5P3cTIziJarnuYJz89oPeIUYmDsZDjBIczEoivNK/j6cI 8aYkVlalFuXHF5XmpBYfYjQFengis5Rocj4wjeeVxBuaWBqYmJkZmhuZGpgrifPea52bIiSQ nliSmp2aWpBaBNPHxMEp1cAUKZGU0zQlJtr3cJqo4GUx/W8Z+4T2bVzC8uvAPIeaf6IL13VI z5uZlDJFln86i+Dph31xe3/ltpXuuS6/bnfYU7+f76ecKPT8J/879a72Dt33mRrhHsx79l3L ucZXO+u5AzuLLOfDVs6ix/ZJEfLsIld6hCYKHLY9Htexe/99B/YrizpXePq6L/EQlly25d2c i5m7zx8L1Wj6evE149MH04XWvHSRd85OdFjsq1otVTHxjbZxcHXOgamC93qXbF3ZM2f3RyVm f8GUh3u/RH36mdM1q23W9Mlcew5/eC0mNeWva3rZW0lzfb8//qvuxjGwzd565Edn4uTHFpvb rp78fmvj0QcN/zh0XlbEfDi4RYmlOCPRUIu5qDgRACILMk4rBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 References: <20230803024827epcms2p838d9e9131492c86a159fff25d195658f@epcms2p8> <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> 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 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: INBOX X-GMAIL-THRID: 1773179319556406828 X-GMAIL-MSGID: 1773179319556406828 Previously, the bip's bi_size has been set before an integrity pages were added. If a problem occurs in the process of adding pages for bip, the bi_size mismatch problem must be dealt with. When the page is successfully added to bvec, the bi_size is updated. The parts affected by the change were also contained in this commit. Cc: Christoph Hellwig Cc: Martin K. Petersen Reviewed-by: Christoph Hellwig Signed-off-by: Jinyoung Choi --- block/bio-integrity.c | 2 +- drivers/md/dm-crypt.c | 1 - drivers/nvme/host/ioctl.c | 1 - drivers/nvme/target/io-cmd-bdev.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 045553a164e0..6220a99977a4 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -137,6 +137,7 @@ int bio_integrity_add_page(struct bio *bio, struct page *page, bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset); bip->bip_vcnt++; + bip->bip_iter.bi_size += len; return len; } @@ -244,7 +245,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) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1dc6227d353e..f2662c21a6df 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1160,7 +1160,6 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio) tag_len = io->cc->on_disk_tag_size * (bio_sectors(bio) >> io->cc->sector_shift); - bip->bip_iter.bi_size = tag_len; bip->bip_iter.bi_sector = io->cc->start + io->sector; ret = bio_integrity_add_page(bio, virt_to_page(io->integrity_metadata), diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 5c3250f36ce7..19a5177bc360 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -118,7 +118,6 @@ static void *nvme_add_user_metadata(struct request *req, void __user *ubuf, goto out_free_meta; } - bip->bip_iter.bi_size = len; bip->bip_iter.bi_sector = seed; ret = bio_integrity_add_page(bio, virt_to_page(buf), len, offset_in_page(buf)); diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c index 2733e0158585..468833675cc9 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -206,12 +206,11 @@ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio, return PTR_ERR(bip); } - bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio)); /* virtual start sector must be in integrity interval units */ bip_set_seed(bip, bio->bi_iter.bi_sector >> (bi->interval_exp - SECTOR_SHIFT)); - resid = bip->bip_iter.bi_size; + resid = bio_integrity_bytes(bi, bio_sectors(bio)); while (resid > 0 && sg_miter_next(miter)) { len = min_t(size_t, miter->length, resid); rc = bio_integrity_add_page(bio, miter->page, len, diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 3d1b511ea284..a7050f63b7cc 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -689,7 +689,6 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, return PTR_ERR(bip); } - bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio)); /* virtual start sector must be in integrity interval units */ bip_set_seed(bip, bio->bi_iter.bi_sector >> (bi->interval_exp - SECTOR_SHIFT)); @@ -697,7 +696,7 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size, (unsigned long long)bip->bip_iter.bi_sector); - resid = bip->bip_iter.bi_size; + resid = bio_integrity_bytes(bi, bio_sectors(bio)); while (resid > 0 && sg_miter_next(miter)) { len = min_t(size_t, miter->length, resid); From patchwork Thu Aug 3 02:50:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 130293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp883959vqx; Wed, 2 Aug 2023 20:28:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlGuHg+S5yRdV96J+suTRJn9Ub6ipfdnUeS1A++rYdWZynNmxNkvtDb0/SZ6KqTwVcIKhL1G X-Received: by 2002:a05:6a00:1951:b0:668:834d:4bd with SMTP id s17-20020a056a00195100b00668834d04bdmr15631217pfk.0.1691033329037; Wed, 02 Aug 2023 20:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691033329; cv=none; d=google.com; s=arc-20160816; b=q3EroemschngmQuC32CWfcqeTyzKkZj91nrVN5i9pxSlb9Si1oEwzhjWdTXwlZYPGD yX5GtlBmCrI+rpTQDwkMFloOFYMmMOEYDxB21mevLjiiCMjHQyR7Y4T6o0VFIJjpzt5U ABhM0fGNV2+TKLqopQBLHwe2zINdf3B2c8qbkYBfjbtvWARpGv0Qa2VPrZfgS5rhf4gc FFrDTYmrkp6tdn/LScelS/KmoqsGStUVW7vrYhU5qN5x2EVIh609u/YJDBRZmt4bRIU8 Kgv8R3l3fc3I5jAS+cDDSJ+rQ5B7CcLmWd2chldWIbMH7Pb5N9VcXzvNmUalEsdQXt9k CmhQ== 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=GgZEpQKj5vGYyF34El8cqciXDkasij1/6nECeUJEU8w=; fh=2nA8Bd9fZC8KEvdXhb0F45QLjkZMf4/KYP3/wuqyZa0=; b=djfzprsNzjjhreZfKCeFEOxLN4qiQtPnewHAb8whTUyGfCIGaRCEPg3HDmB+igZDUm h3qFW4HmdZIkhFo5TGWo2V1xAhdGXYSX77LS1A7X2mQHoQV83DTMZ6uXVXBV0k2bWqnN RuDQAZ+0I/BQk8xKB30CRSRkweZNT5ChsTXU/dYQMqmirvDdGXSimERTPbvQmR10ucDH 5mzhNyk7sZpH4BsOyR/vN4yXnXcFWSFP1+Y6jjjje8LWJHyN7v3Q/lacI4GW66a2MRpX uHkf6M434MpezPWCF9t5rW/Ov90G4ah/42rx7x3CL0A7UFmc6E55WBaDytbT3r2E7upG WCpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lG6g6KM0; 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 h69-20020a638348000000b00563e6d70f7esi11722659pge.443.2023.08.02.20.28.35; Wed, 02 Aug 2023 20:28:49 -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=lG6g6KM0; 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 S231484AbjHCCvH (ORCPT + 99 others); Wed, 2 Aug 2023 22:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231354AbjHCCvE (ORCPT ); Wed, 2 Aug 2023 22:51:04 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC5C103 for ; Wed, 2 Aug 2023 19:51:03 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230803025101epoutp01595a198f93395b673df99144dd11255d~3v8qWqkAA3015830158epoutp01d for ; Thu, 3 Aug 2023 02:51:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230803025101epoutp01595a198f93395b673df99144dd11255d~3v8qWqkAA3015830158epoutp01d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691031061; bh=GgZEpQKj5vGYyF34El8cqciXDkasij1/6nECeUJEU8w=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=lG6g6KM0H5iTchjUnUVs4vAwUs7AdYdVHA6MXcQIoLxuL0M0ohLrDzbfWaQDPDG24 kcWdRIcNUD6+QPWMP1vdobBe6DeqFLhQpZcuiANsjJoJOAIFZ07RnXI/rzR6+g+tfB EvGFEcJzUsepMh0i280gVPDV8qUUTm91ugpl7kvs= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230803025100epcas2p19ca34ccc42f2fccb928a183efe4589de~3v8opgKQX1952119521epcas2p1D; Thu, 3 Aug 2023 02:51:00 +0000 (GMT) Received: from epsmgec2p1-new.samsung.com (unknown [182.195.36.91]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4RGYJ33WbNz4x9Ps; Thu, 3 Aug 2023 02:50:59 +0000 (GMT) X-AuditID: b6c32a4d-637c170000047356-e5-64cb1613582c Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmgec2p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id E4.EA.29526.3161BC46; Thu, 3 Aug 2023 11:50:59 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 3/4] bio-integrity: cleanup adding integrity pages to bip's bvec. Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: Christoph Hellwig , "axboe@kernel.dk" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "sagi@grimberg.me" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "martin.petersen@oracle.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230803025058epcms2p5a4d0db5da2ad967668932d463661c633@epcms2p5> Date: Thu, 03 Aug 2023 11:50:58 +0900 X-CMS-MailID: 20230803025058epcms2p5a4d0db5da2ad967668932d463661c633 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJsWRmVeSWpSXmKPExsWy7bCmha6w2OkUg/dPxS1W3+1ns5h1+zWL xctDmhanJyxisph06Bqjxd5b2haXd81hs1h+/B+TxbrX71kcOD3O39vI4rF5hZbH5bOlHptW dbJ5fHx6i8Wjb8sqRo/Pm+Q82g90MwVwRGXbZKQmpqQWKaTmJeenZOal2yp5B8c7x5uaGRjq GlpamCsp5CXmptoqufgE6Lpl5gDdpqRQlphTChQKSCwuVtK3synKLy1JVcjILy6xVUotSMkp MC/QK07MLS7NS9fLSy2xMjQwMDIFKkzIzpi0/w1TwSKeiqmzjzI3MB7m7GLk5JAQMJHYvGsK O4gtJLCHUeLfX7MuRg4OXgFBib87hEHCwgJhEov//2GGKFGSOLdmFiNE3ECi5XYbC4jNJqAn seP5bqAxXBwiAnOYJS6tWcYKMZ9XYkb7UxYIW1pi+/KtYM2cAn4Sl6bNhoprSPxY1ssMYYtK 3Fz9lh3Gfn9sPiOELSLReu8sVI2gxIOfu6HikhKHDn1lA7lZQiBfYsOBQIhwjUTbr/dQ5foS 1zo2gq3iFfCVmLZ7OxuIzSKgKrFw5kQWiFYXiaer80HCzALyEtvfzmEGCTMLaEqs36UPUaEs ceQWC0QFn0TH4b/sMP81bPyNlb1j3hMmiFY1iUVNRhBhGYmvh+ezT2BUmoUI5VlI1s5CWLuA kXkVo1RqQXFuemqyUYGhbl5qOTxuk/NzNzGCU6mW7w7G1+v/6h1iZOJgPMQowcGsJMIr/ft4 ihBvSmJlVWpRfnxRaU5q8SFGU6CfJzJLiSbnA5N5Xkm8oYmlgYmZmaG5kamBuZI4773WuSlC AumJJanZqakFqUUwfUwcnFINTDrXX2/ZyO3zTGPD+8Ygaa5gp+5TyrIzf0t8mNduffp8gcjf 6UFium1za/w1Hl7Iedz4d8M21sIG02tP7nls7b1141jFS5mp788fZhDYt45VqT3s155HjEb9 5/kWSvovNRFZdCHk4+apwT/CXjJZmcRM3VlvWReRvpiHa7ZvjrNviGOBc73HSzXNph7fnqcd dUa7GjRM76/Zt/ZVtM8J7vtP/IUOfNKNnLQihS+E5/G8vSuWXWLYcGeqYHeY4hnhfQya5pMa Nmz4vmHaHc/LQo0uSxlebFv0X8J53b75HJ56blqWgSyVke+Fd5yzeD6Jt+Y/n5DUj/Cny454 8YTxKPqeun/XTe5evFjzbCZXCyWW4oxEQy3mouJEAD1waQUuBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 References: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> 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 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: INBOX X-GMAIL-THRID: 1773176964075702383 X-GMAIL-MSGID: 1773176964075702383 bio_integrity_add_page() returns the add length if successful, else 0, just as bio_add_page. Simply check return value checking in bio_integrity_prep to not deal with a > 0 but < len case that can't happen. Cc: Christoph Hellwig Cc: Martin K. Petersen Reviewed-by: Christoph Hellwig Signed-off-by: Jinyoung Choi --- block/bio-integrity.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 6220a99977a4..c6b3bc86e1f9 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -252,27 +252,18 @@ bool bio_integrity_prep(struct bio *bio) /* Map it */ offset = offset_in_page(buf); - for (i = 0 ; i < nr_pages ; i++) { - int ret; + for (i = 0; i < nr_pages && len > 0; i++) { bytes = PAGE_SIZE - offset; - if (len <= 0) - break; - 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"); goto err_end_io; } - if (ret < bytes) - break; - buf += bytes; len -= bytes; offset = 0; @@ -291,7 +282,6 @@ bool bio_integrity_prep(struct bio *bio) bio->bi_status = BLK_STS_RESOURCE; bio_endio(bio); return false; - } EXPORT_SYMBOL(bio_integrity_prep); From patchwork Thu Aug 3 02:52:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 130291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp881096vqx; Wed, 2 Aug 2023 20:19:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFylx1xiWDz72ITlOYaLTIsoAa09DECEwb61wOBNIqoy2E/j0lrYAjrG6pPkJAaVsZ34/yj X-Received: by 2002:a05:6a00:1bc9:b0:677:3439:874a with SMTP id o9-20020a056a001bc900b006773439874amr15222803pfw.3.1691032755343; Wed, 02 Aug 2023 20:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691032755; cv=none; d=google.com; s=arc-20160816; b=OF+MerLjYSopPug5B401PZkYOdTtbaF/4ejznx+ScgmEOjQg1ZB8Kl/BvzvUGIGQ+A 7IAQ1Hr3rJdlW2+37BpflAUoN2S1RPThJJ24GwxKjd4Un6Jvt353lkAigK2ebPssM9g1 qd06YWJPq/FrpSm+2SiyhjaA4lVnf6/8NlLW+T2RQmfXxwHFO5AqbaKdjz286XUe9EfE 5m8mroyPO+05NP8+LatWkkIdZX57D11D4SnLhGdzuZjI+wG6LyRKMvtdxpVR3LlcXGOD kEe5w59FfGe2lw40L90uIa3J1jitKFfjFZGHEKEJmENmaZpAmQ4wwHz+57jnC4aJBW8m O4jg== 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=PoQdjC9lBed1xqyEfsVkXd2x90gYvZd/Stb7lCXTnc0=; fh=2nA8Bd9fZC8KEvdXhb0F45QLjkZMf4/KYP3/wuqyZa0=; b=DI9jNf7fP0fBQCMnigKUIltdGthRLXdR3XhNRxnE6vF8adDH1H+6oHM78XmBl2jjWR v9cgBVggZYG2n7FNiB7XkR8lAFkSrwD8LBX2HOEoKf1hbARrOPHfvJkBk9dDSjtWFydc DTkGe5zISa2LUbv/H3PNFjSlb2y3jpV5SoFOE7Oy1GtcX1CtAhiRS1oZ5GmbwHNxlUkR e0uVQr2ij1zqqYGVooesDh2JsREBtlmi4PhR9wDR9/OWf4o2mWqj75GCDp4IPQZQxuox 4GAS+Yx0dycgSy+Yro1Wenk4wcwClCDQkOigYKIvTI2EgaCnDUrBJWUQMKfOxQK/q5D6 p3Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TDbnLOJF; 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 24-20020a631258000000b0053fbe7c8d3dsi963072pgs.632.2023.08.02.20.19.01; Wed, 02 Aug 2023 20:19:15 -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=TDbnLOJF; 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 S231444AbjHCCwJ (ORCPT + 99 others); Wed, 2 Aug 2023 22:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjHCCwH (ORCPT ); Wed, 2 Aug 2023 22:52:07 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA36A1A7 for ; Wed, 2 Aug 2023 19:52:05 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230803025203epoutp036454ad267763f0338c540111bc32182c~3v9kEsLq43239032390epoutp035 for ; Thu, 3 Aug 2023 02:52:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230803025203epoutp036454ad267763f0338c540111bc32182c~3v9kEsLq43239032390epoutp035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691031123; bh=PoQdjC9lBed1xqyEfsVkXd2x90gYvZd/Stb7lCXTnc0=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=TDbnLOJFuQJogZjHquL6qwrCnLtTWOshSi29pJ52cz/Rw2yzAEw6/Wde1phkzo81P 8w+NenQZdPi3IVTcRsFbqfOFPQcMJmTv+hB3FZwKjmE0OwT4gwz+N5WwV5ekXh3fRr 7MYqNVGj2R33kdaBGlcql0lIiboZkfsphhFH5zDM= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230803025203epcas2p22fd826ad8ebfbc1bc720885cc81be973~3v9jtijML0956209562epcas2p2A; Thu, 3 Aug 2023 02:52:03 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.99]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RGYKG6b9sz4x9Py; Thu, 3 Aug 2023 02:52:02 +0000 (GMT) X-AuditID: b6c32a43-84dfa7000000c342-bd-64cb1652b575 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 2C.44.49986.2561BC46; Thu, 3 Aug 2023 11:52:02 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 4/4] bio-integrity: create multi-page bvecs in bio_integrity_add_page() Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: Christoph Hellwig , "axboe@kernel.dk" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "sagi@grimberg.me" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "martin.petersen@oracle.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230803025202epcms2p82f57cbfe32195da38c776377b55aed59@epcms2p8> Date: Thu, 03 Aug 2023 11:52:02 +0900 X-CMS-MailID: 20230803025202epcms2p82f57cbfe32195da38c776377b55aed59 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJJsWRmVeSWpSXmKPExsWy7bCmqW6Q2OkUg7dPDSxW3+1ns5h1+zWL xctDmhanJyxisph06Bqjxd5b2haXd81hs1h+/B+TxbrX71kcOD3O39vI4rF5hZbH5bOlHptW dbJ5fHx6i8Wjb8sqRo/Pm+Q82g90MwVwRGXbZKQmpqQWKaTmJeenZOal2yp5B8c7x5uaGRjq GlpamCsp5CXmptoqufgE6Lpl5gDdpqRQlphTChQKSCwuVtK3synKLy1JVcjILy6xVUotSMkp MC/QK07MLS7NS9fLSy2xMjQwMDIFKkzIzpjTsJyloEeoYs32lYwNjA/5uhg5OSQETCTu3G9m 7GLk4hAS2MEoseLTMiCHg4NXQFDi7w5hkBphgRiJSfuXsILYQgJKEufWzGKEiBtItNxuYwGx 2QT0JHY8380OMkdEYA6zxKU1y1ghFvBKzGh/ygJhS0tsX74VrJlTwE/i0rTZUHENiR/Lepkh bFGJm6vfssPY74/NZ4SwRSRa752FqhGUePBzN1RcUuLQoa9sIDdLCORLbDgQCBGukWj79R6q XF/iWsdGsFW8Ar4Sf5efArNZBFQlTm75BDXGReJVXwcbiM0sIC+x/e0cZpCRzAKaEut36UNM V5Y4cosFooJPouPwX3aYBxs2/sbK3jHvCRNEq5rEoiYjiLCMxNfD89knMCrNQgTzLCRrZyGs XcDIvIpRLLWgODc9NdmowBAes8n5uZsYwWlUy3kH45X5//QOMTJxMB5ilOBgVhLhlf59PEWI NyWxsiq1KD++qDQntfgQoynQwxOZpUST84GJPK8k3tDE0sDEzMzQ3MjUwFxJnPde69wUIYH0 xJLU7NTUgtQimD4mDk6pBiZv1tMrtFavaVJ3X6vF4+qnfH6JwcZvSdO2f4/79HzB9npGn6x/ m2zcVGoOtq+745XxcqfAhgj2BQ8fFCQnBMad0p46fep77umxt2WOn+h2nhjyZM6v1TXzkr1T 13xnKz0rbrYx4qmhTYVDJvuLpKYyVXmxiqOTNjKdtdd+yH4o1vfRvpwzfyKTr786lsl04puA 4CmFeVOFdza3rj67U1orWCvh4Z1OkSPsv857VSnI2va1q6qb/yw6vbz6S8Hr6xy/121xEpSU m5DN94XV6JtRP++nlkPVa9t/5sSzL/p2auvP6XXr/GwSr97f9SSt6LzcBp5jiUZRLpdvPnCY +e5y/OZnq5LPrJ21vLDGavkUJZbijERDLeai4kQA7+eTQCwEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 References: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> 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 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: INBOX X-GMAIL-THRID: 1773176362633225875 X-GMAIL-MSGID: 1773176362633225875 In general, the bvec data structure consists of one for physically continuous pages. But, in the bvec configuration for bip, physically continuous integrity pages are composed of each bvec. Allow bio_integrity_add_page() to create multi-page bvecs, just like the bio payloads. This simplifies adding larger payloads, and fixes support for non-tiny workloads with nvme, which stopped using scatterlist for metadata a while ago. Cc: Christoph Hellwig Cc: Martin K. Petersen Fixes: 783b94bd9250 ("nvme-pci: do not build a scatterlist to map metadata") Reviewed-by: Christoph Hellwig Signed-off-by: Jinyoung Choi --- block/bio-integrity.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index c6b3bc86e1f9..ec8ac8cf6e1b 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -123,17 +123,34 @@ void bio_integrity_free(struct bio *bio) 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) { - printk(KERN_ERR "%s: bip_vec full\n", __func__); + if (((bip->bip_iter.bi_size + len) >> SECTOR_SHIFT) > + queue_max_hw_sectors(q)) 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)) - return 0; + if (bip->bip_vcnt > 0) { + struct bio_vec *bv = &bip->bip_vec[bip->bip_vcnt - 1]; + bool same_page = false; + + if (bvec_try_merge_hw_page(q, bv, page, len, offset, + &same_page)) { + bip->bip_iter.bi_size += len; + return len; + } + + if (bip->bip_vcnt >= + min(bip->bip_max_vcnt, queue_max_integrity_segments(q))) + return 0; + + /* + * 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; + } bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset); bip->bip_vcnt++;