mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
fsdev: add IO throttle support to fsdev devices
This patchset adds the throttle support for the 9p-local driver. For now this functionality can be enabled only through qemu cli options. QMP interface and support to other drivers need further extensions. To make it simple for other 9p drivers, the throttle code has been put in separate files. Signed-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com> Reviewed-by: Alberto Garcia <berto@igalia.com> (pass extra NULL CoMutex * argument to qemu_co_queue_wait(), added options to qemu-options.hx, Greg Kurz) Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
4bae2b397f
commit
b8bbdb886e
9 changed files with 258 additions and 3 deletions
|
@ -1208,6 +1208,7 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
|
|||
{
|
||||
const char *sec_model = qemu_opt_get(opts, "security_model");
|
||||
const char *path = qemu_opt_get(opts, "path");
|
||||
Error *err = NULL;
|
||||
|
||||
if (!sec_model) {
|
||||
error_report("Security model not specified, local fs needs security model");
|
||||
|
@ -1236,6 +1237,13 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
|
|||
error_report("fsdev: No path specified");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fsdev_throttle_parse_opts(opts, &fse->fst, &err);
|
||||
if (err) {
|
||||
error_reportf_err(err, "Throttle configuration is not valid: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fse->path = g_strdup(path);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -3529,6 +3529,10 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp)
|
|||
error_setg(errp, "share path %s is not a directory", fse->path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->ctx.fst = &fse->fst;
|
||||
fsdev_throttle_init(s->ctx.fst);
|
||||
|
||||
v9fs_path_free(&path);
|
||||
|
||||
rc = 0;
|
||||
|
@ -3549,6 +3553,7 @@ void v9fs_device_unrealize_common(V9fsState *s, Error **errp)
|
|||
if (s->ops->cleanup) {
|
||||
s->ops->cleanup(&s->ctx);
|
||||
}
|
||||
fsdev_throttle_cleanup(s->ctx.fst);
|
||||
g_free(s->tag);
|
||||
g_free(s->ctx.fs_root);
|
||||
}
|
||||
|
|
|
@ -247,6 +247,7 @@ int coroutine_fn v9fs_co_pwritev(V9fsPDU *pdu, V9fsFidState *fidp,
|
|||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;
|
||||
}
|
||||
fsdev_co_throttle_request(s->ctx.fst, true, iov, iovcnt);
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
err = s->ops->pwritev(&s->ctx, &fidp->fs, iov, iovcnt, offset);
|
||||
|
@ -266,6 +267,7 @@ int coroutine_fn v9fs_co_preadv(V9fsPDU *pdu, V9fsFidState *fidp,
|
|||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;
|
||||
}
|
||||
fsdev_co_throttle_request(s->ctx.fst, false, iov, iovcnt);
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
err = s->ops->preadv(&s->ctx, &fidp->fs, iov, iovcnt, offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue