On 10 March 2016 at 18:33, Tom Yan <tom.ty89@xxxxxxxxx> wrote: > > But apparently it's NOT because of the device itself but has something > to do with the kernel. It will only get into trouble if I set a "step" > (`-p`) larger than "discard_max_bytes" (and/or > "discard_max_hw_bytes"?). > I just tested with an unpatched kernel and change "discard_max_bytes" according to the VPD manually (while "discard_max_hw_bytes" is set to 4294966784): /sys/block/sdc/queue/discard_granularity:4096 /sys/block/sdc/queue/discard_max_bytes:33521664 /sys/block/sdc/queue/discard_max_hw_bytes:4294966784 /sys/block/sdc/queue/discard_zeroes_data:0 And the behaviour become exactly like a patched kernel: [tom@localhost ~]$ sudo bash -c 'echo -n unmap > /sys/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/provisioning_mode' [tom@localhost ~]$ sudo bash -c 'echo 33521664 > /sys/block/sdc/queue/discard_max_bytes' [tom@localhost ~]$ time sudo blkdiscard -v -p 33521664 /dev/sdc /dev/sdc: Discarded 6838419456 bytes from the offset 0 /dev/sdc: Discarded 38382305280 bytes from the offset 6838419456 /dev/sdc: Discarded 37644828672 bytes from the offset 45220724736 /dev/sdc: Discarded 37544263680 bytes from the offset 82865553408 /dev/sdc: Discarded 37074960384 bytes from the offset 120409817088 /dev/sdc: Discarded 37812436992 bytes from the offset 157484777472 /dev/sdc: Discarded 37376655360 bytes from the offset 195297214464 /dev/sdc: Discarded 7383539712 bytes from the offset 232673869824 real 0m6.561s user 0m0.017s sys 0m0.110s [tom@localhost ~]$ time sudo blkdiscard -v -p 33521664 /dev/sdc /dev/sdc: Discarded 14280228864 bytes from the offset 0 /dev/sdc: Discarded 37711872000 bytes from the offset 14280228864 /dev/sdc: Discarded 37812436992 bytes from the offset 51992100864 /dev/sdc: Discarded 37544263680 bytes from the offset 89804537856 /dev/sdc: Discarded 37142003712 bytes from the offset 127348801536 /dev/sdc: Discarded 37343133696 bytes from the offset 164490805248 /dev/sdc: Discarded 37510742016 bytes from the offset 201833938944 /dev/sdc: Discarded 712728576 bytes from the offset 239344680960 real 0m6.412s user 0m0.017s sys 0m0.117s [tom@localhost ~]$ time sudo blkdiscard -v -p 33521664 /dev/sdc /dev/sdc: Discarded 8816197632 bytes from the offset 0 /dev/sdc: Discarded 38583435264 bytes from the offset 8816197632 /dev/sdc: Discarded 38214696960 bytes from the offset 47399632896 /dev/sdc: Discarded 37410177024 bytes from the offset 85614329856 /dev/sdc: Discarded 37510742016 bytes from the offset 123024506880 /dev/sdc: Discarded 37577785344 bytes from the offset 160535248896 /dev/sdc: Discarded 37544263680 bytes from the offset 198113034240 /dev/sdc: Discarded 4400111616 bytes from the offset 235657297920 real 0m6.371s user 0m0.023s sys 0m0.093s [tom@localhost ~]$ time sudo blkdiscard -v -p 4294966784 /dev/sdc /dev/sdc: Discarded 0 bytes from the offset 0 blkdiscard: /dev/sdc: BLKDISCARD ioctl failed: Input/output error real 4m7.586s user 0m0.010s sys 0m0.003s Attached is a full journal (kernel message).
Attachment:
log
Description: Binary data