summaryrefslogtreecommitdiff
path: root/verify.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-11-10 20:34:00 -0700
committerJens Axboe <axboe@fb.com>2014-11-11 10:20:14 -0700
commitca09be4b1a8e97f0bca5cfbddb399899cf561eaa (patch)
tree8d6a05be208388915660246b50dd0f5032c79125 /verify.h
parentb37d19b50ceab74c3947dd1685616e21b8638c95 (diff)
downloadfio-ca09be4b1a8e97f0bca5cfbddb399899cf561eaa.tar.gz
fio-ca09be4b1a8e97f0bca5cfbddb399899cf561eaa.tar.bz2
Add support for verify triggers and verify state saving
This allows you to (for instance) instantly terminate a verify write workload, and then later that everything was written correctly up to that very point. This can be useful for testing powercut scenarios, which is often problematic on storage devices. The trigger part is a file based notification scheme, similar to what is provided for the status dumps. When triggered, fio will exit immediately and write the verify state safely to disk. A trigger can be accompanied by a trigger command. Say you wanted to test powercut safety, the trigger could be something that immediately cut power to the machine. The verify state is either saved locally (if run locally), or saved over the network if run in client/server mode. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'verify.h')
-rw-r--r--verify.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/verify.h b/verify.h
index bb3fd492..3e52f9c1 100644
--- a/verify.h
+++ b/verify.h
@@ -88,4 +88,60 @@ extern void fio_verify_init(struct thread_data *td);
extern int verify_async_init(struct thread_data *);
extern void verify_async_exit(struct thread_data *);
+struct thread_rand_state {
+ uint32_t s[4];
+};
+
+/*
+ * For dumping current write state
+ */
+struct thread_io_list {
+ uint64_t no_comps;
+ uint64_t depth;
+ uint64_t numberio;
+ uint64_t index;
+ struct thread_rand_state rand;
+ uint8_t name[64];
+ uint64_t offsets[0];
+};
+
+struct all_io_list {
+ uint64_t threads;
+ struct thread_io_list state[0];
+};
+
+#define VSTATE_HDR_VERSION 0x01
+
+struct verify_state_hdr {
+ uint64_t version;
+ uint64_t size;
+ uint64_t crc;
+};
+
+#define IO_LIST_ALL 0xffffffff
+extern struct all_io_list *get_all_io_list(int, size_t *);
+extern void __verify_save_state(struct all_io_list *, const char *);
+extern void verify_save_state(void);
+extern int verify_load_state(struct thread_data *, const char *);
+extern void verify_free_state(struct thread_data *);
+extern int verify_state_should_stop(struct thread_data *, struct io_u *);
+extern void verify_convert_assign_state(struct thread_data *, struct thread_io_list *);
+extern int verify_state_hdr(struct verify_state_hdr *, struct thread_io_list *);
+
+static inline size_t thread_io_list_sz(struct thread_io_list *s)
+{
+ return sizeof(*s) + le64_to_cpu(s->depth) * sizeof(uint64_t);
+}
+
+static inline struct thread_io_list *io_list_next(struct thread_io_list *s)
+{
+ return (void *) s + thread_io_list_sz(s);
+}
+
+static inline void verify_state_gen_name(char *out, const char *name,
+ const char *prefix, int num)
+{
+ sprintf(out, "%s-%s-%d-verify.state", prefix, name, num);
+}
+
#endif