Linux NFS development
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Peng Tao <bergwolf@gmail.com>
Cc: linuxnfs <linux-nfs@vger.kernel.org>, Benny Halevy <bhalevy@tonian.com>
Subject: Re: pnfs LD partial sector write
Date: Thu, 26 Jul 2012 18:44:28 +0300	[thread overview]
Message-ID: <501165DC.3050801@panasas.com> (raw)
In-Reply-To: <CA+a=Yy6LyrV944cSpr0k_tgyDzSwF9BGkS-_aq+X_em1WuPpBg@mail.gmail.com>

On 07/26/2012 06:30 PM, Peng Tao wrote:

> On Thu, Jul 26, 2012 at 10:30 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>> On 07/26/2012 04:57 PM, Peng Tao wrote:
>>
>>> On Thu, Jul 26, 2012 at 8:16 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>>>> On 07/26/2012 11:25 AM, Peng Tao wrote:
>>>>
>>>>> For these two sectors, I need to allocate two pages... Just look at
>>>>> struct bio_vec.
>>>>>
>>>>
>>>>
>>>> NO! I know all about bio_vecs
>>>>
>>>> You need 1024 bytes, and 2 x one entry BIOs which is a few bytes, where
>>>> did you get the "two pages" from?
>>>>
>>> What do you put int bio_vec->bv_page? Even if you just use 512 bytes
>>> of a page, it is still allocated page.
>>>
>>
>>
>> No!!
>>
>> You just use bio_map_kern or in one go blk_rq_map_kern() with any: kmalloc,
>> stack, or kernel pointer. And that's that. It will take what it will take.
>>
> First I should admit I don't know bio_map_kern() alike. Thanks for
> teaching me about them (see, here is your credit :)
> 
> Looking at them, I don't think it is proper to use them in block
> layout code, mainly because It is a layer violation. Searching for
> callers of io_map_kern/blk_rq_map_kern(), they are either block core
> code or device drivers. Clearly these interfaces are block layer
> internal APIs and file systems shouldn't touch them.
> 
> Therefore I still think I should stick with plain common
> bio_alloc/bio_add_page/submit_bio interfaces. Thanks for the
> suggestion.
> 


Crap no!!!

bio_kmalloc/bio_map_kern/submit_bio is just fine. Same exact layer.
same exact BIO API level.

You can mix and match bio_map_kern chained with any bio_add_page
and submit one chain or let the elevator chain them with plug unplug
they are all the same. 
	If you have pages - bio_add_page;
	Have pointers - bio_map_kern.
They are used all over libosd exofs ore scsi_lib and what not.
Any user of block layer, which is what block layout is!

Again some Credit

Boaz

> 
> Cheers,
> Tao



  reply	other threads:[~2012-07-26 15:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25  7:31 pnfs LD partial sector write Peng Tao
2012-07-25 10:28 ` Boaz Harrosh
2012-07-25 10:45   ` Boaz Harrosh
2012-07-25 14:43   ` Peng Tao
2012-07-25 20:29     ` Boaz Harrosh
2012-07-26  2:43       ` Peng Tao
2012-07-26  7:29         ` Boaz Harrosh
2012-07-26  8:25           ` Peng Tao
2012-07-26 12:16             ` Boaz Harrosh
2012-07-26 13:57               ` Peng Tao
2012-07-26 14:30                 ` Boaz Harrosh
2012-07-26 15:30                   ` Peng Tao
2012-07-26 15:44                     ` Boaz Harrosh [this message]
2012-07-26  7:47         ` Boaz Harrosh
2012-07-26  9:12           ` Peng Tao
2012-07-26 14:12             ` Boaz Harrosh
2012-07-26 15:07               ` Peng Tao
2012-07-26 16:00                 ` 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=501165DC.3050801@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=bergwolf@gmail.com \
    --cc=bhalevy@tonian.com \
    --cc=linux-nfs@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