Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-25 Thread Shaun Tancheff
On Thu, Aug 25, 2016 at 1:23 AM, Tom Yan wrote: > You only fill the bytes that you want to to set explicitly: > > + put_unaligned_le16(0x0002, [0]); /* SCT_ACT_WRITE_SAME */ > + put_unaligned_le16(0x0101, [1]); /* WRITE PTRN FG */ > +

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-25 Thread Shaun Tancheff
On Thu, Aug 25, 2016 at 1:23 AM, Tom Yan wrote: > You only fill the bytes that you want to to set explicitly: > > + put_unaligned_le16(0x0002, [0]); /* SCT_ACT_WRITE_SAME */ > + put_unaligned_le16(0x0101, [1]); /* WRITE PTRN FG */ > + put_unaligned_le64(lba, [2]); > +

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-25 Thread Tom Yan
You only fill the bytes that you want to to set explicitly: + put_unaligned_le16(0x0002, [0]); /* SCT_ACT_WRITE_SAME */ + put_unaligned_le16(0x0101, [1]); /* WRITE PTRN FG */ + put_unaligned_le64(lba, [2]); + put_unaligned_le64(num, [6]); +

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-25 Thread Tom Yan
You only fill the bytes that you want to to set explicitly: + put_unaligned_le16(0x0002, [0]); /* SCT_ACT_WRITE_SAME */ + put_unaligned_le16(0x0101, [1]); /* WRITE PTRN FG */ + put_unaligned_le64(lba, [2]); + put_unaligned_le64(num, [6]); +

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-24 Thread Shaun Tancheff
On Wed, Aug 24, 2016 at 1:10 AM, Tom Yan wrote: > Btw, I wonder if you need to memset your buffer with 0 first, like > what is done in ata_scsi_rbuf_get. It is not necessary as the defined buffer is completely filled out here. Are you thinking as a sort of future proofing?

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-24 Thread Shaun Tancheff
On Wed, Aug 24, 2016 at 1:10 AM, Tom Yan wrote: > Btw, I wonder if you need to memset your buffer with 0 first, like > what is done in ata_scsi_rbuf_get. It is not necessary as the defined buffer is completely filled out here. Are you thinking as a sort of future proofing? Ex: In the unlikely

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-24 Thread Tom Yan
Btw, I wonder if you need to memset your buffer with 0 first, like what is done in ata_scsi_rbuf_get. On 24 August 2016 at 13:57, Tom Yan wrote: > Never mind. I was a bit lightheaded. > > Anyway I don't think you should use ata_scsi_rbuf. It is a buffer > created and used for

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-24 Thread Tom Yan
Btw, I wonder if you need to memset your buffer with 0 first, like what is done in ata_scsi_rbuf_get. On 24 August 2016 at 13:57, Tom Yan wrote: > Never mind. I was a bit lightheaded. > > Anyway I don't think you should use ata_scsi_rbuf. It is a buffer > created and used for ata_scsi_simulate,

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
Never mind. I was a bit lightheaded. Anyway I don't think you should use ata_scsi_rbuf. It is a buffer created and used for ata_scsi_simulate, which interacts with the SCSI layer but not the ATA device (v.s. ata_scsi_translate). You should probably create buffer inside ata_format_dsm_trim_descr()

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
Never mind. I was a bit lightheaded. Anyway I don't think you should use ata_scsi_rbuf. It is a buffer created and used for ata_scsi_simulate, which interacts with the SCSI layer but not the ATA device (v.s. ata_scsi_translate). You should probably create buffer inside ata_format_dsm_trim_descr()

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 5:37 AM, Tom Yan wrote: > On 22 August 2016 at 04:23, Shaun Tancheff wrote: >> +/** >> + * ata_format_dsm_trim_descr() - SATL Write Same to ATA SCT Write Same >> + * @cmd: SCSI command being translated >> + * @lba: Starting sector

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 5:37 AM, Tom Yan wrote: > On 22 August 2016 at 04:23, Shaun Tancheff wrote: >> +/** >> + * ata_format_dsm_trim_descr() - SATL Write Same to ATA SCT Write Same >> + * @cmd: SCSI command being translated >> + * @lba: Starting sector >> + * @num: Number of logical sectors to

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
On 22 August 2016 at 04:23, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
On 22 August 2016 at 04:23, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same command. > > Based on the

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
Hmm, On 22 August 2016 at 18:00, Shaun Tancheff wrote: > > Timeout for WS is 120 seconds so we should be fine there. > > The number to look for is the: >Max. Sustained Transfer Rate OD (MB/s): 190 8TB (180 5TB) > > Which means the above drives should complete a 2G

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Tom Yan
Hmm, On 22 August 2016 at 18:00, Shaun Tancheff wrote: > > Timeout for WS is 120 seconds so we should be fine there. > > The number to look for is the: >Max. Sustained Transfer Rate OD (MB/s): 190 8TB (180 5TB) > > Which means the above drives should complete a 2G write in > about 10 to 11

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 12:55 AM, Tom Yan wrote: > I am really not going to tell the whole story here again. We have a > really long discussion on whether we should advertise Maximum Write > Same Length for SCT Write Same, and the value we should advertise. > (Didn't we come

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-23 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 12:55 AM, Tom Yan wrote: > I am really not going to tell the whole story here again. We have a > really long discussion on whether we should advertise Maximum Write > Same Length for SCT Write Same, and the value we should advertise. > (Didn't we come to an conclusion on

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 23 August 2016 at 00:36, Shaun Tancheff wrote: > On Mon, Aug 22, 2016 at 6:09 PM, Tom Yan wrote: >> I am not sure about what you mean here. Rejecting SCSI Write Same >> commands that has its "number of blocks" field set to a value higher >> than

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 23 August 2016 at 00:36, Shaun Tancheff wrote: > On Mon, Aug 22, 2016 at 6:09 PM, Tom Yan wrote: >> I am not sure about what you mean here. Rejecting SCSI Write Same >> commands that has its "number of blocks" field set to a value higher >> than the device's reported Maximum Write Same Length

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 6:09 PM, Tom Yan wrote: > I am not sure about what you mean here. Rejecting SCSI Write Same > commands that has its "number of blocks" field set to a value higher > than the device's reported Maximum Write Same Length is only natural > and mandated by

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 6:09 PM, Tom Yan wrote: > I am not sure about what you mean here. Rejecting SCSI Write Same > commands that has its "number of blocks" field set to a value higher > than the device's reported Maximum Write Same Length is only natural > and mandated by SBC. We have no

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
I am not sure about what you mean here. Rejecting SCSI Write Same commands that has its "number of blocks" field set to a value higher than the device's reported Maximum Write Same Length is only natural and mandated by SBC. We have no reason (even if it is practically not a must) not to do it

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
I am not sure about what you mean here. Rejecting SCSI Write Same commands that has its "number of blocks" field set to a value higher than the device's reported Maximum Write Same Length is only natural and mandated by SBC. We have no reason (even if it is practically not a must) not to do it

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 3:14 PM, Tom Yan wrote: > On 23 August 2016 at 03:43, Shaun Tancheff wrote: >> >> Why would we enforce upper level limits on something that doesn't >> have any? > > If we advertise a limit in our SATL, it makes sense that we

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 3:14 PM, Tom Yan wrote: > On 23 August 2016 at 03:43, Shaun Tancheff wrote: >> >> Why would we enforce upper level limits on something that doesn't >> have any? > > If we advertise a limit in our SATL, it makes sense that we should > make sure the behaviour is consistent

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 23 August 2016 at 03:43, Shaun Tancheff wrote: >>> + if (unmap) { >>> + /* If trim is not enabled the cmd is invalid. */ >>> + if ((dev->horkage & ATA_HORKAGE_NOTRIM) || >>> + !ata_id_has_trim(dev->id)) { >>> +

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 23 August 2016 at 03:43, Shaun Tancheff wrote: >>> + if (unmap) { >>> + /* If trim is not enabled the cmd is invalid. */ >>> + if ((dev->horkage & ATA_HORKAGE_NOTRIM) || >>> + !ata_id_has_trim(dev->id)) { >>> + fp = 1;

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 2:20 PM, Tom Yan wrote: > On 22 August 2016 at 12:23, Shaun Tancheff wrote: >> SATA drives may support write same via SCT. This is useful >> for setting the drive contents to a specific pattern (0's). >> >> Translate a SCSI WRITE

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 2:20 PM, Tom Yan wrote: > On 22 August 2016 at 12:23, Shaun Tancheff wrote: >> SATA drives may support write same via SCT. This is useful >> for setting the drive contents to a specific pattern (0's). >> >> Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM >>

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 22 August 2016 at 12:23, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Tom Yan
On 22 August 2016 at 12:23, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same command. > > Based on the

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Hannes Reinecke
On 08/22/2016 06:23 AM, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same command. > > Based on the

Re: [PATCH v6 2/4] Add support for SCT Write Same

2016-08-22 Thread Hannes Reinecke
On 08/22/2016 06:23 AM, Shaun Tancheff wrote: > SATA drives may support write same via SCT. This is useful > for setting the drive contents to a specific pattern (0's). > > Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM > command or an SCT Write Same command. > > Based on the

[PATCH v6 2/4] Add support for SCT Write Same

2016-08-21 Thread Shaun Tancheff
SATA drives may support write same via SCT. This is useful for setting the drive contents to a specific pattern (0's). Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM command or an SCT Write Same command. Based on the UNMAP flag: - When set translate to DSM TRIM - When not set

[PATCH v6 2/4] Add support for SCT Write Same

2016-08-21 Thread Shaun Tancheff
SATA drives may support write same via SCT. This is useful for setting the drive contents to a specific pattern (0's). Translate a SCSI WRITE SAME 16 command to be either a DSM TRIM command or an SCT Write Same command. Based on the UNMAP flag: - When set translate to DSM TRIM - When not set