From patchwork Thu Mar 21 23:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10864529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74D456C2 for ; Thu, 21 Mar 2019 23:11:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CDE62A541 for ; Thu, 21 Mar 2019 23:11:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F9412A543; Thu, 21 Mar 2019 23:11:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A2A2A541 for ; Thu, 21 Mar 2019 23:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727418AbfCUXLL (ORCPT ); Thu, 21 Mar 2019 19:11:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43904 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727413AbfCUXLL (ORCPT ); Thu, 21 Mar 2019 19:11:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F42AEQ++7toBGuHEZexmW5wjlGfvvflPDBOFKtwFxKY=; b=fJHTyuIjqmFWDJxpG01brLOLHz xuZ+utKKpBpt41OUN3ZJ76yM+bOPQuCvED4i2L3ycmSuZGL1rt8Vd+EJOJf9sVs3hSEjKtMdcMClJ CKeZPVCu+McaJ12lnptDQ7sWkLpbGtx/caeXz6g5KHh9tOLVJgtzpyx8J4cCCyYrnZkDC0cUwF+Fm OwEmuetnosujzmX8qidiSNPzt4XqxVVZQvx6lwTAGxrLEbgXtCDOQNChFrNOJ3q+5CkUVDSM1WsgN /UXvqzKMI/PkvdY/VUr7FiFOv18d0q0pxPUt1KiDqPtJuY3Z0Ar3lM75z9FyixPx1UE6ldslD3XjV qVBNIflg==; Received: from [199.255.44.128] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h76q1-0002U5-UT; Thu, 21 Mar 2019 23:11:05 +0000 From: Christoph Hellwig To: Jens Axboe , Keith Busch , Sagi Grimberg Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 02/15] block: add a rq_integrity_vec helper Date: Thu, 21 Mar 2019 16:10:24 -0700 Message-Id: <20190321231037.25104-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190321231037.25104-1-hch@lst.de> References: <20190321231037.25104-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This provides a nice little shortcut to get the integrity data for drivers like NVMe that only support a single integrity segment. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- include/linux/blkdev.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 255e20313cde..f9a072610d28 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1552,6 +1552,16 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, return bio_integrity_intervals(bi, sectors) * bi->tuple_size; } +/* + * Return the first bvec that contains integrity data. In general only + * drivers that are limited to a single integrity segment should use this + * helper. + */ +static inline struct bio_vec *rq_integrity_vec(struct request *rq) +{ + return rq->bio->bi_integrity->bip_vec; +} + #else /* CONFIG_BLK_DEV_INTEGRITY */ struct bio; @@ -1626,6 +1636,11 @@ static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, return 0; } +static inline struct bio_vec *rq_integrity_vec(struct request *rq) +{ + return NULL; +} + #endif /* CONFIG_BLK_DEV_INTEGRITY */ struct block_device_operations {