On Tue, 29 May 2007, Christoph Hellwig wrote: > [Note that all scsi lldds should go to linux-scsi] I'll Cc linux-scsi next time. > > + sgpnt = cmd->request_buffer; > > + active = 1; > > + for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) { > > + if (active) { > > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > > + if (!kaddr) > > + return DID_ERROR << 16; > > + len = sgpnt->length; > > + if ((req_len + len) > buflen) { > > + active = 0; > > + len = buflen - req_len; > > + } > > + memcpy(kaddr + sgpnt->offset, buf + req_len, len); > > + kunmap_atomic(kaddr, KM_USER0); > > + act_len += len; > > + } > > + req_len += sgpnt->length; > > + } > > + cmd->resid = req_len - act_len; > > This looks very inefficient. Just set sg_tablesize of your driver > to 1 to avoid getting mutiple segments. The disadvantage of setting sg_tablesize = 1 is that the driver will get small requests (PAGE_SIZE) most of the time, which is very bad for performance. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) Geert.Uytterhoeven@xxxxxxxxxxx ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html