Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp304152pxb; Wed, 20 Oct 2021 23:07:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVhUZlx6Zg99mk98t2Tpnahcw1S+aMMA6RChNAxWlqkPMXTmpJZSFbTn1ZBPomp5D6me6m X-Received: by 2002:a17:906:270e:: with SMTP id z14mr4817620ejc.414.1634796430536; Wed, 20 Oct 2021 23:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634796430; cv=none; d=google.com; s=arc-20160816; b=xRugVitwwQxrglqG2O9D9AbS2krZz8cYKS20bGqK0dibtrUKwHl+s3U9ptc9NDWP9B fPCtB2fS0dhBDcF3+IQT2or++Bwjr7uki+J8wys3oLDja5Wy9hP39IK5DCB+KjMaDk23 dZBUV95I88d9AhK2S3af0gnaZbM7mavTiyMwBUyE2sJBxoxQlTVes7myilwb0/YdscKy j8sg9Q0WR6T7V4IoUBQUy5VrKGnhVuWSe2EjOoRe9eQj7M7ZS3ldlS8wd9IylciiQgIL rZn7iwbKjSVwIdk17oE8FZL+QgGf6wWJ1ZDvKAxg7BEhpBTdbTsGgyhik7NX5g7elsx4 dB9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eMKXkDPYpzBoNZTUfrLiZ9UP9E1Xw6mYKD9ELYGXON8=; b=tGnG0+uRd4bwVxaiFCJNMS5sU0pn1dk182Ku8zDXaK0/S+GHu4Mp/f+2zYmQcaEj/P e8j6zug9hnwW0IZO6k+X2Qtxh6nDwpxK1Qg9kucFf7O/ylQHGN/c6ANKx7pKFcPsz6KA NTdPxnG0s4LqOAYaiXLjeVpDbRvM98oAx6OLw2QGkFTE33987DUvjjrYWl+an/kLHuXL jGjn6a1SaOP+M/HKC7s4XmvsFH7I6cgVtSIotyP3HtwhYtpz6/3FuMytM69ux7b/OoY6 2g3mbm1x73+NO3NvdWOY06pf2kITzjeDksAEdkiHBm5pHVkGepN4yRhcIXM0qexJaavC wvLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="V+nV2/+W"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b91si5324846edf.112.2021.10.20.23.06.19; Wed, 20 Oct 2021 23:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="V+nV2/+W"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbhJUGId (ORCPT + 99 others); Thu, 21 Oct 2021 02:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbhJUGIc (ORCPT ); Thu, 21 Oct 2021 02:08:32 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7839BC061749; Wed, 20 Oct 2021 23:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=eMKXkDPYpzBoNZTUfrLiZ9UP9E1Xw6mYKD9ELYGXON8=; b=V+nV2/+WGUx76PRMLoQUTDkD7H ZB0h6Phz5IYd241eSnt1kF0A6Gh6G3u50zfr2G4MwG+Z9jkDE6Q6V6hbrGhsnz0TuvcYFZ6vIpBZ2 ojo1YjFJVlbYRtCx46gs3IXg2yFZMkztFIxDP6Tss9gfr657krLUvWEs+flwerR4XDxPQVhspiEdS ZRdmAedUwtPL1R2qbWbguC18qN+sS98ujV3SxLNn5c9DD+WqwX2Bqn9phc6SsIDVVKvq56TJbQfdN jqllBcKMCblmJ6o0Lwg1DcV7ajqXpq3MPvhxtHs27lKjjk0ioodHLjHxenPjRMXhcWYmeSB5R2V3i Iy3qE/LQ==; Received: from [2001:4bb8:180:8777:7df0:a8d8:40cc:3310] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdRDS-006U4Q-1O; Thu, 21 Oct 2021 06:06:14 +0000 From: Christoph Hellwig To: Jens Axboe , "Martin K. Petersen" Cc: "J. Bruce Fields" , Chuck Lever , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH 1/7] block: add a ->get_unique_id method Date: Thu, 21 Oct 2021 08:06:01 +0200 Message-Id: <20211021060607.264371-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211021060607.264371-1-hch@lst.de> References: <20211021060607.264371-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Add a method to query unique IDs from block devices. It will be used to remove code that deeply pokes into SCSI internals in the NFS server. The implementation in the sd driver itself is also much nicer as it can use the cached VPD page instead of always sending a command as the current NFS code does. For now the interface is kept very minimal but could be easily extended when other users like a block-layer sysfs interface for uniquue IDs shows up. Signed-off-by: Christoph Hellwig --- include/linux/blkdev.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fd9771a1da096..af61fb3e1502c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1177,6 +1177,14 @@ static inline void blk_ksm_unregister(struct request_queue *q) { } #endif /* CONFIG_BLK_INLINE_ENCRYPTION */ +enum blk_unique_id { + /* these match the Designator Types specified in SPC */ + BLK_UID_T10 = 1, + BLK_UID_EUI64 = 2, + BLK_UID_NAA = 3, +}; + +#define NFL4_UFLG_MASK 0x0000003F struct block_device_operations { void (*submit_bio)(struct bio *bio); @@ -1195,6 +1203,9 @@ struct block_device_operations { int (*report_zones)(struct gendisk *, sector_t sector, unsigned int nr_zones, report_zones_cb cb, void *data); char *(*devnode)(struct gendisk *disk, umode_t *mode); + /* returns the length of the identifier or a negative errno: */ + int (*get_unique_id)(struct gendisk *disk, u8 id[16], + enum blk_unique_id id_type); struct module *owner; const struct pr_ops *pr_ops; -- 2.30.2