From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxsD-0003tG-Ci for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:10:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZxs9-0000OA-51 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:10:29 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:38804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxs8-0000O0-Tf for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:10:25 -0400 Received: by wiclk2 with SMTP id lk2so15073080wic.1 for ; Thu, 10 Sep 2015 02:10:24 -0700 (PDT) Date: Thu, 10 Sep 2015 10:05:05 +0100 From: Stefan Hajnoczi Message-ID: <20150910090505.GC13094@stefanha-thinkpad.redhat.com> References: <1441699228-25767-1-git-send-email-den@openvz.org> <1441699228-25767-4-git-send-email-den@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441699228-25767-4-git-send-email-den@openvz.org> Subject: Re: [Qemu-devel] [PATCH 3/5] disk_deadlines: add disk-deadlines option per drive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, Raushaniya Maksudova , Markus Armbruster On Tue, Sep 08, 2015 at 11:00:26AM +0300, Denis V. Lunev wrote: > diff --git a/blockdev.c b/blockdev.c > index 6b48be6..6cd9c6e 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -361,6 +361,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, > ThrottleConfig cfg; > int snapshot = 0; > bool copy_on_read; > + bool disk_deadlines; > Error *error = NULL; > QemuOpts *opts; > const char *id; > @@ -394,6 +395,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, > ro = qemu_opt_get_bool(opts, "read-only", 0); > copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); > > + disk_deadlines = qdict_get_try_bool(bs_opts, "disk-deadlines", false); > + if (disk_deadlines) { > + qdict_del(bs_opts, "disk-deadlines"); qdict_del() should be unconditional so that -drive disk-deadlines=off works. qdict_del() is a nop if the key cannot be found in the dict, so it is always safe to call it. > + } > + > if ((buf = qemu_opt_get(opts, "discard")) != NULL) { > if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { > error_setg(errp, "invalid discard option"); > @@ -555,6 +561,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, > > bs->detect_zeroes = detect_zeroes; > > + disk_deadlines_init(&bs->stats.disk_deadlines, disk_deadlines); > + > bdrv_set_on_error(bs, on_read_error, on_write_error); > > /* disk I/O throttling */ > @@ -658,6 +666,10 @@ QemuOptsList qemu_legacy_drive_opts = { > .name = "file", > .type = QEMU_OPT_STRING, > .help = "file name", > + },{ > + .name = "disk-deadlines", > + .type = QEMU_OPT_BOOL, > + .help = "control of disk requests' time execution", It would be nice to mention that the guest will be paused: "pause guest if disk request timeout expires" > diff --git a/include/block/accounting.h b/include/block/accounting.h > index 4c406cf..4e2b345 100644 > --- a/include/block/accounting.h > +++ b/include/block/accounting.h > @@ -27,6 +27,7 @@ > #include > > #include "qemu/typedefs.h" > +#include "block/disk-deadlines.h" > > enum BlockAcctType { > BLOCK_ACCT_READ, > @@ -41,6 +42,7 @@ typedef struct BlockAcctStats { > uint64_t total_time_ns[BLOCK_MAX_IOTYPE]; > uint64_t merged[BLOCK_MAX_IOTYPE]; > uint64_t wr_highest_sector; > + DiskDeadlines disk_deadlines; I'm not sure that BlockAcctStats is the most appropriate place for DiskDeadlines. BlockAcctStats holds accounting information which can be queried on the QEMU monitor. It is for reporting disk statistics. Please add the DiskDeadlines field to BlockDriverState instead.