diff mbox series

[1/7] block: add a ->get_unique_id method

Message ID 20211012120445.861860-2-hch@lst.de (mailing list archive)
State Superseded
Headers show
Series [1/7] block: add a ->get_unique_id method | expand

Commit Message

Christoph Hellwig Oct. 12, 2021, 12:04 p.m. UTC
Add a method to query query uniqueue 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 can also be 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 <hch@lst.de>
---
 include/linux/blkdev.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Bart Van Assche Oct. 12, 2021, 5:03 p.m. UTC | #1
On 10/12/21 5:04 AM, Christoph Hellwig wrote:
> Add a method to query query uniqueue 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 can also be 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 <hch@lst.de>
> ---
>   include/linux/blkdev.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 17705c970d7e1..81f94a7c54521 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1188,6 +1188,7 @@ 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);
> +	int (*get_unique_id)(struct gendisk *disk, u8 id[16], u8 id_type);
>   	struct module *owner;
>   	const struct pr_ops *pr_ops;

Please document the meaning of the 'u8 id_type' argument, how callers 
can determine the length of the unique ID and what the meaning of the 
return value is.

Thanks,

Bart.
Hannes Reinecke Oct. 14, 2021, 7:31 a.m. UTC | #2
On 10/12/21 2:04 PM, Christoph Hellwig wrote:
> Add a method to query query uniqueue IDs from block devices.  It will be

Maybe engage a spell checker here ...

> used to remove code that deeply pokes into SCSI internals in the NFS
> server.  The implementation in the sd driver itself can also be 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 <hch@lst.de>
> ---
>   include/linux/blkdev.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 17705c970d7e1..81f94a7c54521 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1188,6 +1188,7 @@ 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);
> +	int (*get_unique_id)(struct gendisk *disk, u8 id[16], u8 id_type);
>   	struct module *owner;
>   	const struct pr_ops *pr_ops;
>   
> 
Cheers,

Hannes
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 17705c970d7e1..81f94a7c54521 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1188,6 +1188,7 @@  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);
+	int (*get_unique_id)(struct gendisk *disk, u8 id[16], u8 id_type);
 	struct module *owner;
 	const struct pr_ops *pr_ops;