From patchwork Fri Aug 23 10:38:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13774962 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA0E187561 for ; Fri, 23 Aug 2024 10:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724410098; cv=none; b=injRyQ4sv0sdMkIbofsGLWoiAM/uvifeUHMZqRSgIzv+o0fGjpVwI0vElUYEfddt0zH4g5jrKD9PAl8V7A6VCbZ/IolFeD/WhRAt3IO69PRydVAmiHfTHQwZOARcCVtYyyUiRPJD564jN0aE3kCD1aUsCf3gUdlDEHzt3dY1lQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724410098; c=relaxed/simple; bh=8xrCboqKX1/hsaIOvnjsh52EnC8Lbd1VxbhU5M3E8Tc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=KpkB7nLsvaEaSPRWX7jxS3DQMRxb2BMAHuDt810Nk0IG6OxhWDIbRWYEiVvTmIRux3cY+WOkmoddujBm4qFAICiFwKxJta8XNs4yVycYY4AmKl26vlxKcRvocNITZP9lyjWNZ4em69bh6rAsp9st61LWHhLFjhVTlvfsG0UaIxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=Bfbd4dcq; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Bfbd4dcq" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240823104813epoutp01486bbb8bd3efcd3907c204fbc62a317d~uVdgW6Hu_0368203682epoutp01k for ; Fri, 23 Aug 2024 10:48:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240823104813epoutp01486bbb8bd3efcd3907c204fbc62a317d~uVdgW6Hu_0368203682epoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724410093; bh=8jA6l5tMs++plw+N26Lk0rdh9tUDLvjEvpwEPgRSsMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bfbd4dcquQvzRBXt3rFZ1lPrq6fWhWV/tyaUVPFGI0iZsO6QkHYs9EX9tV+e9YxUc ERGwPe2g3ZDgR3BA2f3OaNcyzwACiB5VflafQGfbTHgqu/lBU7WBW7qm5C2mh7Mbfl PN/6o+8j1850HQaV2/qecUBPdrt23zrSmsiX89YU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20240823104813epcas5p31e498e0c26224c6efcfc9b2222bc5a6b~uVdfzMXFK1288512885epcas5p3C; Fri, 23 Aug 2024 10:48:13 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.177]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4WqxcW44ZWz4x9Pw; Fri, 23 Aug 2024 10:48:11 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 60.F3.09640.BE868C66; Fri, 23 Aug 2024 19:48:11 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20240823104618epcas5p4b9983678886dceed75edd9cbec9341b2~uVb0vhpeM1988919889epcas5p46; Fri, 23 Aug 2024 10:46:18 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240823104618epsmtrp2daca9994ff06c5d5736525680aef473b~uVb0uxG2Z0122301223epsmtrp2A; Fri, 23 Aug 2024 10:46:18 +0000 (GMT) X-AuditID: b6c32a49-a57ff700000025a8-34-66c868eb61d2 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 21.6F.07567.A7868C66; Fri, 23 Aug 2024 19:46:18 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240823104616epsmtip206aa9085094eaa85cbf4914c5ff3b2b4~uVby08i-N1244412444epsmtip2j; Fri, 23 Aug 2024 10:46:16 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, krisman@suse.de Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, Anuj Gupta Subject: [PATCH v3 02/10] block: introduce a helper to determine metadata bytes from data iter Date: Fri, 23 Aug 2024 16:08:02 +0530 Message-Id: <20240823103811.2421-3-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823103811.2421-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmuu7rjBNpBk/+yVo0TfjLbDFn1TZG i9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Lrj28tDjpawn5S/e2Fa8Zl0Fv2BM1YZ98fJzQzatSLCa7LJw stHeGOuUu66pmqYL/UpDrktfqLAVStyXHXVHiaU4I9FQi7moOBEARZhMZAQDAAA= X-CMS-MailID: 20240823104618epcas5p4b9983678886dceed75edd9cbec9341b2 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240823104618epcas5p4b9983678886dceed75edd9cbec9341b2 References: <20240823103811.2421-1-anuj20.g@samsung.com> Introduce a new helper bio_iter_integrity_bytes to determine the number of metadata bytes corresponding to data iter. Suggested-by: Christoph Hellwig Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- include/linux/blk-integrity.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index de98049b7ded..2ff65c933c50 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -76,6 +76,15 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, return bio_integrity_intervals(bi, sectors) * bi->tuple_size; } +/* + * Return the integrity bytes corresponding to data iter + */ +static inline unsigned int bio_iter_integrity_bytes(struct blk_integrity *bi, + struct bvec_iter iter) +{ + return bio_integrity_bytes(bi, bvec_iter_sectors(iter)); +} + static inline bool blk_integrity_rq(struct request *rq) { return rq->cmd_flags & REQ_INTEGRITY; @@ -132,6 +141,13 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, { return 0; } + +static inline unsigned int bio_iter_integrity_bytes(struct blk_integrity *bi, + struct bvec_iter iter) +{ + return 0; +} + static inline int blk_integrity_rq(struct request *rq) { return 0;