linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Jeff Garzik <jeff@garzik.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	James.Bottomley@HansenPartnership.com, osd-dev@open-osd.org,
	Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH 3/3 v3] osdblk: a Linux block device for OSD objects
Date: Mon, 27 Apr 2009 20:24:34 +0200	[thread overview]
Message-ID: <20090427182434.GD4593@kernel.dk> (raw)
In-Reply-To: <49F5D66E.2040506@panasas.com>

On Mon, Apr 27 2009, Boaz Harrosh wrote:
> > +static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask)
> > +{
> > +	struct bio *tmp, *new_chain = NULL, *tail = NULL;
> > +
> > +	while (old_chain) {
> > +		tmp = bio_clone(old_chain, gfpmask);
> > +		if (!tmp)
> > +			goto err_out;
> > +
> > +		tmp->bi_next = NULL;
> > +		if (!new_chain)
> > +			new_chain = tail = tmp;
> > +		else {
> > +			tail->bi_next = tmp;
> > +			tail = tmp;
> > +		}
> > +
> > +		old_chain = old_chain->bi_next;
> > +	}
> > +
> > +	return new_chain;
> > +
> > +err_out:
> > +	bio_chain_put(new_chain);
> > +	return NULL;
> > +}
> > +
> 
> NOTE-TO-ME:
>   blk_bio_clone()

Note to Boaz - this is illegal, unless gfp_mask is GFP_ATOMIC (in which
case you should not pass it in). The only way to make this work is to:

1) Have a private bio pool, and
2) Make sure it has enough reserved entries to populate the chain, and
3) Ensure only a single caller at the time, or entries enough for the N
   users that are allowed. It has to be controlled either way, whether N
   is 1 or larger.

> > +static void osdblk_rq_fn(struct request_queue *q)
> > +{
> > +	struct osdblk_device *osdev = q->queuedata;
> > +	struct request *rq;
> > +	struct osdblk_request *orq;
> > +	struct osd_request *or;
> > +	struct bio *bio;
> > +	int do_write, do_flush;
> > +
> > +	while (1) {
> > +		/* peek at request from block layer */
> > +		rq = elv_next_request(q);
> > +		if (!rq)
> > +			break;
> > +
> > +		/* filter out block requests we don't understand */
> > +		if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) {
> > +			end_request(rq, 0);
> > +			continue;
> > +		}
> > +
> > +		/* deduce our operation (read, write, flush) */
> > +		/* I wish the block layer simplified cmd_type/cmd_flags/cmd[]
> > +		 * into a clearly defined set of RPC commands:
> > +		 * read, write, flush, scsi command, power mgmt req,
> > +		 * driver-specific, etc.
> > +		 */
> > +
> > +		do_flush = (rq->special == (void *) 0xdeadbeefUL);
> 
> That's for real? or it needs a "FIXME" next to it?
> 
> > +		do_write = (rq_data_dir(rq) == WRITE);
> > +
> > +		/* a bio clone to be passed down to OSD request */
> > +		bio = bio_chain_clone(rq->bio, GFP_ATOMIC);
> > +		if (!bio)
> > +			break;
> 
> does blk_barrier_rq() have a rq->bio?

It may or may not.

-- 
Jens Axboe


  reply	other threads:[~2009-04-27 18:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02  1:54 [PATCH] osdblk: a Linux block device for OSD objects Jeff Garzik
2009-04-02  2:05 ` Jeff Garzik
2009-04-02 12:26 ` Boaz Harrosh
2009-04-02 16:46   ` Jeff Garzik
2009-04-03  9:38   ` Jeff Garzik
2009-04-05 10:22     ` Boaz Harrosh
2009-04-03  1:32 ` James Bottomley
2009-04-03 10:14   ` Jeff Garzik
2009-04-03  9:49 ` Jens Axboe
2009-04-03  9:58   ` Jeff Garzik
2009-04-05 10:18     ` Boaz Harrosh
2009-04-08  1:29       ` Jeff Garzik
2009-04-08  5:45         ` Jens Axboe
2009-04-08  6:02           ` Jeff Garzik
2009-04-08  6:08             ` Jens Axboe
2009-04-07  7:26 ` Pavel Machek
2009-04-07 22:53 ` [PATCH v2] " Jeff Garzik
2009-04-10 11:48   ` [PATCH 1/3] block/blk-map.c: blk_rq_append_bio should ensure it's not appending a chain Jeff Garzik
2009-04-10 11:49     ` [PATCH 2/3] osd_initiator: support bio chains Jeff Garzik
2009-04-10 11:50       ` [PATCH 3/3 v3] osdblk: a Linux block device for OSD objects Jeff Garzik
2009-04-27 15:59         ` Boaz Harrosh
2009-04-27 18:24           ` Jens Axboe [this message]
2009-04-28  9:40             ` Boaz Harrosh
2009-04-27 16:02       ` [PATCH 2/3] osd_initiator: support bio chains Boaz Harrosh

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=20090427182434.GD4593@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=bharrosh@panasas.com \
    --cc=jeff@garzik.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).