virtio-scsi gives improper discard sysfs entries
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| QEMU |
Expired
|
Undecided
|
Unassigned | ||
Bug Description
Apologies if this is just an inherent part of paravirtualization that should be expected.
In my host, I have an LVM thin pool with chunk_size 128MB. Within it, I have a thin volume "tmp". In the host:
# fdisk -l /dev/lvm/tmp
Disk /dev/lvm/tmp: 256 MiB, 268435456 bytes, 524288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 134217728 bytes
Disklabel type: gpt
Disk identifier: BAE3154E-
Device Start End Sectors Size Type
/dev/lvm/tmp1 2048 524254 522207 255M Linux filesystem
$ lsblk
...
└─lvm-tmp 254:13 0 256M 0 lvm
└─lvm-tmp1 254:14 0 255M 0 part
$ cat /sys/dev/
0
$ cat /sys/dev/
134217728
$ cat /sys/dev/
17179869184
$ cat /sys/dev/
0
$ cat /sys/dev/
0
$ cat /sys/dev/
133169152
$ cat /sys/dev/
134217728
$ cat /sys/dev/
17179869184
$ cat /sys/dev/
0
$ cat /sys/dev/
0
If this is given to QEMU using virtio-scsi:
-device virtio-
-drive driver=
-device scsi-hd,
Then incorrect values are given:
$ lsblk
...
sdb 8:16 0 256M 0 disk
└─sdb1 8:17 0 255M 0 part /mnt
$ cat /sys/dev/
0
$ cat /sys/dev/
4096
$ cat /sys/dev/
1073741824
$ cat /sys/dev/
1073741824
$ cat /sys/dev/
0
$ cat /sys/dev/
133169152
And, there isn't even a /sys/dev/

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'expired' now.
Please continue with the discussion here:
https:/ /gitlab. com/qemu- project/ qemu/-/ issues/ 161