Message ID | 20230731125459epcms2p177a5cc5caa7ef0a9de35689e96558f43@epcms2p1 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2013116vqg; Mon, 31 Jul 2023 06:25:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGb2o/emdNu0H0UmQs6rPlktbDmEIYGYCY1e3ieJLlU87VVixrIFwmWRV/n3l7jaIRiUxmv X-Received: by 2002:a05:6a00:1822:b0:687:189c:4e26 with SMTP id y34-20020a056a00182200b00687189c4e26mr9624349pfa.2.1690809913221; Mon, 31 Jul 2023 06:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690809913; cv=none; d=google.com; s=arc-20160816; b=lYr6vkvCiSJeXSQC1SZw1QW7mGyJaMtb0Xdp4aSV6kpvRU8ggzsAuIugW4u8g/pRfX I7RtsQwDQTlG+sbQHapp4hKliO9Z9xhPu7SR2IxTcVI2DhC0G9nkEQPE1sdriwAeQ0HR 76fw4ipgcNcRQU2MRM3Q3ZX1qBnQSZXUonBrcwefyJq40exxRcOCgakpnwBkqck7EIvb zv0FX/8pN7pI9lEL41yw2GWZMJ/n0RZ94jDP8a9eDWDVb3xpkuVxd1vP5Sq9+81lG7lY kTZd6mHT53UmVYcQK4AIPWASeIpKgFfQhACcRQS0JkDCrH+fVB+PxoHgghiY5/uRAeK5 gmRg== 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=eu93vIczw2e7uVoLZPyx1ldXyXlxA+VenRHpGew8cYQ=; fh=uBbyI6SbCMOsjvChbSySV6O3eRPD6uLlYeSceMR+iCY=; b=rPBy6MMmipU7XQnxvn2t8IrQWoAz6R2P8T0gqH6EUMqNo+8yzSsHJMTi7VAazcpclR eL5qppOCvWkVAgMfEzfxh5V9/fcfRp1WmAwZ4Do/iFCzGtRrBj3jZfyn4w4OTOYFtaHO y4qzsRLLjQvJ/sxh5L38/fBENEv59jK5hg+/c8fag56iQ3UDf1X1ubhQlqIzhJjhiyMK o+9BK6F/O8x0j+RjtaE5hQWwtWdQlZVCIoCqSVmf1wjVhoj2/TFlV5SxtZFpDWBTT6/u +nB/0K5YEarWup9tDpNtRsm/CUnL0quBKpW6etmT15xtBmf5C4rljmHw3SMzkWuRXlDE z2vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WMSYarM8; 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 p190-20020a6342c7000000b0055aeedd94c1si5753476pga.289.2023.07.31.06.25.00; Mon, 31 Jul 2023 06:25: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=WMSYarM8; 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 S231532AbjGaMzF (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Mon, 31 Jul 2023 08:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbjGaMzE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Jul 2023 08:55:04 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5CB0103 for <linux-kernel@vger.kernel.org>; Mon, 31 Jul 2023 05:55:02 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230731125501epoutp037a356058fb568521b7ece4e8c754903f~29QKJwjpZ0659606596epoutp03Q for <linux-kernel@vger.kernel.org>; Mon, 31 Jul 2023 12:55:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230731125501epoutp037a356058fb568521b7ece4e8c754903f~29QKJwjpZ0659606596epoutp03Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690808101; bh=eu93vIczw2e7uVoLZPyx1ldXyXlxA+VenRHpGew8cYQ=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=WMSYarM8NRIIIYT0bwJlrKKmTR824Y7jkYcZ3mqIUiuCjTHSWxHTZ5s4TBCzDv2fz I+034GqRx4tHrdKbrXSkKhLEsgNUFsxIEJB8ruEv2zgS+cGEl04C8Dm+eATAl+WlGa nIT3z7FDlloV+W8AaBLf2srmR8Q0+cswYYmXe5O8= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230731125500epcas2p1498de3fa02baa044d925f0fca88a4219~29QJsh3jz2209822098epcas2p1R; Mon, 31 Jul 2023 12:55:00 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.88]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RDyrN2SDCz4x9Q0; Mon, 31 Jul 2023 12:55:00 +0000 (GMT) X-AuditID: b6c32a43-557fb7000001d7ef-b9-64c7af24bcb8 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id A0.A1.55279.42FA7C46; Mon, 31 Jul 2023 21:55:00 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 3/4] bio-integrity: cleanup adding integrity pages to bip's bvec Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi <j-young.choi@samsung.com> From: Jinyoung Choi <j-young.choi@samsung.com> To: "axboe@kernel.dk" <axboe@kernel.dk>, "kbusch@kernel.org" <kbusch@kernel.org>, "chaitanya.kulkarni@wdc.com" <chaitanya.kulkarni@wdc.com>, "sagi@grimberg.me" <sagi@grimberg.me>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "martin.petersen@oracle.com" <martin.petersen@oracle.com> X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> 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: <20230731125459epcms2p177a5cc5caa7ef0a9de35689e96558f43@epcms2p1> Date: Mon, 31 Jul 2023 21:54:59 +0900 X-CMS-MailID: 20230731125459epcms2p177a5cc5caa7ef0a9de35689e96558f43 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphk+LIzCtJLcpLzFFi42LZdljTXFdl/fEUg3/f+CxW3+1ns5h1+zWL xctDmhaTDl1jtNh7S9vi8q45bBbLj/9jslj3+j2LA4fH+XsbWTwuny312LSqk83j49NbLB59 W1YxenzeJOfRfqCbKYA9KtsmIzUxJbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE3 1VbJxSdA1y0zB+gkJYWy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p55b4d1a163b5ee6f15d96bf07817e12a5 References: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> <CGME20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p1> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772942695641525850 X-GMAIL-MSGID: 1772942695641525850 |
Series |
multi-page bvec configuration for integrity payload
|
|
Commit Message
Jinyoung Choi
July 31, 2023, 12:54 p.m. UTC
The bio_integrity_add_page() returns the set length if the execution result is successful. Otherwise, return 0. Unnecessary if statement was removed. And when the result value was less than the set value, it was changed to failed. Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com> --- block/bio-integrity.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
Comments
On Mon, Jul 31, 2023 at 09:54:59PM +0900, Jinyoung Choi wrote: > The bio_integrity_add_page() returns the set length if the execution > result is successful. Otherwise, return 0. > > Unnecessary if statement was removed. And when the result value was less > than the set value, it was changed to failed. Maybe word this as 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. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
> On Mon, Jul 31, 2023 at 09:54:59PM +0900, Jinyoung Choi wrote: > > The bio_integrity_add_page() returns the set length if the execution > > result is successful. Otherwise, return 0. > > > > Unnecessary if statement was removed. And when the result value was less > > than the set value, it was changed to failed. > > Maybe word this as > > 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. > > Otherwise looks good: > > Reviewed-by: Christoph Hellwig <hch@lst.de> Hi, Christoph. Thank you for your review. I will update comment soon! Best Regards, Jinyoung.
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);