Before the write() and read() system calls were removed from
the bsg driver (around lk 4.15) bsg supported multiple SCSI
requests being submitted in a single invocation. It did this
by passing an array of struct sg_io_v4 objects to the write()
whose third argument (the size the second argument poin
Only a smaller percentage of SCSI commands should require a sense
buffer. Allocate as needed and delete as soon as possible.
Signed-off-by: Douglas Gilbert
---
drivers/scsi/sg.c | 35 ++-
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi
Move code around so it has the basic ordering: open(), close(),
write(), read(), ioctl(), other system calls (e.g. mmap()),
support code and finally debug code. The change was to put the
write() associated code before the read() code. The write()
system call is associated with submitting SCSI comma
Typedefs for structure types are discouraged so those structures
that are private to the driver have had their typedefs removed.
This also means that most "camel" type variable names (i.e. mixed
case) have been removed.
Signed-off-by: Douglas Gilbert
---
drivers/scsi/sg.c | 396
In request sharing, the slave side (i.e. the WRITEr) usually needs
to wait for the master side to complete before the slave can
issue its WRITE (or any other data-out command). This small
optimisation allows the slave WRITE to be submitted directly after
the master side submits its command (e.g. a
Add request sharing which is invoked on a shared file
descriptor by using SGV4_FLAG_SHARE. The file share is
asymmetric: the master side is assumed to do data-in
command (e.g. READ) first, followed by the slave side
doing a data-out command (e.g. WRITE). The master side
may also set SG_FLAG_NO_DXFE
Add support for the sg v4 interface based on struct sg_io_v4 found
in include/uapi/linux/bsg.h and only previously supported by the
bsg driver. Add ioctl(SG_IOSUBMIT) and ioctl(SG_IORECEIVE) for
async (non-blocking) usage of the sg v4 interface. Do not accept
the v3 interface with these ioctls. Do
The existing ioctl(SG_GET_SCSI_ID) fills a object of type
struct sg_scsi_id whose last field is int unused[2]. Add
an anonymous union with u8 scsi_lun[8] sharing those last
8 bytes. This patch will place the current device's full
LUN in the scsi_lun array using T10's preferred LUN
format (i.e. an a
Rather than having a piece of paper recording which errno
values have been used for what, the author thought why not
place then in one table in the driver code.
As a guesstimate, over half the code in this driver is dedicated
to sanity checking and reporting errors. Those errors may come
from the
Add ioctl(SG_SET_GET_EXTENDED) together with its interface:
struct sg_extended_info which is 96 bytes long, only half
of which is currently used. The "SET_GET" component of the
name is to stress data flows towards and back from the ioctl.
That ioctl has three sections: one for getting and setting
Move user interface part of scsi/sg.h into the new header file:
include/uapi/scsi/sg.h . Since scsi/sg.h includes the new header,
other code including scsi/sg.h should not be impacted.
Signed-off-by: Douglas Gilbert
---
include/scsi/sg.h | 268 ++---
include/uapi
Wire up some more capabilities of ioctl(SG_SET_GET_EXTENDED). One
is the size of each internal scatter gather list element. This
defaults to 2^15 and was fixed in previous versions of this
driver. If the user provides a value, it must be a power of
2 (bytes) and no less than PAGE_SIZE.
sum_fd_dlen
This patchset extends the SCSI generic (sg) driver found in lk 5.2 .
The sg driver has a version number which is visible via an ioctl()
and is bumped from 3.5.36 to 4.0.12 by this patchset.
The additions and changes are described in some detail on this
long webpage:
http://sg.danny.cz/sg/sg_v40
Add the ability establish a share between any two open file
descriptors in the sg driver. Neither file descriptor can
already be part of a share. This fd share is used for two
features added and described in later patches: request
sharing and the "do_on_other" flag used when multiple
requests are i
Wire up some more capabilities of ioctl(SG_SET_GET_EXTENDED). One
is to use a LLD or block layer generated tag rather than the user
provided pack_id to track requests. Tags to the user space for
an async interface may be considered as work in progress as there
doesn't seem to be a safe mechanism to
The internal struct sg_comm_wr_t was added when the number of
arguments to sg_common_write() became excessive. Expand this idea
so multiple calls to sg_fetch_cmnd() can be deferred until a
scsi_request object is ready to receive the command. This saves
a 252 byte stack allocation on every submit pa
Replace SCSI_LOG_TIMEOUT macros with SG_LOG macros across the driver.
The definition of SG_LOG calls SCSI_LOG_TIMEOUT if scsi_device
pointer is non-zero, calls pr_info otherwise. Prints the thread id
if current is non-zero, -1 otherwise.
Also replace #if and #ifdef conditional compilations with
th
Add ioctl(SG_IOSUBMIT_V3) and ioctl(SG_IORECEIVE_V3). These ioctls
are meant to be (almost) drop-in replacements for the write()/read()
async version 3 interface. They only accept the version 3 interface.
See the webpage at: http://sg.danny.cz/sg/sg_v40.html
specifically the table in the section t
Add ioctl(SG_IOABORT) that acts as a front-end to
blk_abort_request() which is only called if the request
is "inflight". The request to abort is matched via its
pack_id and the scope of the search is the current
device.
That scope will be fine tuned in a later patch to being
either all file descri
Remove the fixed size array of 16 request elements per file descriptor
and replace with two linked lists (per fd). One list is for active
commands, the other list is a free list. sg_request objects are now
kept, available for re-use, until their owning file descriptor is
closed. The associated bloc
On Tue, 2019-05-21 at 17:49 -0700, James Smart wrote:
> Crashes in scsi_queue_rq or in dma_unmap_direct_sg during BFS when
> lpfc has lpfc_enable_bg=1.
>
> lpfc is setting the t10-dif and prot sg after scsi_add_host_with_dma()
> has been called. The scsi_host_set_prot() and scsi_host_set_guard()
>
21 matches
Mail list logo