On Sun, Mar 06, 2022 at 11:31:33AM +0800, Ming Lei wrote: > The device looks partner of gendisk, I think it could just be a > private data of gendisk, and the attributes can be added to gendisk. Yes, that would be the normal way to do it. > > But scsi has the tradition of adding class device of scsi_host, > scsi_device, scsi_disk and scsi_generic. > > Adding such device makes things complicated, such as refcounting > in open/close disk. But looks scsi_disk isn't part of sysfs ABI, maybe it > can be removed, anyway: Unfortunatly it is in a major way: root@testvm:~# ls /sys/class/scsi_disk/0\:0\:0\:0 FUA manage_start_stop protection_mode uevent allow_restart max_medium_access_timeouts protection_type zeroing_mode app_tag_own max_retries provisioning_mode zoned_cap cache_type max_write_same_blocks subsystem device power thin_provisioning