@@ -394,12 +394,12 @@ static QemuOptsList runtime_opts = {
},
{
.name = "readahead-size",
- .type = QEMU_OPT_NUMBER,
+ .type = QEMU_OPT_SIZE,
.help = "Set the readahead size in bytes",
},
{
.name = "page-cache-size",
- .type = QEMU_OPT_NUMBER,
+ .type = QEMU_OPT_SIZE,
.help = "Set the pagecache size in bytes",
},
{
@@ -557,7 +557,7 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options,
"if cache.direct = on");
goto fail;
}
- client->readahead = qemu_opt_get_number(opts, "readahead-size", 0);
+ client->readahead = qemu_opt_get_size(opts, "readahead-size", 0);
if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) {
warn_report("Truncating NFS readahead size to %d",
QEMU_NFS_MAX_READAHEAD_SIZE);
@@ -578,7 +578,7 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options,
"if cache.direct = on");
goto fail;
}
- client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0);
+ client->pagecache = qemu_opt_get_size(opts, "page-cache-size", 0);
if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) {
warn_report("Truncating NFS pagecache size to %d pages",
QEMU_NFS_MAX_PAGECACHE_SIZE);
The nfs block driver uses QEMU_OPT_NUMBER for these sizes. All other block drivers use QEMU_OPT_SIZE. Both are uint64_t, but QEMU_OPT_SIZE rejects negative numbers, while QEMU_OPT_NUMBER interprets them modulo 2^64. Switch the nfs block driver to QEMU_OPT_SIZE. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- block/nfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)