From: Tom Yan
Example:
[root@localhost ~]# sg_opcodes /dev/sdb > /dev/null
Report supported operation codes: Illegal request, invalid opcode
[root@localhost ~]# sg_vpd -p bl /dev/sdb | grep 'write same'
Maximum write same length: 0x0 blocks
[root@localhost ~]# cat /sys/block/sdb/queue/write_
From: Tom Yan
Signed-off-by: Tom Yan
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 1179ec1..951 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2786,7 +2786,7 @@ static void sd_read_write_same(struct scsi_disk *sdkp,
unsigned char *buffer)
* CODES is
From: Tom Yan
Example:
[root@localhost ~]# sg_opcodes /dev/sdb > /dev/null
Report supported operation codes: Illegal request, invalid opcode
[root@localhost ~]# sg_vpd -p bl /dev/sdb | grep 'write same'
Maximum write same length: 0x0 blocks
[root@localhost ~]# cat /sys/block/sdb/queue/write_
From: Tom Yan
Some devices have details of their support on unmapping on the
Block Limits and/or Logical Block Provisioning VPDs while they
do not set the LBPME bit to 1. Though this is required by the
SCSI standards, the VPDs are giving even more concrete details
about the support, so they shoul
From: Tom Yan
According to its own comment, the discard granularity should
fixed to the logical block size. However, the actual code has
it hardcoded as 1 byte. Changing it to logical_block_size.
Signed-off-by: Tom Yan
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d749da7..5a5457a 1
From: Tom Yan
Nothing in the kernel actually makes use of the DRA bit in SCSI
MODE SENSE. Neither is there a sysfs file (like 'cache_type' for
WCE) that allows users to change the bit nor SCSI-ATA Translation
that can toggle the ATA feature.
Hence removing the MODE SENSE SCSI-ATA Translation tha
From: Tom Yan
https://bugzilla.kernel.org/show_bug.cgi?id=106931
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index cd30f11..0295c38 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1985,8 +1985,8 @@ static unsigned int ata_
From: Tom Yan
https://bugzilla.kernel.org/show_bug.cgi?id=105931
This might look trivial at first sight. However, it can be
important to have the bit set accordingly when the device/SATL is
SCSI-passthrough'd to a virtual machine with scsi-block in qemu:
https://github.com/YanVugenfirer/kvm-gue
From: Tom Yan
As of commit ca369d51b3e1649be4a72addd6d6a168cfb3f537, max_sectors
(rw_max) of a scsi disk can be as high as SD_DEF_XFER_BLOCKS.
Therefore, bump SCSI_DEFAULT_MAX_SECTORS to 65535 to make hosts
that do not have max_sectors set in their templates benefit
from the commit.
Hosts that
From: Tom Yan
Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made
qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless.
Instead of removing the template limit, now we only change limit according
to the qdepth reported by the device if it is smaller than MAX
From: Tom Yan
Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made
qdepth limit set in host template (`.can_queue = MAX_CMNDS`) redundant.
Removing it to avoid confusion.
Signed-off-by: Tom Yan
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 4d49f
From: Tom Yan
Some devices may not be decent enough to report lbpme bit properly
even when they do support unmap and report relevant information
in the block limits and logical block provisioning VPDs properly
(Namely, ASMedia ASM1351, a UAS-SATA bridge). One of the reasons
is, lbpme=1 is not a r
From: Tom Yan
It does not make sense and is confusing to response with "Invalid
field in cbd" while we have no support at all implemented for
FORMAT UNIT. It is decent to let it go to the default, which
will response with "Invalid command operation code" instead.
Signed-off-by: Tom Yan
diff --
From: Tom Yan
Define TRIM_RANGE_SIZE and TRIM_RANGE_NUM so that the corresponding
functions can be more generalized. Also, conform SBC by rejecting
WRITE SAME (16) commands with number of blocks that exceeds the limit
that is defined in the SATL.
Signed-off-by: Tom Yan
diff --git a/drivers/ata
From: Tom Yan
It does not make sense and is confusing to respond with "Invalid
field in CDB" while we have no support at all implemented for
FORMAT UNIT. It is decent to let it go to the default, which
will respond with "Invalid command operation code" instead.
Signed-off-by: Tom Yan
diff --gi
From: Tom Yan
Define TRIM_RANGE_SIZE and TRIM_RANGE_NUM so that the corresponding
functions can be more generalized. Also, conform to SBC by rejecting
WRITE SAME (16) commands with number of blocks that exceeds the limit
that is defined in the SATL.
Signed-off-by: Tom Yan
diff --git a/drivers/
From: Tom Yan
Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and
From: Tom Yan
Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.
It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for th
From: Tom Yan
Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and
From: Tom Yan
Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.
It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for th
From: Tom Yan
It does not make sense and is confusing to respond with "Invalid
field in CDB" while we have no support at all implemented for
FORMAT UNIT. It is decent to let it go to the default, which
will respond with "Invalid command operation code" instead.
Signed-off-by: Tom Yan
diff --gi
From: Tom Yan
It's Command Descriptor Block. Also capitalized it.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f1125fd..c9cd216 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -304,7 +304,7 @@ static void ata_scsi_set
From: Tom Yan
Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and
From: Tom Yan
Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.
It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for th
From: Tom Yan
SAT (as of sat4r05f.pdf) does not require this vendor specific
designator. Besides, we already have the Unit Serial Number VPD.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..9f478ad 100644
--- a/drivers/ata/libata-scsi.c
From: Tom Yan
SAT (as of sat4r05f.pdf) only requires the t10 designator if the
drive does not support/have WWN. Besides, we already have the ATA
information VPD.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9f478ad..84b3d42 100644
--- a/driver
From: Tom Yan
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..e3f5751 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2424,10 +2424,12 @@ static void modecpy(u8 *dest, const u8 *src, int n,
bool changeable)
st
From: Tom Yan
Without this fix, the DRA bit of the caching mode page would not
be updated when the read look-ahead feature is toggled (e.g. with
`smartctl --set`), but will only be until, for example, the write
cache feature is touched.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-co
From: Tom Yan
With this patch, users can make use of the SANITIZE DEVICE feature
set through utility like sg_sanitize.
Support for BLOCK ERASE, CRYPTOGRAPHIC ERASE and EXIT FAILURE MODE
has been implemented. Support for OVERWRITE that involves a
parameter list has been left out for now.
Further
From: Tom Yan
Without this fix, the DRA bit of the caching mode page would not
be updated when the read look-ahead feature is toggled (e.g. with
`smartctl --set`), but will only be until, for example, the write
cache feature is touched.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-co
From: Tom Yan
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..6f7c626 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2424,10 +2424,13 @@ static void modecpy(u8 *dest, const u8 *src, int n,
bool changeable)
st
From: Tom Yan
Avoid performance bottleneck when being SCSI pass-through'd to
virtual machines with other OSes (e.g. Windows) via virtio-scsi
and scsi-block in qemu.
Ref.: https://github.com/YanVugenfirer/kvm-guest-drivers-windows/issues/63
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libat
From: Tom Yan
The comment suggests we should be having an SPC-3 version descriptor
but the 0260h is the code for "SPC-2 (no version claimed)". Correct
it to 0300h so that it has the "SPC-3 (no version claimed)" descriptor.
Note that we are claiming SPC-3 version compatibility in the VERSION
fiel
From: Tom Yan
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..48ea887 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2424,10 +2424,12 @@ static void modecpy(u8 *dest, const u8 *src, int n,
bool changeable)
st
From: Tom Yan
Without this fix, the DRA bit of the caching mode page would not
be updated when the read look-ahead feature is toggled (e.g. with
`smartctl --set`), but will only be until, for example, the write
cache feature is touched.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-co
From: Tom Yan
Commit 856c46639309 ("libata: support device-managed ZAC devices")
had the line that "bumps" the VERSION field in standard INQUIRY data
removed. Add it back and claim SPC-5 version compatibility, which
matches with the current version descriptor "SPC-5 (no version claimed)"
that is
From: Tom Yan
The bit should always be set to 1 when the requested version of
page is "changeable" because we've made it so in ata_mselect_control().
Also, it should always be set to 1 if ATA_DFLAG_D_SENSE is set (when
the requested version of page is "current" or "default").
Signed-off-by: Tom
From: Tom Yan
To make it consistent with the recently added ata_mselect_control().
We probably shouldn't have the word "mode" in its name anyway, since
that's not the case for other ata_msense_*() / ata_mselect_*() either.
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers
From: Tom Yan
The bit should always be set to 1 when the requested version of
page is "changeable" because we've made it so in ata_mselect_control().
Also, it should always be set to 1 if ATA_DFLAG_D_SENSE is set (when
the requested version of page is "current" or "default").
Signed-off-by: Tom
From: Tom Yan
Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.
It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for th
From: Tom Yan
Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and
From: Tom Yan
As of commit 6b7e9cde4969 ("sd: Fix rw_max for devices that report
an optimal xfer size"), the scsi disk driver (correctly) derive both
of the queue limits "io_opt" and "max_sectors" from the optimal
transfer length field.
In case we would like the two limits to be derived from a v
From: Tom Yan
ATA_MAX_SECTORS_LBA48 is only used for setting the queue limit
"max_hw_sectors", which only serves as the cap for "max_sectors",
which is in turn the actual limit being used. Therefore, it should
be alright for us to bump ATA_MAX_SECTORS_LBA48 to 65536. Also,
lba_48_ok() has been ac
From: Tom Yan
Signed-off-by: Tom Yan
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 24f886c..d4bb802 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -1095,13 +1095,13 @@ static inline bool ata_ok(u8 status)
static inline bool lba_28_ok(u64 block, u32 n_block)
{
From: Tom Yan
`changeable` is the "version" of mode page requested by the user.
It will be less confusing/misleading if we do not check it
"together" with the setting bits of the drive.
Not to mention that we currently have ata_mselect_*() implemented
in a way that each of them will serve exclus
From: Tom Yan
1. Removed a repeated bit masking in ata_mselect_control()
2. Moved `wce`/`d_sense` assignment below the page validity checks
3. Added/Removed empty lines where appropriate
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b00521b..06
From: Tom Yan
Commit 7780081c1f04 ("libata-scsi: Set information sense field for
invalid parameter") changed how ata_mselect_*() make sure read-only
bits are not modified. The new implementation introduced a bug that
the read-only bits in the byte that has a changeable bit will not
be checked.
A
From: Tom Yan
Commit 7780081c1f04 ("libata-scsi: Set information sense field for
invalid parameter") changed how ata_mselect_*() make sure read-only
bits are not modified. The new implementation introduced a bug that
the read-only bits in the byte that has a changeable bit will not
be checked.
A
From: Tom Yan
1. Removed a repeated bit masking in ata_mselect_control()
2. Moved `wce`/`d_sense` assignment below the page validity checks
3. Added/Removed empty lines where appropriate
Signed-off-by: Tom Yan
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2bdb5da..eb
From: Tom Yan
Commit 7780081c1f04 ("libata-scsi: Set information sense field for
invalid parameter") changed how ata_mselect_*() make sure read-only
bits are not modified. The new implementation introduced a bug that
the read-only bits in the byte that has a changeable bit will not
be checked.
A
From: Tom Yan
ata_mselect_*() would initialize a char array for storing a copy of
the current mode page. However, if char was actually signed char,
overflow could occur.
For example, `0xff` from def_control_mpage[] would be "truncated"
to `-1`. This prevented ata_mselect_control() from working a
From: Tom Yan
The one-page-at-a-time check in ata_scsi_mode_select_xlat() should
be done before either of the ata_mselect_*() is called.
Also updated the comment. We have more than one mode page that has
changeable bit since commit 06dbde5f3a44 ("libata: Implement
control mode page to select sen
From: Tom Yan
scsi_done() was called repeatedly and apparently because of that,
the kernel would call trace when we touch the Control mode page:
Call Trace:
[] dump_stack+0x63/0x81
[] __warn+0xcb/0xf0
[] warn_slowpath_null+0x1d/0x20
[] ata_eh_finish+0xe0/0xf0 [libata]
[] sata_pmp_error_hand
From: Tom Yan
Commit 7780081c1f04 ("libata-scsi: Set information sense field for
invalid parameter") changed how ata_mselect_*() make sure read-only
bits are not modified. The new implementation introduced a bug that
the read-only bits in the byte that has a changeable bit will not
be checked.
M
From: Tom Yan
ata_mselect_*() would initialize a char array for storing a copy of
the current mode page. However, char could be signed char. In that
case, bytes larger than 127 would be converted to negative number.
For example, 0xff from def_control_mpage[] would become -1. This
prevented ata_m
From: Tom Yan
Commit 7780081c1f04 ("libata-scsi: Set information sense field for
invalid parameter") changed how ata_mselect_*() make sure read-only
bits are not modified. The new implementation introduced a bug that
the read-only bits in the byte that has a changeable bit will not
be checked.
M
From: Tom Yan
ata_mselect_*() would initialize a char array for storing a copy of
the current mode page. However, char could be signed char. In that
case, bytes larger than 127 would be converted to negative number.
For example, 0xff from def_control_mpage[] would become -1. This
prevented ata_m
From: Tom Yan
ata_mselect_*() would initialize a char array for storing a copy of
the current mode page. However, char could be signed char. In that
case, bytes larger than 127 would be converted to negative number.
For example, 0xff from def_control_mpage[] would become -1. This
prevented ata_m
From: Tom Yan
Along with commit 1dc8fff24187 ("libata-scsi: do not call
blk_queue_max_hw_sectors()"), devices with LBA48 support will have
max_sectors set to SCSI_DEFAULT_MAX_SECTORS (currently 1024), by
the scsi driver.
Note that the "max_sectors" here is actually the block layer limit
"max_hw_
From: Tom Yan
We should just let the scsi driver (hosts.c) call the function. It
has better heuristic anyway (i.e. use SCSI_DEFAULT_MAX_SECTORS as
fallback when max_sectors is not set).
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2bdb5da..495d916 100644
--- a/drivers
From: Tom Yan
Currently block layer limit max_hw_sectors is set to
ATA_MAX_SECTORS_LBA48 (65535), for devices with LBA48 support.
However, block layer limit max_sectors (which is the effective
one; also adjustable, upper-bounded by max_hw_sectors) is set to
BLK_DEF_MAX_SECTORS (currently 2560) b
From: Tom Yan
When the request queue is initialized (see __scsi_init_queue() in
scsi_lib.c), the block layer limit max_hw_sectors is set to
shost->max_sectors, which will be set to the "machine infinity"
SCSI_DEFAULT_MAX_SECTORS (currently 1024) if sht->max_sectors is
not set (see scsi_host_alloc
From: Tom Yan
Currently we advertise Maximum Write Same Length based on the
maximum number of sectors that one-block TRIM payload can cover.
The field are used to derived discard_max_bytes and
write_same_max_bytes limits in the block layer, which currently can
at max be 0x (32-bit).
Howe
From: Tom Yan
WRITE SAME (16) command can technically handle up to 32-bit
number of blocks. However, since 32-bit is also the limitation of
the maximum number of bytes that can be represented in the block
layer, the current SD_MAX_WS16_BLOCKS was hence derived from the
technical limit devided by
From: Tom Yan
Currently we use dev->max_sectors to set max_hw_sectors, which
is actually supposed to be a host controller limit (that get set
by the host controller driver like ahci, and if not it would be
the fallback SCSI_DEFAULT_MAX_SECTORS).
That means we have been doing the wrong thing. The
From: Tom Yan
The SCSI disk driver sets max_sector to BLK_DEF_MAX_SECTORS when
the device does not report Optimal Transfer Length. However, it
checks only whether it is smaller than max_hw_sectors, but not
max_dev_sectors.
Signed-off-by: Tom Yan
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd
From: Tom Yan
Currently we use dev->max_sectors to set max_hw_sectors, which
is actually supposed to be a host controller limit (that get set
by the host controller driver like ahci, and if not it would be
the fallback SCSI_DEFAULT_MAX_SECTORS).
That means we have been doing the wrong thing. The
From: Tom Yan
The SCSI disk driver sets max_sectors to BLK_DEF_MAX_SECTORS when
the device does not report Optimal Transfer Length. However, it
checks only whether it is smaller than max_hw_sectors, but not
max_dev_sectors.
Signed-off-by: Tom Yan
diff --git a/drivers/scsi/sd.c b/drivers/scsi/s
From: Tom Yan
In commit 5c79097a28c2 ("libata-scsi: reject WRITE SAME (16) with
n_block that exceeds limit"), it is made sure that
ata_set_lba_range_entries() will never be called with a request
size (n_block) that is larger than the number of blocks that a
512-byte block TRIM payload can describ
69 matches
Mail list logo