From: Kevin Wolf <kwolf@redhat.com>
To: Jun Li <junmuzi@gmail.com>
Cc: josh.durgin@inktank.com, juli@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com
Subject: Re: [Qemu-devel] qcow2: Can create qcow2 image format on rbd server
Date: Mon, 8 Dec 2014 15:49:57 +0100 [thread overview]
Message-ID: <20141208144957.GD3792@noname.str.redhat.com> (raw)
In-Reply-To: <20141208135039.GA2836@localhost.localdomain>
Am 08.12.2014 um 14:50 hat Jun Li geschrieben:
> On Mon, 12/08 11:07, Kevin Wolf wrote:
> > Am 05.12.2014 um 16:32 hat Jun Li geschrieben:
> > > Currently, qemu-img can not create qcow2 image format on rbd server. Analysis
> > > the code as followings:
> > > when create qcow2 format image:
> > > qcow2_create2
> > > bdrv_create_file(filename, opts, &local_err); --> Here will create a 0 size
> > > file(e.g: file1) on rbd server.
> > > ...
> > > ret = bdrv_pwrite(bs, 0, header, cluster_size); --> So here can not write
> > > qcow2 header into file1 due to the file1's length is 0. Seems
> > > qemu_rbd_aio_writev can not write beyond EOF.
> > > ...
> > >
> > > As above analysis, there are two methods to solve the above bz as followings:
> > > 1, When create file1, just create a fixed-size file1 on rbd server(not 0 size).
> >
> > This is not a solution. Even if you might be able to create an image
> > successfully, using qcow2 without a backend that allows the image file
> > to grow is bound to fail sooner or later.
> >
> > So yes, you'll want to extend the rbd block driver to grow the file
> > asynchronously when writing beyond EOF.
> >
>
> Hi Kevin,
>
> Although rbd_resize is synchronous, I just want to create a new child-thread
> to realize asynchronous(Maybe just like userspace aio: libaio) rbd_resize.
> Just like following:
>
> qemu_rbd_aio_writev()
> {
> if (BlockDriverState->file->growable == 1) {
> pthread_create(&thread_id, NULL, child_thread, NULL);
> }
>
> rbd_start_aio();
> }
>
> child_thread()
> {
> ...
> rbd_resize();
> rbd_start_aio();
> ...
> }
>
> Currently, seems do not have original asynchronous rbd_resize. Besides, rbd block
> driver do not support growable file. So I want to use above method to realize
> asynchronous rbd_resize() in our qemu level.
>
> What's your opinion?
Are you sure that the rbd libraries are thread-safe and can be used in
this way?
Kevin
next prev parent reply other threads:[~2014-12-08 14:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 15:32 [Qemu-devel] qcow2: Can create qcow2 image format on rbd server Jun Li
2014-12-05 17:01 ` Max Reitz
2014-12-06 11:21 ` Jun Li
2014-12-08 13:58 ` Jun Li
2014-12-09 3:52 ` Josh Durgin
2014-12-09 9:49 ` Stefan Hajnoczi
2014-12-10 1:57 ` Josh Durgin
2014-12-10 14:14 ` Jun Li
2014-12-08 10:07 ` Kevin Wolf
2014-12-08 13:50 ` Jun Li
2014-12-08 14:49 ` Kevin Wolf [this message]
2014-12-10 14:18 ` Jun Li
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=20141208144957.GD3792@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=josh.durgin@inktank.com \
--cc=juli@redhat.com \
--cc=junmuzi@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.