qed: make qed_alloc_clusters round up offset to nearest cluster
PATCH 1/1 qed: make qed_alloc_clusters round up offset to nearest cluster
--- block/qed.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
block/qed.c +2 -0
@@ -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;
Signature · 1 line
1.7.6.rc1
block/qed.c static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n, · line 267
Quoted 6 lines · Devin Nakamura
block/qed.c +2
-0@@ -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
PATCH 1/1 qed: make qed_alloc_clusters round up offset to nearest cluster
In reply to a message not in the archiveQuoted 11 lines · Stefan Hajnoczi
block/qed.c static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n, · line 267
Quoted 6 lines · Devin Nakamura
block/qed.c +2
-0@@ -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_sizeshould always be cluster-aligned.
Quoted 2 lines
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.
Am 16.08.2011 01:16, schrieb Devin Nakamura:
Quoted 10 lines
Signed-off-by Devin Nakamura <[email protected]>--- block/qed.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)block/qed.c +0
-0
block/qed.c static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n, · line 270
Quoted 8 lines
block/qed.c +2
-0@@ -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
Quoted 6 lines · Kevin Wolf
Am 16.08.2011 01:16, schrieb Devin Nakamura:
Quoted 5 lines
Signed-off-by Devin Nakamura <[email protected]>--- block/qed.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Quoted 15 lines
block/qed.c static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n, · line 270
Quoted 13 lines
block/qed.c +2
-0@@ -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
Works fine for me
Quoted 30 lines · Stefan Hajnoczi
Quoted 6 lines · Kevin Wolf
Am 16.08.2011 01:16, schrieb Devin Nakamura:
Quoted 5 lines
Signed-off-by Devin Nakamura <[email protected]>---
block/qed.c | 2 ++1 files changed, 2 insertions(+), 0 deletions(-)Quoted 15 lines
block/qed.c static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n, · line 270
Quoted 13 lines
block/qed.c +2
-0@@ -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_sizeis cluster-aligned.Devin, does that work for you?
Stefan