From patchwork Mon Jul 31 12:50:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 128671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2011220vqg; Mon, 31 Jul 2023 06:21:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyCK1GzVnVddKuZUAydxDj+I4Z5Y31jGEQiZx5Xs4aa7w7HsCdqy4Rf2/6eLyKrb8wwiyN X-Received: by 2002:a17:903:258b:b0:1bc:6c8:cde3 with SMTP id jb11-20020a170903258b00b001bc06c8cde3mr4408741plb.57.1690809707484; Mon, 31 Jul 2023 06:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690809707; cv=none; d=google.com; s=arc-20160816; b=xJmFtpab0S1nG82bCdbyiUN7pB87nAyULzeLaXxTH6SNE8XIcFsX54E4Oiz4lI3RZ2 84l4zipawJnzfnsY1ta32169i0pa1wjw7HhsXphkzxDqQkROndIWhPEEc9znGVRW/wSY mFGT25k1VJ1XaoCEj5xAmSoM6bk3rRMkjG7Afu0FEXKhNI56Axr+4YilczEhwOR4cMBr 4d6RCe1lJgqTPVaN/6Q3AX+z5/E/q+FfFwJeCvvdLoSmKQ//TEG0pOYezg5lk11gGBgK +VXFLCBss8nHvfewLL/feZ6HgnshyG5WeMJVD9TIALvU7cWFQbybJIiu7XFR6EaZclSX Lvzw== 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=uBbyI6SbCMOsjvChbSySV6O3eRPD6uLlYeSceMR+iCY=; b=OkNh3OSw2md9IZ+DiuGvb3rNnT2i2KG3qGJBDLP1YLiqLeHvyen7FXpYVsIZJfWBRC m/t5lDiSYHCkjqfAyAbqvWePz71WTuw1mU7XnhIYxfwIPZYG0s5OYeNobrgrCAI7CDRc 7CkEfjE+6mN0NOXg4gZNqJeKCQV8X+Knfuffaw+anbaJC6QTVkdYPmU85CzKtcW8YF7U i2eH4U4rsXsTNhcxBAIIngcrc44JtTYIduWOlIXTJ4QfFKUv/4L+PJpeZjnd0gZ3U+DY gTlj+J6hzwR3f3H7P6ZhocVSD+sSiaNA51g1Fsv8EXWrJ2GrIM85PrIbwHdPgRrwIxsy umsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=DE9H0E5J; 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 y22-20020a17090264d600b001bbd452d974si7275881pli.554.2023.07.31.06.21.34; Mon, 31 Jul 2023 06:21:47 -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=DE9H0E5J; 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 S231755AbjGaMuw (ORCPT + 99 others); Mon, 31 Jul 2023 08:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbjGaMuu (ORCPT ); Mon, 31 Jul 2023 08:50:50 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A3D2E46 for ; Mon, 31 Jul 2023 05:50:49 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230731125048epoutp04ec80a68c96dc8d93c1e4dae0864a0e1f~29MeQijLR0709407094epoutp04Z for ; Mon, 31 Jul 2023 12:50:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230731125048epoutp04ec80a68c96dc8d93c1e4dae0864a0e1f~29MeQijLR0709407094epoutp04Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690807848; bh=CwBsuvROgaXCJ8AMDL4SdXVgyJ0v6aiqhJAaPpU3dPk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=DE9H0E5JafS26+L9dYeozhjXTmc+zDkfi6KxCGUjyUNHwdEMPImXqs3XCyjuJJZIR BBbxpS2/ZPtp/vmSR1egMZadD+aFeZuT4iH4erqQPeyR3MxSBO/cI9a1WDdHpqGkjU tbAF9izOSRHDoMY2VAIGUG/b9qt9ku7ypmx7WTcs= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230731125047epcas2p4e284dd7dd3652377a31d4e502b253998~29MdXVHY03085630856epcas2p4U; Mon, 31 Jul 2023 12:50:47 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.68]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4RDylV4LjCz4x9Pq; Mon, 31 Jul 2023 12:50:46 +0000 (GMT) X-AuditID: b6c32a43-2f3ff7000001d7ef-1e-64c7ae26d430 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 37.11.55279.62EA7C46; Mon, 31 Jul 2023 21:50:46 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 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: "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: <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: <20230731125045epcms2p11a5566bc86fa448890c0af8fa14db307@epcms2p1> Date: Mon, 31 Jul 2023 21:50:45 +0900 X-CMS-MailID: 20230731125045epcms2p11a5566bc86fa448890c0af8fa14db307 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdljTXFdt3fEUg+e9ihar7/azWcy6/ZrF 4uUhTYtJh64xWuy9pW1xedccNovlx/8xWax7/Z7FgcPj/L2NLB6Xz5Z6bFrVyebx8ektFo++ LasYPT5vkvNoP9DNFMAelW2TkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pmYKhraGlhrqSQl5ib aqvk4hOg65aZA3SSkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKbUgJafAvECvODG3uDQv XS8vtcTK0MDAyBSoMCE7Y9MO74Ienortb86yNzB2c3UxcnJICJhIzJjxjrGLkYtDSGAHo8TE H/1sXYwcHLwCghJ/dwiD1AgLuEtMWPeRBcQWElCSOLdmFiNE3ECi5XYbWJxNQE9ix/Pd7CBz RAQ+M0lc/vGBFWIBr8SM9qcsELa0xPblW8GaOQX8JKZef8sEEdeQ+LGslxnCFpW4ufotO4z9 /th8RghbRKL13lmoGkGJBz93Q8UlJQ4d+gp2s4RAvsSGA4EQ4RqJtl/vocr1Ja51bAQ7gVfA F6jkFxNIOYuAqsSMyTkQJS4SH3efAbuYWUBeYvvbOcwgJcwCmhLrd+lDDFeWOHKLBaKCT6Lj 8F92mP8aNv7Gyt4x7wkTRKuaxKImI4iwjMTXw/PZJzAqzUKE8iwka2chrF3AyLyKUSy1oDg3 PTXZqMAQHq/J+bmbGMEJU8t5B+OV+f/0DjEycTAeYpTgYFYS4T0VcChFiDclsbIqtSg/vqg0 J7X4EKMp0L8TmaVEk/OBKTuvJN7QxNLAxMzM0NzI1MBcSZz3XuvcFCGB9MSS1OzU1ILUIpg+ Jg5OqQYmS3H9qCJvO9NJuy8KheperZfr731SbPJtBnNTmt+fs5frpaZPubC162G3T1v0TSnG vKurrLpKnjrw7K3jytLbMmnfPLWeSUenlWhMXixZOp3J4H7rE+b/gVcrMg2nNcwU/Wd9uFM8 88ZPkX1nTObsjJRinJ4x+5KNFOflWqHn0t9fzNzUmFq2/Zj1fI7oxZ+/hBfkVqZNczeMnCKT PfWt/IrZy5KkpY/4JbdaPVNtrnIysGzuXnnaQneT7o1Tm1/K5pU55q6u23vKd8aHFn722pT4 2RtfdmTcObOOX0hU8+vMDeofE4WKTk7q9qq5VPnx3HQ9Pe/67Wran34tetTbWZfa+GHThY0q QiF8vtVKLMUZiYZazEXFiQBVmLl+IQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5 References: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> 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=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: 1772942479381513502 X-GMAIL-MSGID: 1772942479381513502 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 Mon Jul 31 12:52:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 128681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2014183vqg; Mon, 31 Jul 2023 06:27:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlFK3ywshohwoWIoVu59KxohEvgKXZHsjiqFJODIlSVcyIbzxUMxfDhPBwn+wOajw8+G2Nx0 X-Received: by 2002:a17:902:9046:b0:1bb:7b0a:374 with SMTP id w6-20020a170902904600b001bb7b0a0374mr8163117plz.4.1690810030284; Mon, 31 Jul 2023 06:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690810030; cv=none; d=google.com; s=arc-20160816; b=0yYaqWOoAhhElqpFCrEca6XjrQTjVEQ3Q57yqO3Vdga5VydqokZJ6C/YHa1mCKcl+w RdXDmi6RL7O+1iCJdUQ8T6YVmZcR3KZPFsbWFnQjDXATdz3O+doJbiR+wUvFbPgg7vIa 9M4xptHPKGFEtgHrcAs0t/oRboDcmzhzSQ3x8u4aZX9n5wXM53OWcmXY3iZNqejcR8KB BZNzwDkoQgLN3lTXUqre/+jA5rur/t0d7MYyd+XmBJO1giirUGU+6hO6Vt3oKKn9Rb9z IF9GRy+5QufHaGyAwbAPHI1Omn4crIa7Gh1Ul2Ad5JnERdYtMAy+OvWtJxxQZLzNEqGH XWFg== 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=hKypVF/iC5KyqOUQrYuiPEcU/QBxpLeFbPvAkCacQF0=; fh=uBbyI6SbCMOsjvChbSySV6O3eRPD6uLlYeSceMR+iCY=; b=iIiQxtxNoLbapK1M1jw4tNd6GIVhSKpiea/VM3p71uOoaK1zAjgiHmxWgahkOGDK9B R3zk00coAyF0Wdlwjhf6XsmNJ3YHMQt9U5bkzgJa/y2JHBY2gULmQMcGVNZVfospQruo v4jbrJLTFQPmt0nRugKV6pE4OmC1o8bUXMZ5RGXwUVmbLnNYFjklb51HI1fN/s/eRcW5 Wm2UdJDUFNGRDiF0uKsCgej3yR4ekyBFwMyucUrIBFO1SolM0xcAGyaqM2H1ruI9JmXs cJlruj1+3bKg9dwjXfhtypv7sjncUNJUHWol0pXRepZN4JqmHIbZa22sIjyfjxJmMHPA ySrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="CYg2/tkU"; 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 ij6-20020a170902ab4600b001bbaa5e95fdsi7304306plb.102.2023.07.31.06.26.55; Mon, 31 Jul 2023 06:27:10 -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="CYg2/tkU"; 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 S232077AbjGaMwf (ORCPT + 99 others); Mon, 31 Jul 2023 08:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjGaMwd (ORCPT ); Mon, 31 Jul 2023 08:52:33 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5DDB8 for ; Mon, 31 Jul 2023 05:52:31 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230731125228epoutp0293b6fe0ca19cce04b4ddea21daa74358~29N7XLh4X0420604206epoutp02b for ; Mon, 31 Jul 2023 12:52:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230731125228epoutp0293b6fe0ca19cce04b4ddea21daa74358~29N7XLh4X0420604206epoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690807948; bh=hKypVF/iC5KyqOUQrYuiPEcU/QBxpLeFbPvAkCacQF0=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=CYg2/tkUwlM6wpvEaBhwVANgjY3bLHnml3dpIlxr6SwpuftKrKzPz2lg9x3hV097r L0jbkSKuYyZhO+MmmTLrmyZDAMX1mCn3FuOuM7agHOs+42HPSIzq8SGm+b7sqlhNsb j+jwGT0VHTjgizuvI5VduMzVoerWROvQ2xNTSBvU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230731125226epcas2p3e8b086a0f4e43ed8f9530be5fa33a501~29N6FDBmK1112211122epcas2p3K; Mon, 31 Jul 2023 12:52:26 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.100]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4RDynQ0yCjz4x9Pv; Mon, 31 Jul 2023 12:52:26 +0000 (GMT) X-AuditID: b6c32a45-83dfd7000000c2f9-69-64c7ae89e16d Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 82.F4.49913.98EA7C46; Mon, 31 Jul 2023 21:52:26 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 2/4] bio-integrity: Sets the payload size in bio_integrity_add_page() Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: "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: <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: <20230731125224epcms2p7e3c5bbe1fd544c0fd586520b2d155872@epcms2p7> Date: Mon, 31 Jul 2023 21:52:24 +0900 X-CMS-MailID: 20230731125224epcms2p7e3c5bbe1fd544c0fd586520b2d155872 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdljTXLdr3fEUg98HGS1W3+1ns5h1+zWL xctDmhaTDl1jtNh7S9vi8q45bBbLj/9jslj3+j2LA4fH+XsbWTwuny312LSqk83j49NbLB59 W1YxenzeJOfRfqCbKYA9KtsmIzUxJbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE3 1VbJxSdA1y0zB+gkJYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmtUmpBSk6BeYFecWJucWle ul5eaomVoYGBkSlQYUJ2xqpP19gKlihUTPi0lr2BsUO6i5GTQ0LARKL90QM2EFtIYAejRMcn py5GDg5eAUGJvzuEQUxhgSiJua+0ISqUJM6tmcUIYgsLGEi03G5jAbHZBPQkdjzfzd7FyMUh IvCZSeLyjw+sEON5JWa0P2WBsKUlti/fCtbMKeAnMfX6WyaIuIbEj2W9zBC2qMTN1W/ZYez3 x+YzQtgiEq33zkLVCEo8+LkbKi4pcejQVzaQOyUE8iU2HAiECNdItP16D1WuL3GtYyPYCbwC vhJPOmaCrWURUJXo+doJNcZF4ubUk2A1zALyEtvfzmEGGcksoCmxfpc+xHRliSO3oCr4JDoO /2WHebBh42+s7B3znjBBtKpJLGoyggjLSHw9PJ99AqPSLEQoz0KydhbC2gWMzKsYxVILinPT U4uNCgzh8Zqcn7uJEZwwtVx3ME5++0HvECMTB+MhRgkOZiUR3lMBh1KEeFMSK6tSi/Lji0pz UosPMZoCPTyRWUo0OR+YsvNK4g1NLA1MzMwMzY1MDcyVxHnvtc5NERJITyxJzU5NLUgtgulj 4uCUamBqVPxY4nXskdaJK2vTtIr0JBVNeRyY/vm63ZgqfONZ0g/1+IiTc9ya+//enyU9O3hm cLE9w4tv/yXWnPKakMo+xyf8cOWszfFzMqWlc68E3/y2JvZyxrF/h+3rzeV7uudkc/cmtny6 tW8zsxK77lfhF47OnO9iGCfsLCubVb98uz3fv30ndi2Nm3l8z0vrNR9eeR9+s/FmD4+cVUCK l4eBaYSUtpn6m9ZF298vu7F0vawIU77XudUf5BRWWfs8m6DfOXn9hAixPelP+i7bFXW4KM4R m9Q8cQ/Lw5kLTE5tf8vJPMGQweU3c+LcxZxr22eEuXdum8hkw/afO+DixrCSlyGiH1hqZjPJ HZm707ZNiaU4I9FQi7moOBEAMgfetiEEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5 References: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> 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_H4,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: 1772942818613006033 X-GMAIL-MSGID: 1772942818613006033 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 Signed-off-by: Jinyoung Choi Reviewed-by: Christoph Hellwig --- 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 Mon Jul 31 12:54: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: 128675 Return-Path: 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 + 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 ); 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 ; 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 ; 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 From: Jinyoung Choi To: "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: <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 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+gkJYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmtUmpBSk6BeYFecWJucWle ul5eaomVoYGBkSlQYUJ2xpaFigW7eSq2vPBrYLzB2cXIwSEhYCLx94F2FyMXh5DADkaJntP3 2EHivAKCEn93CHcxcnIIC4RKvLizig3EFhJQkji3ZhYjRNxAouV2GwuIzSagJ7Hj+W52kDki Ap+ZJC7/+MAKkpAQ4JWY0f6UBcKWlti+fCtYM6eAn8TU62+ZIOIaEj+W9TJD2KISN1e/ZYex 3x+bzwhhi0i03jsLVSMo8eDnbqi4pMShQ1/ZIH7Jl9hwIBAiXCPR9us9VLm+xLWOjWAn8Ar4 Slye+w3sFxYBVYkLs44wQ7S6SBzpkAEJMwvIS2x/OwcszCygKbF+lz5EhbLEkVssEBV8Eh2H /7LD/New8TdW9o55T5ggWtUkFjUZQYRlJL4ens8+gVFpFiKUZyFZOwth7QJG5lWMYqkFxbnp qclGBYbwWE3Oz93ECE6WWs47GK/M/6d3iJGJg/EQowQHs5II76mAQylCvCmJlVWpRfnxRaU5 qcWHGE2B/p3ILCWanA9M13kl8YYmlgYmZmaG5kamBuZK4rz3WuemCAmkJ5akZqemFqQWwfQx cXBKNTDJer00Yc2Nlk5jOrT5eMnqLye4DnVsS8ou/Kyspzn1YfKP7XWBt4IMV9m9UFiaPnWj /ot95lM+3p7MfKzxc761VdkDwTthz3SzfCxeJ67Nfrh+xSHN0/YRy8wUvy/47vrwR962cPWn Ttahsoc2vAy/dXax2NNH7wWSYncvtp4UYfjxQ5KY0GTVxoV/smM9vq1+zvhwS2znISvlNfXb 3kz8oCv3ri+EMXKZ5455U16FaT85MNs74ZuscalZeIHkXvXr/3Z/+XKZ/Zvip8ob7q9MErRV //1eJj1h0Qdbi6sXnFsW3lN3jlBgVPcTb31heKdob2qV9qLnAZHZm+askFuaYycnvoxhoXCn 1udExy8xSizFGYmGWsxFxYkAXlAquR8EAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5 References: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772942695641525850 X-GMAIL-MSGID: 1772942695641525850 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 Cc: Martin K. Petersen Reviewed-by: Christoph Hellwig Signed-off-by: Jinyoung Choi Reviewed-by: Christoph Hellwig --- 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 Mon Jul 31 12:56:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 128698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2028437vqg; Mon, 31 Jul 2023 06:52:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFL80x2XE7izHiOgKckyVQVEBmOWno6CIulTe9JKvxkTnBbjUnsqxV39vE3OHcwn3CHALYI X-Received: by 2002:aa7:cb59:0:b0:51e:4439:f476 with SMTP id w25-20020aa7cb59000000b0051e4439f476mr11998edt.25.1690811547753; Mon, 31 Jul 2023 06:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690811547; cv=none; d=google.com; s=arc-20160816; b=oDh+FbLMhTPIPHguiqsnqIKkrELYBtaM+kdNECglD5AKsvPNBGu5+XmSZB1Cvwq8kX fnRGiwpaoinmxVBd03UzWa3zsw4fywIZood5UMZtUA6HlvavkO6fZtv2ktg7rETe5i2C QNY7Ea/gg58qgx2Eitl05sSWIvejdf81i7B0Bt0tHb6XL9RoCtOLJweLSgL3cJIZ9mTt HM916uYqR9dqExGnWSa2ro4cVJnrEgz3aChmMQ+U5xQq4OJRmBp0FT2N3V9CTdabyLnf 0ibmi/Qr5xosy8PoZhopW97HIxIoxd9Rq7xkJC7lw96rXSoZeonDmw6AzmX6MKd2Goxy ZQgw== 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=uBbyI6SbCMOsjvChbSySV6O3eRPD6uLlYeSceMR+iCY=; b=Wj8jvS+xGroJca09jdwBIjuuZYSjog3Gz9Iv1CuDlXy95Lf8A/6v93U5Z+NuyTUBXa v0mohPQng/9J0HdWl3LLABDF6ofwQIQoIO46IVwIzvc+lhB8aZpVjfOPnWIcQE62feM2 f3C48hq92wx1RfMeqeMd5G2132pBlqqhARyX45ZsqUi7OZL+rsE5Cv0gvAd28wLQqESJ nbYTd6Wf9f30/8Fc9U61fLm/OFsxhqJanABZ4Q163ftPR7Hd+in9DS+59vj5/XHh83Nr sCllaOYrJE1/d7KyY1c0idhTnveh+UKbFxYwVWhC4dSbl5qvqIl2mQfXj/+GXedRkRP2 i3NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="LuUu7/5f"; 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 v20-20020aa7cd54000000b005221fc03d28si2339946edw.233.2023.07.31.06.52.03; Mon, 31 Jul 2023 06:52:27 -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="LuUu7/5f"; 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 S230075AbjGaM4W (ORCPT + 99 others); Mon, 31 Jul 2023 08:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231602AbjGaM4U (ORCPT ); Mon, 31 Jul 2023 08:56:20 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6DC9E46 for ; Mon, 31 Jul 2023 05:56:19 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230731125618epoutp030c06d8eb9d689053496124fe27404dca~29RRwcfy00659606596epoutp039 for ; Mon, 31 Jul 2023 12:56:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230731125618epoutp030c06d8eb9d689053496124fe27404dca~29RRwcfy00659606596epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690808178; bh=PoQdjC9lBed1xqyEfsVkXd2x90gYvZd/Stb7lCXTnc0=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=LuUu7/5fRl/u/nmzXK28mdlMVJO716v2tHVJ/FeOjosWbXvgkrzD9pLB4q5RVg3ay YqYSO0bZ8TDHs7JOl9bnqBBXgG3s5znchJgh3LEhRYo4Oh7SkM8FnWkd7BVD9557F6 lvfu8ioe7NFYAfH3vmus+Vx8e7vMJaL4EL5Mpfwk= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230731125617epcas2p2bb52468597e84125e3aa7f80af87b0af~29RROibJM2783127831epcas2p2k; Mon, 31 Jul 2023 12:56:17 +0000 (GMT) Received: from epsmgec2p1-new.samsung.com (unknown [182.195.36.70]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RDyss17kgz4x9Pv; Mon, 31 Jul 2023 12:56:17 +0000 (GMT) X-AuditID: b6c32a4d-853ff70000047356-10-64c7af70f776 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmgec2p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 7F.00.29526.07FA7C46; Mon, 31 Jul 2023 21:56:17 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 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: "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: <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: <20230731125616epcms2p15f142bc599785edac8be3ab9eb63fecc@epcms2p1> Date: Mon, 31 Jul 2023 21:56:16 +0900 X-CMS-MailID: 20230731125616epcms2p15f142bc599785edac8be3ab9eb63fecc X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMJsWRmVeSWpSXmKPExsWy7bCmhW7h+uMpBm0drBar7/azWcy6/ZrF 4uUhTYtJh64xWuy9pW1xedccNovlx/8xWax7/Z7FgcPj/L2NLB6Xz5Z6bFrVyebx8ektFo++ LasYPT5vkvNoP9DNFMAelW2TkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pmYKhraGlhrqSQl5ib aqvk4hOg65aZA3SSkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKbUgJafAvECvODG3uDQv XS8vtcTK0MDAyBSoMCE7Y07DcpaCHqGKNdtXMjYwPuTrYuTkkBAwkXiwpJu1i5GLQ0hgD6PE hgXnmbsYOTh4BQQl/u4QBjGFBWIktszQASkXElCSOLdmFiOILSxgINFyu40FxGYT0JPY8Xw3 O8gYEYHPTBKXf3xghZjPKzGj/SkLhC0tsX35VrBmTgE/ianX3zJBxDUkfizrZYawRSVurn7L DmO/PzafEcIWkWi9dxaqRlDiwc/dUHFJiUOHvrKB3CkhkC+x4UAgRLhGou3Xe6hyfYlrHRvB TuAV8JX4ce0IWJxFQFXi8aR1UDUuErdPPQJbyywgL7H97RxwKDALaEqs36UPMV1Z4sgtFogK PomOw3/ZYR5s2PgbK3vHvCdMEK1qEouajCDCMhJfD89nn8CoNAsRyrOQrJ2FsHYBI/MqRqnU guLc9NRkowJD3bzUcnjkJufnbmIEp04t3x2Mr9f/1TvEyMTBeIhRgoNZSYT3VMChFCHelMTK qtSi/Pii0pzU4kOMpkBPT2SWEk3OBybvvJJ4QxNLAxMzM0NzI1MDcyVx3nutc1OEBNITS1Kz U1MLUotg+pg4OKUamGYUGbeXVCR8Yjnt/XaXbL+nU8TL8HVPcwV3ydguvuTioPppXd/G6pvX f3xYv8trneHtoMp1a8ovfTFrtVzCO7m+5dpp60VcNY+28zsx1cZt6G1ROzJnrecJn6p19y5U eNv88Szebhzrca75VubUAzHsOh+4v9+YOU10sdLXk/kn3hYUBqas/ujRPGWuaJjBE47u6vky Ri6JhTYFeT0FsbHXHz/775W1fUvsatFZy35t8o3vvxqvt+7d1hX1Lw4G5/gd/th37AW7LbfQ b1WRIxzzfxnM/dbfNi1W9/MW1Zv77ufdPHfI6OHG7UsK/y74uNP/tohp8jy5yOxC2VW/dmSq VcdsjHH/73WrqFRIMk2JpTgj0VCLuag4EQBrJolpJgQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5 References: <20230731124710epcms2p55b4d1a163b5ee6f15d96bf07817e12a5@epcms2p5> 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=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: 1772944409693152451 X-GMAIL-MSGID: 1772944409693152451 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++;