mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Stephen Cameron <steve.cameron@hp.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.5.44-ac3, cciss, more scatter gather elements
Date: Fri, 25 Oct 2002 22:24:00 +0200	[thread overview]
Message-ID: <20021025202400.GG12628@suse.de> (raw)
In-Reply-To: <20021025135914.A1224@zuul.cca.cpqcorp.net>

On Fri, Oct 25 2002, Stephen Cameron wrote:
> 
> Add blk_rq_map_sg_one_by_one function to ll_rw_blk.c in order to allow a low 
> level driver to map scatter gather elements from the block subsystem one 
> at a time into device specific data structures instead of having to take 
> a copy of all of them all at once and then afterwards copy them into a device 
> specific format. 
> 
> To follow, a patch to the cciss driver using this interface which
> allows up to 256 scatter gather elements (current limit is 31). 

I have to say that I think this patch is ugly, and a complete duplicate
of existing code. This is always bad, especially in the case of
something not really straight forward (like blk_rq_map_sg()). A hack.

I can understand the need for something like this, for drivers that
can't use a struct scatterlist directly. I'd rather do this in a
different way, though.

__blk_rq_map(q, rq, sglist, callback)
{
	...
	/* do the mapping *.
	if (sglist) {
		sglist[nsegs].page = bvec->bv_page;
		...
	} else
		callback(q, bvec, nsegs);
}

blk_rq_map_rq(q, rq, sglist)
{
	return __blk_rq_map(q, rq, sglist, NULL);
}

blk_rq_map_callback(q, rq, callback)
{
	return __blk_rq_map(q, rq, NULL, callback);
}

Or use a cookie like you currently do.

Oh, and do try to follow the style. It's

	if (cond)
		foo();

not

	if (fond) foo();

-- 
Jens Axboe


  reply	other threads:[~2002-10-25 20:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25 19:59 Stephen Cameron
2002-10-25 20:24 ` Jens Axboe [this message]
2002-10-25 20:00 Stephen Cameron
2002-10-25 20:47 Cameron, Steve
2002-10-25 21:11 ` Jens Axboe
2002-10-25 21:24   ` Jens Axboe
2002-10-25 21:25     ` Jens Axboe
2002-10-25 21:31       ` Jens Axboe
2002-10-25 22:06 Cameron, Steve
2002-10-28 15:24 ` Jens Axboe
2002-10-28 23:10 Stephen Cameron
2002-10-29  7:28 ` Jens Axboe
2002-10-30 20:23 Stephen Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021025202400.GG12628@suse.de \
    --to=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.cameron@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome