[Stgt-devel] About the cmd execution in a SCSI device

FUJITA Tomonori fujita.tomonori
Tue May 20 10:11:12 CEST 2008

On Mon, 19 May 2008 16:19:09 +0300
Erez Zilber <erezz at Voltaire.COM> wrote:

> Hi,
> I'm going over the code in bs_rdwr_request: the data is read/written
> from/to the device using pread64/pwrite64. I understand that it treats
> the device as a file and just reads/writes from/to it with some offset.
> What I don't understand is if the data is copied between user & kernel
> space. Eventually, it will go from tgt (user) to scsi-ml (kernel) somehow.

Yes, data is copied between user and kernel spaces, that is, we copy
data between an user-space buffer and page cache. We could improve
this area but there are still tons of things that I want to do before

> Another question is - where are scsi_get_in_buffer/scsi_get_out_buffer
> defined? I couldn't find it anywhere and googling it didn't help.

They are defined as macros. Check out scsi_cmnd.h. Pete complains
these macros are too complicated. I guess that he was right. ;) If
someone sends a patch to convert them to normal functions, I'm happy
to apply it.

More information about the stgt mailing list