public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* UNMAP command parameter list
@ 2014-11-07 23:30 Andras Kovacs
  2014-11-07 23:57 ` Elliott, Robert (Server Storage)
  0 siblings, 1 reply; 8+ messages in thread
From: Andras Kovacs @ 2014-11-07 23:30 UTC (permalink / raw)
  To: linux-scsi


  Hi all,

  I'm trying to see what parameters are passed to the UFS driver from the
SCSI midlayer when an UNMAP command is issued. In the UFS driver I can see
the 10 byte command itself in the unsigned char *cmnd field of the struct
scsi_cmnd, and it tells me that the parameter list length is 24 bytes (an 8
byte UNMAP Parameter List header followed by one 16 byte long UNMAP Block
Descriptor), but I'm having trouble finding where this UNMAP Parameter List
is. It doesn't seem to be in the cmnd[] byte array after the UNMAP command
itself.

  Can anyone tell me where I can find the UNMAP Parameter List which belongs
to a particular UNMAP command?

  Any and all info would be greatly appreciated.

  Andras



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: UNMAP command parameter list
  2014-11-07 23:30 UNMAP command parameter list Andras Kovacs
@ 2014-11-07 23:57 ` Elliott, Robert (Server Storage)
  2014-11-08 20:22   ` Andras Kovacs
  0 siblings, 1 reply; 8+ messages in thread
From: Elliott, Robert (Server Storage) @ 2014-11-07 23:57 UTC (permalink / raw)
  To: Andras Kovacs, linux-scsi@vger.kernel.org



> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Andras Kovacs
> Sent: Friday, 07 November, 2014 5:30 PM
> To: linux-scsi@vger.kernel.org
> Subject: UNMAP command parameter list
> 
> 
>   Hi all,
> 
>   I'm trying to see what parameters are passed to the UFS driver from the
> SCSI midlayer when an UNMAP command is issued. In the UFS driver I can see
> the 10 byte command itself in the unsigned char *cmnd field of the struct
> scsi_cmnd, and it tells me that the parameter list length is 24 bytes (an 8
> byte UNMAP Parameter List header followed by one 16 byte long UNMAP Block
> Descriptor), but I'm having trouble finding where this UNMAP Parameter List
> is. It doesn't seem to be in the cmnd[] byte array after the UNMAP
> command itself.
> 
>   Can anyone tell me where I can find the UNMAP Parameter List which
> belongs to a particular UNMAP command?
> 
>   Any and all info would be greatly appreciated.
> 
>   Andras

That is the data transferred for the command, not in the
command descriptor block itself.

Typical T10 terminology is:
* parameter list = data-out buffer (i.e., write data)
* parameter data = data-in buffer (i.e., read data)


---
Rob Elliott    HP Server Storage




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-07 23:57 ` Elliott, Robert (Server Storage)
@ 2014-11-08 20:22   ` Andras Kovacs
  2014-11-10 15:56     ` Andras Kovacs
  0 siblings, 1 reply; 8+ messages in thread
From: Andras Kovacs @ 2014-11-08 20:22 UTC (permalink / raw)
  To: linux-scsi

Elliott, Robert (Server Storage <Elliott <at> hp.com> writes:

> That is the data transferred for the command, not in the
> command descriptor block itself.

Thank you. Then I guess I'll find the Paramerer List in the struct
scsi_data_buffer sdb variable (within struct scsi_cmnd). Will check on Monday.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-08 20:22   ` Andras Kovacs
@ 2014-11-10 15:56     ` Andras Kovacs
  2014-11-10 16:44       ` Martin K. Petersen
  0 siblings, 1 reply; 8+ messages in thread
From: Andras Kovacs @ 2014-11-10 15:56 UTC (permalink / raw)
  To: linux-scsi

Andras Kovacs <akovacs <at> fixstars.com> writes:

> 
> Elliott, Robert (Server Storage <Elliott <at> hp.com> writes:
> 
> > That is the data transferred for the command, not in the
> > command descriptor block itself.
> 
> Thank you. Then I guess I'll find the Paramerer List in the struct
> scsi_data_buffer sdb variable (within struct scsi_cmnd). Will check on 
> Monday.

  I've looked into it, but struct scsi_data_buffer doesn't contain a byte
array (rather a struct sg_table variable and some housekeeping vars). So my
question is still: where can I find the Parameter List associated with a
particular UNMAP command?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-10 15:56     ` Andras Kovacs
@ 2014-11-10 16:44       ` Martin K. Petersen
  2014-11-10 17:40         ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Martin K. Petersen @ 2014-11-10 16:44 UTC (permalink / raw)
  To: Andras Kovacs; +Cc: linux-scsi

>>>>> "Andras" == Andras Kovacs <akovacs@fixstars.com> writes:

>> Thank you. Then I guess I'll find the Paramerer List in the struct
>> scsi_data_buffer sdb variable (within struct scsi_cmnd). Will check
>> on Monday.

Andras> I've looked into it, but struct scsi_data_buffer doesn't contain
Andras> a byte array (rather a struct sg_table variable and some
Andras> housekeeping vars). So my question is still: where can I find
Andras> the Parameter List associated with a particular UNMAP command?

You'll have to traverse scatterlist and extract the descriptor from
there. You can use scsi_for_each_sg() to walk the list.

If you only care about in-kernel discards it's pretty easy since we only
issue a single descriptor. If you want to support arbitrary block pc
UNMAP commands you'll have to be able to deal with multiple descriptors
across multiple scatterlist elements. But the accessor macro makes that
easy so I suggest you take that approach.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-10 16:44       ` Martin K. Petersen
@ 2014-11-10 17:40         ` Christoph Hellwig
  2014-11-10 17:52           ` Martin K. Petersen
  2014-11-10 18:10           ` Andras Kovacs
  0 siblings, 2 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-11-10 17:40 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Andras Kovacs, linux-scsi

On Mon, Nov 10, 2014 at 11:44:39AM -0500, Martin K. Petersen wrote:
> You'll have to traverse scatterlist and extract the descriptor from
> there. You can use scsi_for_each_sg() to walk the list.
> 
> If you only care about in-kernel discards it's pretty easy since we only
> issue a single descriptor. If you want to support arbitrary block pc
> UNMAP commands you'll have to be able to deal with multiple descriptors
> across multiple scatterlist elements. But the accessor macro makes that
> easy so I suggest you take that approach.

Note that if the hardware doesn't actually implement UNMAP and you have
to emulate something you're probably better off emulating WRITE SAME
(16) with the UNMAP bit, as the format is a lot easier to handle,
and it's much better specified to start with.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-10 17:40         ` Christoph Hellwig
@ 2014-11-10 17:52           ` Martin K. Petersen
  2014-11-10 18:10           ` Andras Kovacs
  1 sibling, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2014-11-10 17:52 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Martin K. Petersen, Andras Kovacs, linux-scsi

>>>>> "Christoph" == Christoph Hellwig <hch@infradead.org> writes:

Christoph> Note that if the hardware doesn't actually implement UNMAP
Christoph> and you have to emulate something you're probably better off
Christoph> emulating WRITE SAME (16) with the UNMAP bit, as the format
Christoph> is a lot easier to handle, and it's much better specified to
Christoph> start with.

Yup, absolutely!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: UNMAP command parameter list
  2014-11-10 17:40         ` Christoph Hellwig
  2014-11-10 17:52           ` Martin K. Petersen
@ 2014-11-10 18:10           ` Andras Kovacs
  1 sibling, 0 replies; 8+ messages in thread
From: Andras Kovacs @ 2014-11-10 18:10 UTC (permalink / raw)
  To: linux-scsi

Christoph Hellwig <hch <at> infradead.org> writes:

> 
> On Mon, Nov 10, 2014 at 11:44:39AM -0500, Martin K. Petersen wrote:
> > You'll have to traverse scatterlist and extract the descriptor from
> > there. You can use scsi_for_each_sg() to walk the list.

  Thank you; I'm working on it.

> > 
> > If you only care about in-kernel discards it's pretty easy since we only
> > issue a single descriptor. If you want to support arbitrary block pc
> > UNMAP commands you'll have to be able to deal with multiple descriptors
> > across multiple scatterlist elements. But the accessor macro makes that
> > easy so I suggest you take that approach.
> 
> Note that if the hardware doesn't actually implement UNMAP and you have
> to emulate something you're probably better off emulating WRITE SAME
> (16) with the UNMAP bit, as the format is a lot easier to handle,
> and it's much better specified to start with.

  Actually, my case is that the HW (at least in its current iteration)
doesn't support WRITE SAME but does support UNMAP. But it seems that the
discard option given to ext4 at mount time is "ineffective" in the sense of
not keeping up a high write transfer rate to the device (it looks like write
amplification is happening, something which discard -- and UNMAP -- ought to
preempt). So now I'm writing code to 'debug' the UNMAP commands which get
passed to the device.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-10 18:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 23:30 UNMAP command parameter list Andras Kovacs
2014-11-07 23:57 ` Elliott, Robert (Server Storage)
2014-11-08 20:22   ` Andras Kovacs
2014-11-10 15:56     ` Andras Kovacs
2014-11-10 16:44       ` Martin K. Petersen
2014-11-10 17:40         ` Christoph Hellwig
2014-11-10 17:52           ` Martin K. Petersen
2014-11-10 18:10           ` Andras Kovacs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox