mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-30 15:07:56 +00:00
btrfs-image: fix reading the super block on big metadata blocks
btrfs-image is assuming that every metadata block is the same size. The super is a special snowflake though. It's 4K even on 64K filesystems. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
617efb6bb8
commit
9c82132740
@ -506,7 +506,8 @@ static int flush_pending(struct metadump_struct *md, int done)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!md->data && size > 0) {
|
while (!md->data && size > 0) {
|
||||||
eb = read_tree_block(md->root, start, blocksize, 0);
|
u64 this_read = min(blocksize, size);
|
||||||
|
eb = read_tree_block(md->root, start, this_read, 0);
|
||||||
if (!eb) {
|
if (!eb) {
|
||||||
free(async->buffer);
|
free(async->buffer);
|
||||||
free(async);
|
free(async);
|
||||||
@ -516,9 +517,9 @@ static int flush_pending(struct metadump_struct *md, int done)
|
|||||||
}
|
}
|
||||||
copy_buffer(async->buffer + offset, eb);
|
copy_buffer(async->buffer + offset, eb);
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
start += blocksize;
|
start += this_read;
|
||||||
offset += blocksize;
|
offset += this_read;
|
||||||
size -= blocksize;
|
size -= this_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
md->pending_start = (u64)-1;
|
md->pending_start = (u64)-1;
|
||||||
|
Loading…
Reference in New Issue
Block a user