Re: [PATCH 1/2] libata-scsi: improve TRIM translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/04/2016 11:53 PM, tom.ty89@xxxxxxxxx wrote:

From: Tom Yan <tom.ty89@xxxxxxxxx>

Define TRIM_RANGE_SIZE and TRIM_RANGE_NUM so that the corresponding
functions can be more generalized. Also, conform SBC by rejecting

   Conform to SBC, perhaps?

WRITE SAME (16) commands with number of blocks that exceeds the limit
that is defined in the SATL.

Signed-off-by: Tom Yan <tom.ty89@xxxxxxxxx>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..80d732c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
[...]
@@ -3305,7 +3308,10 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
 		goto invalid_param_len;

 	buf = page_address(sg_page(scsi_sglist(scmd)));
-	size = ata_set_lba_range_entries(buf, 512, block, n_block);
+	if (n_block <= TRIM_RANGE_SIZE * TRIM_RANGE_NUM)
+	  size = ata_set_lba_range_entries(buf, TRIM_RANGE_NUM, block, n_block);
+	else
+	  goto invalid_fld;

   CodingStyle: indent with a tab, not spaces.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux