I have the same issue that was posted in
https://marc.info/?l=linux-usb&m=153295104606185&w=2

Output of 0xb2 and 0xb0 pages is:
sg_vpd --page=0xb2 /dev/sda
Logical block provisioning VPD page (SBC):
  Unmap command supported (LBPU): 1
  Write same (16) with unmap bit supported (LBWS): 0
  Write same (10) with unmap bit supported (LBWS10): 0
  Logical block provisioning read zeros (LBPRZ): 0
  Anchored LBAs supported (ANC_SUP): 0
  Threshold exponent: 1
  Descriptor present (DP): 0
  Minimum percentage: 0
  Provisioning type: 0
  Threshold percentage: 0

sg_vpd --page=0xb0 /dev/sda
Block limits VPD page (SBC):
  Write same non-zero (WSNZ): 0
  Maximum compare and write length: 0 blocks
  Optimal transfer length granularity: 8 blocks
  Maximum transfer length: 65535 blocks
  Optimal transfer length: 65535 blocks
  Maximum prefetch length: 65535 blocks
  Maximum unmap LBA count: 65535
  Maximum unmap block descriptor count: 16
  Optimal unmap granularity: 0
  Unmap granularity alignment valid: 0
  Unmap granularity alignment: 0
  Maximum write same length: 0x0 blocks
  Maximum atomic transfer length: 0
  Atomic alignment: 0
  Atomic transfer length granularity: 0
  Maximum atomic transfer length with atomic boundary: 0
  Maximum atomic boundary size: 0

According to the link reported by Oliver Neukum, unmap should have
been enabled, but it is not.
Setting manually the provisioning_mode to unmap enables discard, and
after doing some testing, it really works.
cat /sys/class/scsi_disk/9\:0\:0\:0/provisioning_mode
full
echo unmap > /sys/class/scsi_disk/9\:0\:0\:0/provisioning_mode
lsblk -D
NAME                   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda                           0        4K       4G         0
├─sda1                        0        4K       4G         0
├─sda2                        0        4K       4G         0

So, why it fails to set provisioning_mode to unmap automatically?

Reply via email to