+void fill_buffer_pattern(struct thread_data *td, void *p, unsigned int len)
+{
+ fill_pattern(td, p, len, td->o.buffer_pattern, td->o.buffer_pattern_bytes);
+}
+
+void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len,
+ struct io_u *io_u, unsigned long seed, int use_seed)
+{
+ if (!td->o.verify_pattern_bytes) {
+ dprint(FD_VERIFY, "fill random bytes len=%u\n", len);
+
+ if (use_seed)
+ __fill_random_buf(p, len, seed);
+ else
+ io_u->rand_seed = fill_random_buf(&td->__verify_state, p, len);
+ return;
+ }
+
+ if (io_u->buf_filled_len >= len) {
+ dprint(FD_VERIFY, "using already filled verify pattern b=%d len=%u\n",
+ td->o.verify_pattern_bytes, len);
+ return;
+ }
+
+ fill_pattern(td, p, len, td->o.verify_pattern, td->o.verify_pattern_bytes);
+
+ io_u->buf_filled_len = len;
+}
+
+static unsigned int get_hdr_inc(struct thread_data *td, struct io_u *io_u)
+{
+ unsigned int hdr_inc;
+
+ hdr_inc = io_u->buflen;
+ if (td->o.verify_interval && td->o.verify_interval <= io_u->buflen)
+ hdr_inc = td->o.verify_interval;
+
+ return hdr_inc;
+}
+
+static void fill_pattern_headers(struct thread_data *td, struct io_u *io_u,
+ unsigned long seed, int use_seed)
+{
+ unsigned int hdr_inc, header_num;
+ struct verify_header *hdr;
+ void *p = io_u->buf;
+
+ fill_verify_pattern(td, p, io_u->buflen, io_u, seed, use_seed);
+
+ hdr_inc = get_hdr_inc(td, io_u);
+ header_num = 0;
+ for (; p < io_u->buf + io_u->buflen; p += hdr_inc) {
+ hdr = p;
+ populate_hdr(td, io_u, hdr, header_num, hdr_inc);
+ header_num++;
+ }
+}
+