Re: [PATCH 1/2] scsi_transport_fc: FC pass through support via bsg interface - revised

FUJITA Tomonori
2008-10-14T13:35:23Z

On Tue, 14 Oct 2008 04:44:17 -0700
Seokmann Ju <seokmann.ju@qlogic.com> wrote:

> >> +static int
> >> +fc_service_handler(struct Scsi_Host *shost, struct fc_rport *rport,
> >> + struct request *req, struct request_queue *q)
> >> +{
> >> + int ret;
> >> + struct request *rsp = req->next_rq;
> >> +
> >> + if (!rsp) {
> >> + printk(KERN_ERR "ERROR: space for a FC service"
> >> + " response is missing\n");
> >> + return -EINVAL;
> >> + }
> >> +
> >> + if ((req->bio->bi_vcnt > FC_SERVICE_MAX_SG) ||
> >> + (rsp->bio->bi_vcnt > FC_SERVICE_MAX_SG)) {
> >> + printk(KERN_ERR "ERROR: a FC service"
> >> + " supports no more than %d SGs\n", FC_SERVICE_MAX_SG);
> >> + return -EINVAL;
> >> + }
> >
> > This doesn't look correct. bi_vcnt is not related with the number of
> > sg. You use scatter-gather for large data transfer. You don't need to
> > worry about bi_vcnt.
> I see...
> Is there is a way to check, then, how many SG entries the service
> needs before the blk_rq_map_sg()?

As I wrote in the previous mail, via blk_queue_max_hw_segments() and
blk_queue_max_phys_segments(), you can tell the block layer the number
of sg segments you can handle.