Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-25 Thread Shaun Tancheff
On Thu, Aug 25, 2016 at 1:31 AM, Tom Yan wrote: > On 25 August 2016 at 05:28, Shaun Tancheff wrote: >> On Wed, Aug 24, 2016 at 12:31 AM, Tom Yan wrote: >>> On 24 August 2016 at 11:33, Martin K. Petersen >>> wrote: > "Tom" == Tom Yan writes: Tom> Nope, SCSI Write Same commands

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-24 Thread Tom Yan
On 25 August 2016 at 05:28, Shaun Tancheff wrote: > On Wed, Aug 24, 2016 at 12:31 AM, Tom Yan wrote: >> On 24 August 2016 at 11:33, Martin K. Petersen >> wrote: "Tom" == Tom Yan writes: >>> >>> Tom> Nope, SCSI Write Same commands does not have payload (or in SCSI >>> Tom> terms, parame

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-24 Thread Shaun Tancheff
On Wed, Aug 24, 2016 at 12:31 AM, Tom Yan wrote: > On 24 August 2016 at 11:33, Martin K. Petersen > wrote: >>> "Tom" == Tom Yan writes: >> >> Tom> Nope, SCSI Write Same commands does not have payload (or in SCSI >> Tom> terms, parameter list / data-out buffer). >> >> WRITE SAME has a a paylo

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-23 Thread Tom Yan
On 24 August 2016 at 11:33, Martin K. Petersen wrote: >> "Tom" == Tom Yan writes: > > Tom> Nope, SCSI Write Same commands does not have payload (or in SCSI > Tom> terms, parameter list / data-out buffer). > > WRITE SAME has a a payload of 1 logical block (unless NDOB is set but we > have had

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-23 Thread Martin K. Petersen
> "Tom" == Tom Yan writes: Tom> Nope, SCSI Write Same commands does not have payload (or in SCSI Tom> terms, parameter list / data-out buffer). WRITE SAME has a a payload of 1 logical block (unless NDOB is set but we have had no good reason to support that yet). UNMAP has a payload that var

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-23 Thread Tom Yan
There's comment about `rq->__data_len` in sd.c (and blkdev.h, definition of struct `request`). Apparently it is "internal only" (in terms of the kernel). As for `cmd->transfersize`, it's probably talking about the CDB itself. Although different commands have CDB of various lengths (much shorter th

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-23 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 2:53 AM, Tom Yan wrote: > On 23 August 2016 at 06:20, Shaun Tancheff wrote: >> On Tue, Aug 23, 2016 at 12:26 AM, Tom Yan wrote: >> >>> It is always 1 merely because we prefer sticking to that. Say we want >>> to enable multi-block payload now, it won't be 1 anymore. >> >>

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-23 Thread Tom Yan
On 23 August 2016 at 06:20, Shaun Tancheff wrote: > On Tue, Aug 23, 2016 at 12:26 AM, Tom Yan wrote: > >> It is always 1 merely because we prefer sticking to that. Say we want >> to enable multi-block payload now, it won't be 1 anymore. > > Sorry, I though that DSM TRIM is using 512 bytes here be

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Shaun Tancheff
On Tue, Aug 23, 2016 at 12:26 AM, Tom Yan wrote: > It is always 1 merely because we prefer sticking to that. Say we want > to enable multi-block payload now, it won't be 1 anymore. Sorry, I though that DSM TRIM is using 512 bytes here because WRITE_SAME_16 has a payload of a single logical secto

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Tom Yan
On 23 August 2016 at 01:01, Shaun Tancheff wrote: > On Mon, Aug 22, 2016 at 6:49 PM, Tom Yan wrote: >> The only 512 I can see in the old code is the one in: >> >>> - used_bytes = ALIGN(i * 8, 512); >> >> where the alignment is necessary because 'used_bytes' will be returned >> as 'size', wh

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 6:49 PM, Tom Yan wrote: > The only 512 I can see in the old code is the one in: > >> - used_bytes = ALIGN(i * 8, 512); > > where the alignment is necessary because 'used_bytes' will be returned > as 'size', which will be used for setting the number of 512-byte block >

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Tom Yan
The only 512 I can see in the old code is the one in: > - used_bytes = ALIGN(i * 8, 512); where the alignment is necessary because 'used_bytes' will be returned as 'size', which will be used for setting the number of 512-byte block payload when we construct the ATA taskfile / command. It ma

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 4:20 PM, Tom Yan wrote: > On 22 August 2016 at 04:23, Shaun Tancheff wrote: >> Safely overwriting the attached page to ATA format from the SCSI formatted >> variant. >> >> Signed-off-by: Shaun Tancheff >> --- >> v6: >> - Fix bisect bug reported by Tom Yan >> - Change t

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Tom Yan
On 22 August 2016 at 04:23, Shaun Tancheff wrote: > Safely overwriting the attached page to ATA format from the SCSI formatted > variant. > > Signed-off-by: Shaun Tancheff > --- > v6: > - Fix bisect bug reported by Tom Yan > - Change to use sg_copy_from_buffer as per Christoph Hellwig > v5: >

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Tom Yan
Oh, 0x is fine for me, as long as you change it in ata_scsiop_inq_b0 as well. Actually I think replacing it with a macro (as suggested by Martin in another thread) is a good idea as well. A line split would be better than introducing an unnecessary variable that costs readability in the logic s

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Shaun Tancheff
On Mon, Aug 22, 2016 at 2:27 PM, Tom Yan wrote: > On 22 August 2016 at 12:23, Shaun Tancheff wrote: >> Safely overwriting the attached page to ATA format from the SCSI formatted >> variant. >> >> Signed-off-by: Shaun Tancheff >> --- >> v6: >> - Fix bisect bug reported by Tom Yan >> - Change t

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-22 Thread Tom Yan
On 22 August 2016 at 12:23, Shaun Tancheff wrote: > Safely overwriting the attached page to ATA format from the SCSI formatted > variant. > > Signed-off-by: Shaun Tancheff > --- > v6: > - Fix bisect bug reported by Tom Yan > - Change to use sg_copy_from_buffer as per Christoph Hellwig > v5: >

Re: [PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-21 Thread Hannes Reinecke
On 08/22/2016 06:23 AM, Shaun Tancheff wrote: > Safely overwriting the attached page to ATA format from the SCSI formatted > variant. > > Signed-off-by: Shaun Tancheff > --- > v6: > - Fix bisect bug reported by Tom Yan > - Change to use sg_copy_from_buffer as per Christoph Hellwig > v5: > -

[PATCH v6 1/4] libata: Safely overwrite attached page in WRITE SAME xlat

2016-08-21 Thread Shaun Tancheff
Safely overwriting the attached page to ATA format from the SCSI formatted variant. Signed-off-by: Shaun Tancheff --- v6: - Fix bisect bug reported by Tom Yan - Change to use sg_copy_from_buffer as per Christoph Hellwig v5: - Added prep patch to work with non-page aligned scatterlist pages