qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Christoph Hellwig <hch@lst.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Christoph Hellwig <chellwig@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] Re: block: format vs. protocol, and how they stack
Date: Mon, 21 Jun 2010 11:09:17 -0500	[thread overview]
Message-ID: <4C1F8EAD.3010804@codemonkey.ws> (raw)
In-Reply-To: <20100621160147.GA16112@lst.de>

On 06/21/2010 11:01 AM, Christoph Hellwig wrote:
> On Mon, Jun 21, 2010 at 10:37:37AM -0500, Anthony Liguori wrote:
>    
>> There's just a couple cases we should consider:
>>
>> [1] -blockdev format=raw,file=/dev/cdrom,id=blk1
>>      
>    
>> For [1], we just defaulting transport to file is would not give us the
>> same semantics we have today.  Is that desirable?
>>      
> By mentioning the host devices you're opening another can of worms here.
> The host devices are another special case which is a rather problematic.
> I think the best we can do is to eliminate the different protocols for
> the host devices and fold them into file.  For one the basic host
> device Blockdriver really doesn't make any sense to be different from
> file.  The only differences are:
>
>   - host_device sets the no_zero_init flag.  This is something we could easily
>     do per-instance with an S_ISCHR || S_ISBLK check in the right place
>   - host_device has a different ->create method.  Instead of truncating
>     the file to the image size it does an llseek to figure if the new
>     size fits.  Again, this could be one method with an S_ISCHR || S_ISBLK
>     block check.  (and btw, the llseek seems to be wrong for some weirded
>     unix variants, compare to raw_getlength).
>   - host_device implements the ioctl and aio_ioctl methods.  We'll need
>     them for file anyway once my discard support lands.
>
> Now what's more interesting than the plain host_device are the magic
> cdrom and floppy devices.  These offer bdrv_is_inserted /
> bdrv_media_changed / bdrv_eject eject methods, and once it a while do
> some magic in bdrv_open.  We could easily key those off with a small
> host_device_operations structure inside raw-posix.c (which should be
> rename file-posix.c these days).  That would make the whole model a
> lot more consistent, and we could get rid of all the device probing
> special casing in the block layer which, which is a complete mess
> due to the Windows vs Unix differences.
>    

I fully agree here.  The result would be a much cleaner distinction 
between format and transport once you get rid of the host device stuff.

>> [2] -blockdev format=vvfat,file=/path/to/directory,id=blk1
>>
>>
>> It's not clear to me why [2] should be transport=vvfat.  vvfat really
>> isn't a transport.
>>      
> Well, it's a wart if you want to be exact.  But in the above model
> it's a clearly a transport.  It does not take an arbitrary BlockDriver
> on the layer below it but implements it's own I/O methods not using the
> qemu block layer - it maps from an image file the filesystem namespace.
> Similar to file connects to a file on the local system and nbd/http
> connects an image on a remote system.
>
>    
>> What about things like blkdebug and if we had
>> something like a ramdisk?
>>      
> A ramdisk again is a transport into a file that's purely in-memory.
> You can trivially run any format we have ontop of it.
>
> blkdebug in it's current form is a trivial image format, just like raw
> in the above terminology.  It takes an arbitrary qemu BlockDriver as
> input and then stacks on top.
>
> Think of a protocol/transport as the thing that implements the lowest
> layer of the qemu block I/O stack which then maps to native I/O methods.
>    

Yes, we're back to the whole discussion of leaf vs. non-leaf nodes.  The 
fundamental question is, why make this distinction visible to the user?  
Why does the user care if something is a leaf vs. a non-leaf node?

Regards,

Anthony Liguori

  reply	other threads:[~2010-06-21 16:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18 12:59 [Qemu-devel] block: format vs. protocol, and how they stack Markus Armbruster
2010-06-20 10:51 ` [Qemu-devel] " Avi Kivity
2010-06-21  7:00   ` Markus Armbruster
2010-06-22 16:46     ` Jamie Lokier
2010-06-21  8:19   ` Kevin Wolf
2010-06-21 13:09     ` Anthony Liguori
2010-06-21 13:30       ` Kevin Wolf
2010-06-21 13:37         ` Anthony Liguori
2010-06-21 14:01           ` Kevin Wolf
2010-06-21 14:51             ` Anthony Liguori
2010-06-21 14:52               ` Anthony Liguori
2010-06-21 15:00               ` Christoph Hellwig
2010-06-21 15:22                 ` Paul Brook
2010-06-21 15:37                 ` Anthony Liguori
2010-06-21 16:01                   ` Christoph Hellwig
2010-06-21 16:09                     ` Anthony Liguori [this message]
2010-06-21 16:36                     ` Markus Armbruster
2010-06-21 16:21                 ` Markus Armbruster
2010-06-22  8:32                   ` Kevin Wolf
2010-06-22 14:24                     ` Markus Armbruster
2010-06-28 10:28                   ` Christoph Hellwig
2010-06-22 16:30                 ` Jamie Lokier
2010-06-21 15:34             ` Anthony Liguori
2010-06-22  8:10               ` Kevin Wolf
2010-06-22 12:39                 ` Anthony Liguori
2010-06-22 12:57                   ` Kevin Wolf
2010-06-22 13:07                     ` Anthony Liguori
2010-06-21 15:56             ` Markus Armbruster
2010-06-22  8:22               ` Kevin Wolf
2010-06-22 16:40                 ` Jamie Lokier
2010-06-22 16:56                   ` Daniel P. Berrange

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=4C1F8EAD.3010804@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=chellwig@redhat.com \
    --cc=hch@lst.de \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.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).