[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] Is the use of bdrv_getlength() in parallels.c kosher? (was:
From: |
Markus Armbruster |
Subject: |
[Qemu-block] Is the use of bdrv_getlength() in parallels.c kosher? (was: Is the use of bdrv_getlength() in handle_aiocb_write_zeroes() kosher?) |
Date: |
Fri, 04 Aug 2017 14:31:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Same question for allocate_clusters() in parallels.c, commit 5a41e1f,
modified in commit ddd2ef2:
if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS)
{
bdrv_getlength() can fail. Does it do the right thing then? For what
it's worth, the comparison of its value is signed.
There's another one in parallels_open():
if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs),
PREALLOC_MODE_OFF, NULL) != 0) {
s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
}