summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-09-15 17:35:21 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-09-15 17:35:22 +0100
commitf2bcdc8de018d33ecf93da7a94f327956ecf76ea (patch)
tree6f5d4706132e29c5c95b8a829e6eb335c9657166 /include
parent16ab5046c4a607dddabc8086d4454293af59fc9f (diff)
parent0e4271b711a8ea766d29824c844e268b91ac3ae5 (diff)
downloadhqemu-f2bcdc8de018d33ecf93da7a94f327956ecf76ea.zip
hqemu-f2bcdc8de018d33ecf93da7a94f327956ecf76ea.tar.gz
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block patches # gpg: Signature made Fri 12 Sep 2014 16:09:43 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (22 commits) qcow2: Add falloc and full preallocation option raw-posix: Add falloc and full preallocation option qapi: introduce PreallocMode and new PreallocModes full and falloc. block: don't convert file size to sector size block: round up file size to nearest sector iotests: Send the correct fd in socket_scm_helper blockdev: Refuse to drive_del something added with blockdev-add block: extend BLOCK_IO_ERROR with reason string dataplane: fix virtio_blk_data_plane_create() op blocker error path qemu-iotests: Run 025 for Archipelago block driver block/archipelago: Implement bdrv_truncate() block: Make the block accounting functions operate on BlockAcctStats block: rename BlockAcctType members to start with BLOCK_ instead of BDRV_ block: Extract the block accounting code block: Extract the BlockAcctStats structure IDE: MMIO IDE device control should be little endian thread-pool: Drop unnecessary includes xen: Drop redundant bdrv_close() from pci_piix3_xen_ide_unplug() xen_disk: Plug memory leak on error path qemu-io: Clean up openfile() after commit 2e40134 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/block/accounting.h57
-rw-r--r--include/block/block.h20
-rw-r--r--include/block/block_int.h6
-rw-r--r--include/block/thread-pool.h6
-rw-r--r--include/hw/virtio/virtio-blk.h1
-rw-r--r--include/sysemu/dma.h1
6 files changed, 65 insertions, 26 deletions
diff --git a/include/block/accounting.h b/include/block/accounting.h
new file mode 100644
index 0000000..50b42b3
--- /dev/null
+++ b/include/block/accounting.h
@@ -0,0 +1,57 @@
+/*
+ * QEMU System Emulator block accounting
+ *
+ * Copyright (c) 2011 Christoph Hellwig
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef BLOCK_ACCOUNTING_H
+#define BLOCK_ACCOUNTING_H
+
+#include <stdint.h>
+
+#include "qemu/typedefs.h"
+
+enum BlockAcctType {
+ BLOCK_ACCT_READ,
+ BLOCK_ACCT_WRITE,
+ BLOCK_ACCT_FLUSH,
+ BLOCK_MAX_IOTYPE,
+};
+
+typedef struct BlockAcctStats {
+ uint64_t nr_bytes[BLOCK_MAX_IOTYPE];
+ uint64_t nr_ops[BLOCK_MAX_IOTYPE];
+ uint64_t total_time_ns[BLOCK_MAX_IOTYPE];
+ uint64_t wr_highest_sector;
+} BlockAcctStats;
+
+typedef struct BlockAcctCookie {
+ int64_t bytes;
+ int64_t start_time_ns;
+ enum BlockAcctType type;
+} BlockAcctCookie;
+
+void block_acct_start(BlockAcctStats *stats, BlockAcctCookie *cookie,
+ int64_t bytes, enum BlockAcctType type);
+void block_acct_done(BlockAcctStats *stats, BlockAcctCookie *cookie);
+void block_acct_highest_sector(BlockAcctStats *stats, int64_t sector_num,
+ unsigned int nb_sectors);
+
+#endif
diff --git a/include/block/block.h b/include/block/block.h
index 8f4ad16..07d6d8e 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -5,6 +5,7 @@
#include "qemu-common.h"
#include "qemu/option.h"
#include "block/coroutine.h"
+#include "block/accounting.h"
#include "qapi/qmp/qobject.h"
#include "qapi-types.h"
@@ -485,23 +486,6 @@ void bdrv_op_block_all(BlockDriverState *bs, Error *reason);
void bdrv_op_unblock_all(BlockDriverState *bs, Error *reason);
bool bdrv_op_blocker_is_empty(BlockDriverState *bs);
-enum BlockAcctType {
- BDRV_ACCT_READ,
- BDRV_ACCT_WRITE,
- BDRV_ACCT_FLUSH,
- BDRV_MAX_IOTYPE,
-};
-
-typedef struct BlockAcctCookie {
- int64_t bytes;
- int64_t start_time_ns;
- enum BlockAcctType type;
-} BlockAcctCookie;
-
-void bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie,
- int64_t bytes, enum BlockAcctType type);
-void bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie);
-
typedef enum {
BLKDBG_L1_UPDATE,
@@ -591,4 +575,6 @@ void bdrv_io_plug(BlockDriverState *bs);
void bdrv_io_unplug(BlockDriverState *bs);
void bdrv_flush_io_queue(BlockDriverState *bs);
+BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
+
#endif
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 8a61215..8d86a6c 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -24,6 +24,7 @@
#ifndef BLOCK_INT_H
#define BLOCK_INT_H
+#include "block/accounting.h"
#include "block/block.h"
#include "qemu/option.h"
#include "qemu/queue.h"
@@ -359,10 +360,7 @@ struct BlockDriverState {
bool io_limits_enabled;
/* I/O stats (display with "info blockstats"). */
- uint64_t nr_bytes[BDRV_MAX_IOTYPE];
- uint64_t nr_ops[BDRV_MAX_IOTYPE];
- uint64_t total_time_ns[BDRV_MAX_IOTYPE];
- uint64_t wr_highest_sector;
+ BlockAcctStats stats;
/* I/O Limits */
BlockLimits bl;
diff --git a/include/block/thread-pool.h b/include/block/thread-pool.h
index 32afcdd..4723752 100644
--- a/include/block/thread-pool.h
+++ b/include/block/thread-pool.h
@@ -18,11 +18,7 @@
#ifndef QEMU_THREAD_POOL_H
#define QEMU_THREAD_POOL_H 1
-#include "qemu-common.h"
-#include "qemu/queue.h"
-#include "qemu/thread.h"
-#include "block/coroutine.h"
-#include "block/block_int.h"
+#include "block/block.h"
typedef int ThreadPoolFunc(void *opaque);
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index afb7b8d..cf61154 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -18,6 +18,7 @@
#include "hw/block/block.h"
#include "sysemu/iothread.h"
#include "block/block.h"
+#include "block/accounting.h"
#define TYPE_VIRTIO_BLK "virtio-blk-device"
#define VIRTIO_BLK(obj) \
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 00f21f3..73ff86d 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -15,6 +15,7 @@
#include "exec/address-spaces.h"
#include "hw/hw.h"
#include "block/block.h"
+#include "block/accounting.h"
#include "sysemu/kvm.h"
typedef struct ScatterGatherEntry ScatterGatherEntry;
OpenPOWER on IntegriCloud