[stgt] How to set device parameters?

juergen.kadidlo at exasol.com juergen.kadidlo at exasol.com
Thu Feb 4 10:39:09 CET 2010

FUJITA Tomonori schrieb:
> On Wed, 03 Feb 2010 18:06:55 +0100
> juergen.kadidlo at exasol.com wrote:
>>  I'm trying to write a driver for a new type of iSCSI target and I'm 
>> using "bs_rdwr.c" as a reference. However, there are some things that 
>> are pretty unclear to me, and one of them is: how are parameters like 
>> sector-size and number of sectors of a device determined? I could not 
>> find code that queries these parameters from the target-device. And 
>> tgtadm doesn't seem to support such params. However, there is not much 
>> documentation, so I'm not sure about that...
>> To be more precise: assuming that I want to use a file as a target, how 
>> can I specify the sector-size and number of sectors/bytes?
> I'm not sure what exactly you want to try. What is 'your anew type of
> iSCSI target'?
> Probably 'bs_rdwr.c' is a wrong reference for you. It just does I/Os
> via system calls. There is not much SCSI stuff there.
That's not easy to explain... you may call it a "Software SAN". It has 
it's own interface and needs another daemon to talk to it, so it's not 
possible to access it via a classic linux device file. I'd like to make 
it accessible via iSCSI by writing a new driver (or backing-store, not 
sure how you call it) that handles read/write/open/close requests by 
talking to to that daemon through its native interface... That's why 
I've chosen "bs_rdwr.c" as a reference. I thought it would be sufficient 
to replace the functions there and use it as a 
driver/backing-store/device-type. But maybe I didn't understand tgt's 
architecture right... any help or documentation would be greatly 
> The device size (the number of sectors) is stored in struct
> scsi_lu. The sector size depends on what device type you want to
> use. If you are trying something with disk (sbc), then the following
> patch might be useful for you:
> http://lists.wpkg.org/pipermail/stgt/2009-December/003469.html
So, in order to set the correct sector-size I have to apply that patch 
and start "tgtd" manually? I thought that "tgtd" is only started by 
"tgt-admin"!? And what about the number of sectors of a device? I mean, 
if a SCSI READ_CAPACITY command comes in, the device's sector-size and 
number of sectors have to be determined somehow! I've looked at the 
code, but couldn't find an explanation...

After reading the patch description, I also wonder how to select the 
type of device or driver. The "tgt-admin" man-page doesn't describe how 
to choose between e.g. bs_rdwr, bs_ssc, bs_sg etc...


To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list