qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
@ 2011-08-15 23:16 Devin Nakamura
  2011-08-16 16:22 ` Stefan Hajnoczi
  2011-08-23 12:38 ` Kevin Wolf
  0 siblings, 2 replies; 6+ messages in thread
From: Devin Nakamura @ 2011-08-15 23:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Devin Nakamura


Signed-off-by: Devin Nakamura <devin122@gmail.com>
---
 block/qed.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/qed.c b/block/qed.c
index 333f067..9a1e49c 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
  */
 static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
 {
+    s->file_size =  qed_start_of_cluster(s, s->file_size +
+                                         s->header.cluster_size - 1);
     uint64_t offset = s->file_size;
     s->file_size += n * s->header.cluster_size;
     return offset;
-- 
1.7.6.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
  2011-08-15 23:16 [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster Devin Nakamura
@ 2011-08-16 16:22 ` Stefan Hajnoczi
       [not found]   ` <CAJ1AwB5v8V-KMz7YK9xYuyXn6jWN+H23dXCn5EV1hsuS3iqgnQ@mail.gmail.com>
  2011-08-23 12:38 ` Kevin Wolf
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-08-16 16:22 UTC (permalink / raw)
  To: Devin Nakamura; +Cc: kwolf, qemu-devel

On Mon, Aug 15, 2011 at 07:16:10PM -0400, Devin Nakamura wrote:
> @@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
>   */
>  static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
>  {
> +    s->file_size =  qed_start_of_cluster(s, s->file_size +
> +                                         s->header.cluster_size - 1);

Why do you need this?  QED cluster aligns the file size on open.
file_size should always be cluster-aligned.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
       [not found]   ` <CAJ1AwB5v8V-KMz7YK9xYuyXn6jWN+H23dXCn5EV1hsuS3iqgnQ@mail.gmail.com>
@ 2011-08-16 18:03     ` Devin Nakamura
  0 siblings, 0 replies; 6+ messages in thread
From: Devin Nakamura @ 2011-08-16 18:03 UTC (permalink / raw)
  To: qemu-devel

On Tue, Aug 16, 2011 at 12:22 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Mon, Aug 15, 2011 at 07:16:10PM -0400, Devin Nakamura wrote:
>> @@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
>>   */
>>  static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
>>  {
>> +    s->file_size =  qed_start_of_cluster(s, s->file_size +
>> +                                         s->header.cluster_size - 1);
>
> Why do you need this?  QED cluster aligns the file size on open.
> file_size should always be cluster-aligned.
>
> Stefan
>
I was running into problems when I was doing in-place conversion from
qcow2. But I suppose I could cluster align the file offset when I open
the conversion target. I just seemed this way was safer.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
  2011-08-15 23:16 [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster Devin Nakamura
  2011-08-16 16:22 ` Stefan Hajnoczi
@ 2011-08-23 12:38 ` Kevin Wolf
  2011-08-25  9:33   ` Stefan Hajnoczi
  1 sibling, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2011-08-23 12:38 UTC (permalink / raw)
  To: Devin Nakamura; +Cc: qemu-devel, Stefan Hajnoczi

Am 16.08.2011 01:16, schrieb Devin Nakamura:
> Signed-off-by: Devin Nakamura <devin122@gmail.com>
> ---
>  block/qed.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/block/qed.c b/block/qed.c
> index 333f067..9a1e49c 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
>   */
>  static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
>  {
> +    s->file_size =  qed_start_of_cluster(s, s->file_size +
> +                                         s->header.cluster_size - 1);
>      uint64_t offset = s->file_size;
>      s->file_size += n * s->header.cluster_size;
>      return offset;

Stefan, Devin, have you come to a conclusion about this patch?

Kevin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
  2011-08-23 12:38 ` Kevin Wolf
@ 2011-08-25  9:33   ` Stefan Hajnoczi
  2011-08-25 22:14     ` Devin Nakamura
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-08-25  9:33 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Devin Nakamura, qemu-devel

On Tue, Aug 23, 2011 at 02:38:00PM +0200, Kevin Wolf wrote:
> Am 16.08.2011 01:16, schrieb Devin Nakamura:
> > Signed-off-by: Devin Nakamura <devin122@gmail.com>
> > ---
> >  block/qed.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/block/qed.c b/block/qed.c
> > index 333f067..9a1e49c 100644
> > --- a/block/qed.c
> > +++ b/block/qed.c
> > @@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
> >   */
> >  static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
> >  {
> > +    s->file_size =  qed_start_of_cluster(s, s->file_size +
> > +                                         s->header.cluster_size - 1);
> >      uint64_t offset = s->file_size;
> >      s->file_size += n * s->header.cluster_size;
> >      return offset;
> 
> Stefan, Devin, have you come to a conclusion about this patch?

Yes, I suggested keeping the current contraint that file_size is
cluster-aligned.

Devin, does that work for you?

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster
  2011-08-25  9:33   ` Stefan Hajnoczi
@ 2011-08-25 22:14     ` Devin Nakamura
  0 siblings, 0 replies; 6+ messages in thread
From: Devin Nakamura @ 2011-08-25 22:14 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel

Works fine for me

On Thu, Aug 25, 2011 at 5:33 AM, Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com> wrote:
> On Tue, Aug 23, 2011 at 02:38:00PM +0200, Kevin Wolf wrote:
>> Am 16.08.2011 01:16, schrieb Devin Nakamura:
>> > Signed-off-by: Devin Nakamura <devin122@gmail.com>
>> > ---
>> >  block/qed.c |    2 ++
>> >  1 files changed, 2 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/block/qed.c b/block/qed.c
>> > index 333f067..9a1e49c 100644
>> > --- a/block/qed.c
>> > +++ b/block/qed.c
>> > @@ -263,6 +263,8 @@ static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
>> >   */
>> >  static uint64_t qed_alloc_clusters(BDRVQEDState *s, unsigned int n)
>> >  {
>> > +    s->file_size =  qed_start_of_cluster(s, s->file_size +
>> > +                                         s->header.cluster_size - 1);
>> >      uint64_t offset = s->file_size;
>> >      s->file_size += n * s->header.cluster_size;
>> >      return offset;
>>
>> Stefan, Devin, have you come to a conclusion about this patch?
>
> Yes, I suggested keeping the current contraint that file_size is
> cluster-aligned.
>
> Devin, does that work for you?
>
> Stefan
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-25 22:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-15 23:16 [Qemu-devel] [PATCH] qed: make qed_alloc_clusters round up offset to nearest cluster Devin Nakamura
2011-08-16 16:22 ` Stefan Hajnoczi
     [not found]   ` <CAJ1AwB5v8V-KMz7YK9xYuyXn6jWN+H23dXCn5EV1hsuS3iqgnQ@mail.gmail.com>
2011-08-16 18:03     ` Devin Nakamura
2011-08-23 12:38 ` Kevin Wolf
2011-08-25  9:33   ` Stefan Hajnoczi
2011-08-25 22:14     ` Devin Nakamura

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).