On 5 May 2010 at 11:47, Mike Christie wrote: > On 05/03/2010 06:51 AM, Jack Z wrote: > > Hi group, > > > > I have been tracing the code related to sending PDUs from iscsi > > initiator (ver 2.0-871). > > > > And through some printk()s i realize that starting from > > iscsi_sw_tcp_pdu_init(), all the functions using scatterlist (struct > > scatterlist *sg) seem to use 4096 as the length (sg->length). > > > > But I was not able to trace down where this 4096 is initially assigned > > to sg->length... I searched through the code for "4096" and only two > > spots came up: ".sg_tablesize = 4096" in struct scsi_host_template > > iscsi_sw_tcp_sht and "#define ISCSI_TOTAL_CMDS_MAX 4096". But changing > > these two values did not affect the sg->length value, which was still > > 4096. > > > > I was guessing this 4096 had something to do with the fs block size > > and this value was somewhat from "struct scsi_data_buffer *sdb = > > scsi_out(task->sc);" in iscsi_sw_tcp_pdu_init()... but still don't > > have a clue about how and why iscsi initiator gets this value as the > > length for the scatterlist... > > > > Could anyone maybe explain a bit or point me to some relevant > > document? > > > The fs/block layer is going to send down some struct called a bio, which > has a mapping of pages to some sectors to read/write. The block layer's > elevator code is then going to try and make large IO requests by merging > bios. So if there was a bio to read sectors 0 - 7 into page0 and a bio > to read sectors 8 - 15 into page1, then they would be merged into the > same request to read sector 0 - 15. > > At some point this request is then sent to the scsi layer, which will > use some block layer helper to create a scatterlist from the pages in > the requests's bios. The sg->page pointer points to the first page in a > group of pages that are contiguous in memory, and sg->length is then the > total length in bytes of all those pages. So in my example, if the 2 > pages in each bio were next to each other then they could be merged into > 1 sg entry. This does not happen for iscsi_tcp though. In your case, you > see sg->lenth as at most 4096 because iscsi_tcp only supports 1 page per > sg entry and the page size on your arch is PAGE_SIZE=4096 (we set the > scsi_host_template->use_clustering flag to indicate that we only want > one page per sg entry btw). > > Next is where sg_tablesize comes into play. Here, we are setting it to > 4096 to indicate that at most we want 4096 entries on that scatterlist > that is made (4096 being the page size and sg_tablesize is just a > coincidence). So for us in your setup we can have at most 4096 sg > entries, with each entry having 4096 bytes. We could actually have a > smaller sg list, because there are other settings that limit the size of > the request like the sht->max_sectors.
I was wondering what the original poster was looking for: Increase the size? To my little understanding the S/G list are concurrent I/O operations sent within one SCSI command (in addition to tagged queuing?). I wonder which applications/filesystems are ever requesting S/G lists of that size. I doubt it. Ulrich -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
