linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@HansenPartnership.com, jens.axboe@oracle.com,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/3] block: unexport blk_rq_append_bio
Date: Thu, 12 Feb 2009 10:24:42 +0200	[thread overview]
Message-ID: <4993DCCA.8080508@panasas.com> (raw)
In-Reply-To: <20090212103112M.fujita.tomonori@lab.ntt.co.jp>

FUJITA Tomonori wrote:
> On Wed, 11 Feb 2009 19:55:31 +0200
> Boaz Harrosh <bharrosh@panasas.com> wrote:
> 
>>> Part of the problem, I think, is that a typical filesystem either works
>>> with pages (ext3) or bios (btrfs) and puts them in block at the top.
>>> Block then accumulates the pages to bios, elevates the bios into
>>> requests and spits those out to SCSI ... this is why we want to
>>> eliminate bio handlers from SCSI.
>>>
>> You are too fast for me, sorry, I did not get that: "... this is why" logical jump.
>> I thought we where getting read of scatter-gather handlers from SCSI. We never
>> had any bio handlers in scsi, did we?
>>
>>> Your problem is that you phrase your osd fs/pnfs in terms of bios, so
>>> then you need to emulate the block bio handlers internally (because
>>> you're bypassing block) in your ULD.  However, what we're saying is if
>>> you speak pages instead, you can utilise the standard block pc handlers,
>>> which are designed to speak pages, without reinventing the bio handling
>>> infrastructure.
>> I did not know I was reinventing the bio handling infrastructure, I thought
> 
> I think that we call something like the following reinventing the bio
> handling infrastructure:
> 
> static void _abort_unexecuted_bios(struct request *rq)
> {
> 	struct bio *bio;
> 
> 	while ((bio = rq->bio) != NULL) {
> 		rq->bio = bio->bi_next;
> 		bio_endio(bio, 0);
> 	}
> }
> 

No TOMO! The above is because I can start mapping a request even with simple map_kern
and then fail and do not execute the request. If so, when I do a put_request() with a
bio I'm leaking the bio. The above should be put inside put_request() so not
to leak bios, but until then It's here.

It has nothing to do with our discussion.

> 
>> I was using it with all available glory, and exported API. I let different users
> 
> include/blkdev.h says:
> 
> /*
>  * Temporary export, until SCSI gets fixed up.
>  */
> extern int blk_rq_append_bio(struct request_queue *q, struct request *rq,
> 			     struct bio *bio);
> 
> 
> blk_rq_append_bio is not an exported API. We finally fixed SCSI but
> you broke it again.
> 

Fine, but I have a very legitimate need, which is:

Scatter-Gather Memory information was collected in a bio. At
some stage I need to make it a request. How?

> 
>> collect their memory information inside a bio, then in one simple call
>> the bio is elevated to a request and the request is submitted, block_pc style.
>>
>> Actually I just started to code using blk_rq_map_user(), and setting of all
>> struct rq_map_data information, and that feels a little like bio code duplication.
>> Because I need a collection (link-list) of them. struct rq_map_data assumes linear memory
>> which I do not have. Also I will need that blk_rq_map_user() will append bios like the change
>> you proposed to blk_rq_map_kern(), I guess it is doable, only it's lots of more work.
>> (And that awful blk_rq_unmap_user() which forces me to know if I sent via map_usr or map_kern ...)
> 
> I think that having something like blk_rq_map_kern_page with James'
> extension is another option.
> 

That is a very good option. I will need a way to specify a page_max_count to pre-allocate
the right size bio, so no bio re-allocations occurs.

Should I send a proposal for this?

[And yet there is such an exported API at bio level why not just open-code above, Linux Kernel
 style]

> 
>> I have one question. If bio API is only to be used by block layer internal, why is it
>> exported at all? Seems a bio has nice API for collecting memory information and is used
> 
> As I wrote, you use API that should not be exported. And I really
> don't think that SCSI ULD needs to play with bio. As James wrote, you
> reinvent and duplicate some of the block layer. That's a design that
> we should avoid.
> 

And as I wrote, I do not! Show me where? There is not a single line of duplication. I'm serving
complex file systems with their crazy memory needs. I need some structure to hold 
scatter-gather information. The best API around that does just that, with nice stuff like
slab pools and pre-allocations, is readily available at bio level. What you are asking me
is to duplicate all that. So it is opposite of what you say, you are asking me to duplicate
code I'm trying to re-use block layer code.

> 
>> by all kind of block users like filesystems, DM, MD, data integrity and others. I would
>> not mind a:
>> 	struct requst *blk_pc_make_request(bio);
>> Of sorts, to make it official, same as generic_make_request() but for block_pc users.

TOMO James please answer my question.
What is bad with bio usage as a memory crier? Why can filesystems, diff-engines, DM, MD,
you name it, use a bio, only OSD cannot? what is the reason? You say duplication of code?
what code in OSD? which code is it duplicating?

Boaz

  reply	other threads:[~2009-02-12  8:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 16:23 [PATCH 0/3] remove scsi_req_map_sg FUJITA Tomonori
2008-12-13 16:23 ` [PATCH 1/3] " FUJITA Tomonori
2008-12-13 16:23   ` [PATCH 2/3] block: unexport blk_rq_append_bio FUJITA Tomonori
2008-12-13 16:23     ` [PATCH 3/3] block: unexport bio_add_pc_page FUJITA Tomonori
2009-02-10 17:43     ` [PATCH 2/3] block: unexport blk_rq_append_bio James Bottomley
2009-02-10 18:19       ` James Bottomley
2009-02-11  0:21         ` FUJITA Tomonori
2009-02-11  8:17         ` Boaz Harrosh
2009-02-11  8:19           ` Boaz Harrosh
2009-02-11  9:15           ` Boaz Harrosh
2009-02-11 14:32             ` FUJITA Tomonori
2009-02-11 14:52               ` Boaz Harrosh
2009-02-11 15:01                 ` FUJITA Tomonori
2009-02-11 15:07                   ` Boaz Harrosh
2009-02-11 15:21                     ` FUJITA Tomonori
2009-02-11 15:41                       ` Boaz Harrosh
2009-02-11 16:04                         ` FUJITA Tomonori
2009-02-11 16:30                           ` James Bottomley
2009-02-11 17:55                             ` Boaz Harrosh
2009-02-12  1:30                               ` FUJITA Tomonori
2009-02-12  8:24                                 ` Boaz Harrosh [this message]
2009-02-12  8:28                                   ` [RFD] blk_rq_map_pages new API Boaz Harrosh
2009-02-12  9:19                                     ` Boaz Harrosh
2009-02-12  9:50                                       ` FUJITA Tomonori
2009-02-12 10:20                                         ` FUJITA Tomonori
2009-02-12 11:34                                           ` Boaz Harrosh
2009-02-12  8:41                                   ` [PATCH 2/3] block: unexport blk_rq_append_bio FUJITA Tomonori
2009-02-12  9:14                                     ` Boaz Harrosh
2009-02-12  9:50                                       ` FUJITA Tomonori
2009-02-12 12:19                                         ` [PATCH] [RFC] block: Don't let blk_put_request leak BIOs Boaz Harrosh
2009-02-12 13:49                                           ` Boaz Harrosh
2009-02-12 13:56                                             ` Boaz Harrosh
2009-02-12 17:27                                               ` [PATCH 1/2] " Boaz Harrosh
2009-02-12 17:30                                                 ` [PATCH 2/2] [RFC] libosd: Don't let osd abuse block internals, now that it's fixed Boaz Harrosh
2009-02-12 14:48                               ` [PATCH 2/3] block: unexport blk_rq_append_bio James Bottomley
2009-02-12 16:51                                 ` Boaz Harrosh
2008-12-15  7:28 ` [PATCH 0/3] remove scsi_req_map_sg Jens Axboe
2008-12-18  8:14   ` FUJITA Tomonori

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=4993DCCA.8080508@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.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).