Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 1 | /* |
| 2 | * IO verification helpers |
| 3 | */ |
| 4 | #include <unistd.h> |
| 5 | #include <fcntl.h> |
| 6 | #include <string.h> |
Jens Axboe | 97af62c | 2007-05-22 11:12:13 +0200 | [diff] [blame] | 7 | #include <assert.h> |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 8 | |
| 9 | #include "fio.h" |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 10 | |
Jens Axboe | eef6eea | 2007-07-30 12:27:58 +0200 | [diff] [blame] | 11 | #include "crc/md5.h" |
| 12 | #include "crc/crc64.h" |
| 13 | #include "crc/crc32.h" |
| 14 | #include "crc/crc16.h" |
| 15 | #include "crc/crc7.h" |
| 16 | #include "crc/sha256.h" |
| 17 | #include "crc/sha512.h" |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 18 | |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 19 | static void fill_random_bytes(struct thread_data *td, void *p, unsigned int len) |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 20 | { |
| 21 | unsigned int todo; |
Jens Axboe | 4c5946c | 2007-07-26 11:55:10 +0200 | [diff] [blame] | 22 | int r; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 23 | |
| 24 | while (len) { |
Jens Axboe | 4c5946c | 2007-07-26 11:55:10 +0200 | [diff] [blame] | 25 | r = os_random_long(&td->verify_state); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * lrand48_r seems to be broken and only fill the bottom |
| 29 | * 32-bits, even on 64-bit archs with 64-bit longs |
| 30 | */ |
| 31 | todo = sizeof(r); |
| 32 | if (todo > len) |
| 33 | todo = len; |
| 34 | |
| 35 | memcpy(p, &r, todo); |
| 36 | |
| 37 | len -= todo; |
| 38 | p += todo; |
| 39 | } |
| 40 | } |
| 41 | |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 42 | static void fill_pattern(struct thread_data *td, void *p, unsigned int len) |
| 43 | { |
| 44 | switch (td->o.verify_pattern_bytes) { |
| 45 | case 0: |
| 46 | fill_random_bytes(td, p, len); |
| 47 | break; |
| 48 | case 1: |
| 49 | memset(p, td->o.verify_pattern, len); |
| 50 | break; |
| 51 | case 2: |
| 52 | case 3: |
| 53 | case 4: { |
| 54 | unsigned int pattern = td->o.verify_pattern; |
| 55 | unsigned int i = 0; |
| 56 | unsigned char c1, c2, c3, c4; |
| 57 | unsigned char *b = p; |
| 58 | |
| 59 | c1 = pattern & 0xff; |
| 60 | pattern >>= 8; |
| 61 | c2 = pattern & 0xff; |
| 62 | pattern >>= 8; |
| 63 | c3 = pattern & 0xff; |
| 64 | pattern >>= 8; |
| 65 | c4 = pattern & 0xff; |
| 66 | |
| 67 | while (i < len) { |
| 68 | b[i++] = c1; |
| 69 | if (i == len) |
| 70 | break; |
| 71 | b[i++] = c2; |
| 72 | if (td->o.verify_pattern_bytes == 2 || i == len) |
| 73 | continue; |
| 74 | b[i++] = c3; |
| 75 | if (td->o.verify_pattern_bytes == 3 || i == len) |
| 76 | continue; |
| 77 | b[i++] = c4; |
| 78 | } |
| 79 | break; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
Jens Axboe | 4764aec | 2007-08-23 09:03:38 +0200 | [diff] [blame] | 84 | static void memswp(void *buf1, void *buf2, unsigned int len) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 85 | { |
Shawn Lewis | dee6de7 | 2007-08-02 22:17:52 +0200 | [diff] [blame] | 86 | char swap[200]; |
| 87 | |
| 88 | assert(len <= sizeof(swap)); |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 89 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 90 | memcpy(&swap, buf1, len); |
| 91 | memcpy(buf1, buf2, len); |
| 92 | memcpy(buf2, &swap, len); |
| 93 | } |
| 94 | |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 95 | static void hexdump(void *buffer, int len) |
| 96 | { |
| 97 | unsigned char *p = buffer; |
| 98 | int i; |
| 99 | |
| 100 | for (i = 0; i < len; i++) |
Jens Axboe | 6d86144 | 2007-03-15 09:22:23 +0100 | [diff] [blame] | 101 | log_info("%02x", p[i]); |
| 102 | log_info("\n"); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 103 | } |
| 104 | |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 105 | /* |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 106 | * Prepare for seperation of verify_header and checksum header |
| 107 | */ |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 108 | static inline unsigned int __hdr_size(int verify_type) |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 109 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 110 | unsigned int len; |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 111 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 112 | switch (verify_type) { |
| 113 | case VERIFY_NONE: |
| 114 | case VERIFY_NULL: |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 115 | case VERIFY_PATTERN: |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 116 | len = 0; |
| 117 | break; |
| 118 | case VERIFY_MD5: |
| 119 | len = sizeof(struct vhdr_md5); |
| 120 | break; |
| 121 | case VERIFY_CRC64: |
| 122 | len = sizeof(struct vhdr_crc64); |
| 123 | break; |
| 124 | case VERIFY_CRC32: |
| 125 | len = sizeof(struct vhdr_crc32); |
| 126 | break; |
| 127 | case VERIFY_CRC16: |
| 128 | len = sizeof(struct vhdr_crc16); |
| 129 | break; |
| 130 | case VERIFY_CRC7: |
| 131 | len = sizeof(struct vhdr_crc7); |
| 132 | break; |
| 133 | case VERIFY_SHA256: |
| 134 | len = sizeof(struct vhdr_sha256); |
| 135 | break; |
| 136 | case VERIFY_SHA512: |
| 137 | len = sizeof(struct vhdr_sha512); |
| 138 | break; |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 139 | case VERIFY_META: |
| 140 | len = sizeof(struct vhdr_meta); |
| 141 | break; |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 142 | default: |
| 143 | log_err("fio: unknown verify header!\n"); |
| 144 | assert(0); |
| 145 | } |
| 146 | |
| 147 | return len + sizeof(struct verify_header); |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | static inline unsigned int hdr_size(struct verify_header *hdr) |
| 151 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 152 | return __hdr_size(hdr->verify_type); |
| 153 | } |
| 154 | |
| 155 | static void *hdr_priv(struct verify_header *hdr) |
| 156 | { |
| 157 | void *priv = hdr; |
| 158 | |
| 159 | return priv + sizeof(struct verify_header); |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | /* |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 163 | * Return data area 'header_num' |
| 164 | */ |
| 165 | static inline void *io_u_verify_off(struct verify_header *hdr, |
| 166 | struct io_u *io_u, |
| 167 | unsigned char header_num) |
| 168 | { |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 169 | return io_u->buf + header_num * hdr->len + hdr_size(hdr); |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 170 | } |
| 171 | |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 172 | static int verify_io_u_meta(struct verify_header *hdr, struct thread_data *td, |
| 173 | struct io_u *io_u, unsigned int header_num) |
| 174 | { |
| 175 | struct vhdr_meta *vh = hdr_priv(hdr); |
| 176 | |
| 177 | if (vh->offset != io_u->offset + header_num * td->o.verify_interval) { |
| 178 | log_err("meta: verify failed at %llu/%u\n", |
| 179 | io_u->offset + header_num * hdr->len, |
| 180 | hdr->len); |
| 181 | return 1; |
| 182 | } |
| 183 | |
| 184 | return 0; |
| 185 | } |
| 186 | |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 187 | static int verify_io_u_sha512(struct verify_header *hdr, struct io_u *io_u, |
| 188 | unsigned int header_num) |
| 189 | { |
| 190 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 191 | struct vhdr_sha512 *vh = hdr_priv(hdr); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 192 | uint8_t sha512[128]; |
| 193 | struct sha512_ctx sha512_ctx = { |
| 194 | .buf = sha512, |
| 195 | }; |
| 196 | |
| 197 | sha512_init(&sha512_ctx); |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 198 | sha512_update(&sha512_ctx, p, hdr->len - hdr_size(hdr)); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 199 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 200 | if (memcmp(vh->sha512, sha512_ctx.buf, sizeof(sha512))) { |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 201 | log_err("sha512: verify failed at %llu/%u\n", |
| 202 | io_u->offset + header_num * hdr->len, |
| 203 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 204 | hexdump(vh->sha512, sizeof(vh->sha512)); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 205 | hexdump(sha512_ctx.buf, sizeof(sha512)); |
| 206 | return 1; |
| 207 | } |
| 208 | |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | static int verify_io_u_sha256(struct verify_header *hdr, struct io_u *io_u, |
| 213 | unsigned int header_num) |
| 214 | { |
| 215 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 216 | struct vhdr_sha256 *vh = hdr_priv(hdr); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 217 | uint8_t sha256[128]; |
| 218 | struct sha256_ctx sha256_ctx = { |
| 219 | .buf = sha256, |
| 220 | }; |
| 221 | |
| 222 | sha256_init(&sha256_ctx); |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 223 | sha256_update(&sha256_ctx, p, hdr->len - hdr_size(hdr)); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 224 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 225 | if (memcmp(vh->sha256, sha256_ctx.buf, sizeof(sha256))) { |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 226 | log_err("sha256: verify failed at %llu/%u\n", |
| 227 | io_u->offset + header_num * hdr->len, |
| 228 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 229 | hexdump(vh->sha256, sizeof(vh->sha256)); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 230 | hexdump(sha256_ctx.buf, sizeof(sha256)); |
| 231 | return 1; |
| 232 | } |
| 233 | |
| 234 | return 0; |
| 235 | } |
| 236 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 237 | static int verify_io_u_crc7(struct verify_header *hdr, struct io_u *io_u, |
| 238 | unsigned char header_num) |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 239 | { |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 240 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 241 | struct vhdr_crc7 *vh = hdr_priv(hdr); |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 242 | unsigned char c; |
| 243 | |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 244 | c = crc7(p, hdr->len - hdr_size(hdr)); |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 245 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 246 | if (c != vh->crc7) { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 247 | log_err("crc7: verify failed at %llu/%u\n", |
| 248 | io_u->offset + header_num * hdr->len, |
| 249 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 250 | log_err("crc7: wanted %x, got %x\n", vh->crc7, c); |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 251 | return 1; |
| 252 | } |
| 253 | |
| 254 | return 0; |
| 255 | } |
| 256 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 257 | static int verify_io_u_crc16(struct verify_header *hdr, struct io_u *io_u, |
| 258 | unsigned int header_num) |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 259 | { |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 260 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 261 | struct vhdr_crc16 *vh = hdr_priv(hdr); |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 262 | unsigned short c; |
| 263 | |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 264 | c = crc16(p, hdr->len - hdr_size(hdr)); |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 265 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 266 | if (c != vh->crc16) { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 267 | log_err("crc16: verify failed at %llu/%u\n", |
| 268 | io_u->offset + header_num * hdr->len, |
| 269 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 270 | log_err("crc16: wanted %x, got %x\n", vh->crc16, c); |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 271 | return 1; |
| 272 | } |
| 273 | |
| 274 | return 0; |
| 275 | } |
| 276 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 277 | static int verify_io_u_crc64(struct verify_header *hdr, struct io_u *io_u, |
| 278 | unsigned int header_num) |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 279 | { |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 280 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 281 | struct vhdr_crc64 *vh = hdr_priv(hdr); |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 282 | unsigned long long c; |
| 283 | |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 284 | c = crc64(p, hdr->len - hdr_size(hdr)); |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 285 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 286 | if (c != vh->crc64) { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 287 | log_err("crc64: verify failed at %llu/%u\n", |
| 288 | io_u->offset + header_num * hdr->len, |
| 289 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 290 | log_err("crc64: wanted %llx, got %llx\n", (unsigned long long) vh->crc64, c); |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 291 | return 1; |
| 292 | } |
| 293 | |
| 294 | return 0; |
| 295 | } |
| 296 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 297 | static int verify_io_u_crc32(struct verify_header *hdr, struct io_u *io_u, |
| 298 | unsigned int header_num) |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 299 | { |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 300 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 301 | struct vhdr_crc32 *vh = hdr_priv(hdr); |
| 302 | uint32_t c; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 303 | |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 304 | c = crc32(p, hdr->len - hdr_size(hdr)); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 305 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 306 | if (c != vh->crc32) { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 307 | log_err("crc32: verify failed at %llu/%u\n", |
| 308 | io_u->offset + header_num * hdr->len, |
| 309 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 310 | log_err("crc32: wanted %x, got %x\n", vh->crc32, c); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 311 | return 1; |
| 312 | } |
| 313 | |
| 314 | return 0; |
| 315 | } |
| 316 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 317 | static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u, |
| 318 | unsigned int header_num) |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 319 | { |
Jens Axboe | d9f2caf | 2007-07-28 21:22:03 +0200 | [diff] [blame] | 320 | void *p = io_u_verify_off(hdr, io_u, header_num); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 321 | struct vhdr_md5 *vh = hdr_priv(hdr); |
Jens Axboe | 8c43232 | 2007-07-27 13:16:24 +0200 | [diff] [blame] | 322 | uint32_t hash[MD5_HASH_WORDS]; |
| 323 | struct md5_ctx md5_ctx = { |
| 324 | .hash = hash, |
| 325 | }; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 326 | |
Jens Axboe | 61f821f | 2007-07-30 10:18:06 +0200 | [diff] [blame] | 327 | md5_init(&md5_ctx); |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 328 | md5_update(&md5_ctx, p, hdr->len - hdr_size(hdr)); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 329 | |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 330 | if (memcmp(vh->md5_digest, md5_ctx.hash, sizeof(hash))) { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 331 | log_err("md5: verify failed at %llu/%u\n", |
| 332 | io_u->offset + header_num * hdr->len, |
| 333 | hdr->len); |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 334 | hexdump(vh->md5_digest, sizeof(vh->md5_digest)); |
Jens Axboe | 8c43232 | 2007-07-27 13:16:24 +0200 | [diff] [blame] | 335 | hexdump(md5_ctx.hash, sizeof(hash)); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 336 | return 1; |
| 337 | } |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
Jens Axboe | 3f199b0 | 2007-08-09 10:16:31 +0200 | [diff] [blame] | 342 | static unsigned int hweight8(unsigned int w) |
| 343 | { |
| 344 | unsigned int res = w - ((w >> 1) & 0x55); |
| 345 | |
| 346 | res = (res & 0x33) + ((res >> 2) & 0x33); |
| 347 | return (res + (res >> 4)) & 0x0F; |
| 348 | } |
| 349 | |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 350 | int verify_io_u_pattern(unsigned long pattern, unsigned long pattern_size, |
Jens Axboe | 4764aec | 2007-08-23 09:03:38 +0200 | [diff] [blame] | 351 | char *buf, unsigned int len, unsigned int mod) |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 352 | { |
| 353 | unsigned int i; |
| 354 | char split_pattern[4]; |
| 355 | |
| 356 | for (i = 0; i < 4; i++) { |
| 357 | split_pattern[i] = pattern & 0xff; |
| 358 | pattern >>= 8; |
| 359 | } |
| 360 | |
| 361 | for (i = 0; i < len; i++) { |
Jens Axboe | 3f199b0 | 2007-08-09 10:16:31 +0200 | [diff] [blame] | 362 | if (buf[i] != split_pattern[mod]) { |
| 363 | unsigned int bits; |
| 364 | |
| 365 | bits = hweight8(buf[i] ^ split_pattern[mod]); |
| 366 | log_err("fio: got pattern %x, wanted %x. Bad bits %d\n", |
| 367 | buf[i], split_pattern[mod], bits); |
| 368 | log_err("fio: bad pattern block offset %u\n", i); |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 369 | return 1; |
Jens Axboe | 3f199b0 | 2007-08-09 10:16:31 +0200 | [diff] [blame] | 370 | } |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 371 | mod++; |
| 372 | if (mod == pattern_size) |
| 373 | mod = 0; |
| 374 | } |
| 375 | |
| 376 | return 0; |
| 377 | } |
| 378 | |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 379 | int verify_io_u(struct thread_data *td, struct io_u *io_u) |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 380 | { |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 381 | struct verify_header *hdr; |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 382 | unsigned int hdr_size, hdr_inc, hdr_num = 0; |
Jens Axboe | 9564610 | 2007-07-28 21:17:50 +0200 | [diff] [blame] | 383 | void *p; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 384 | int ret; |
| 385 | |
Shawn Lewis | 1dcc049 | 2007-07-27 08:02:45 +0200 | [diff] [blame] | 386 | if (td->o.verify == VERIFY_NULL || io_u->ddir != DDIR_READ) |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 387 | return 0; |
| 388 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 389 | hdr_inc = io_u->buflen; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 390 | if (td->o.verify_interval) |
| 391 | hdr_inc = td->o.verify_interval; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 392 | |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 393 | ret = 0; |
Jens Axboe | 3f199b0 | 2007-08-09 10:16:31 +0200 | [diff] [blame] | 394 | for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc, hdr_num++) { |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 395 | if (ret && td->o.verify_fatal) { |
| 396 | td->terminate = 1; |
| 397 | break; |
| 398 | } |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 399 | hdr_size = __hdr_size(td->o.verify); |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 400 | if (td->o.verify_offset) |
Shawn Lewis | a944e33 | 2007-08-02 22:18:29 +0200 | [diff] [blame] | 401 | memswp(p, p + td->o.verify_offset, hdr_size); |
Jens Axboe | 9564610 | 2007-07-28 21:17:50 +0200 | [diff] [blame] | 402 | hdr = p; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 403 | |
Jens Axboe | 3f199b0 | 2007-08-09 10:16:31 +0200 | [diff] [blame] | 404 | if (hdr->fio_magic != FIO_HDR_MAGIC) { |
| 405 | log_err("Bad verify header %x\n", hdr->fio_magic); |
| 406 | return EIO; |
| 407 | } |
| 408 | |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 409 | switch (hdr->verify_type) { |
| 410 | case VERIFY_MD5: |
| 411 | ret = verify_io_u_md5(hdr, io_u, hdr_num); |
| 412 | break; |
| 413 | case VERIFY_CRC64: |
| 414 | ret = verify_io_u_crc64(hdr, io_u, hdr_num); |
| 415 | break; |
| 416 | case VERIFY_CRC32: |
| 417 | ret = verify_io_u_crc32(hdr, io_u, hdr_num); |
| 418 | break; |
| 419 | case VERIFY_CRC16: |
| 420 | ret = verify_io_u_crc16(hdr, io_u, hdr_num); |
| 421 | break; |
| 422 | case VERIFY_CRC7: |
| 423 | ret = verify_io_u_crc7(hdr, io_u, hdr_num); |
| 424 | break; |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 425 | case VERIFY_SHA256: |
| 426 | ret = verify_io_u_sha256(hdr, io_u, hdr_num); |
| 427 | break; |
| 428 | case VERIFY_SHA512: |
| 429 | ret = verify_io_u_sha512(hdr, io_u, hdr_num); |
| 430 | break; |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 431 | case VERIFY_META: |
| 432 | ret = verify_io_u_meta(hdr, td, io_u, hdr_num); |
| 433 | break; |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 434 | case VERIFY_PATTERN: |
| 435 | ret = verify_io_u_pattern(td->o.verify_pattern, |
| 436 | td->o.verify_pattern_bytes, |
| 437 | p + hdr_size, |
| 438 | hdr_inc - hdr_size, |
| 439 | hdr_size % 4); |
| 440 | if (ret) |
| 441 | log_err("fio: verify failed at %llu/%u\n", |
| 442 | io_u->offset + hdr_num * hdr->len, |
| 443 | hdr->len); |
| 444 | break; |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 445 | default: |
| 446 | log_err("Bad verify type %u\n", hdr->verify_type); |
| 447 | ret = 1; |
| 448 | } |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 449 | } |
Jens Axboe | a7dfe86 | 2007-03-12 10:05:08 +0100 | [diff] [blame] | 450 | |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 451 | return ret; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 452 | } |
| 453 | |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 454 | static void fill_meta(struct verify_header *hdr, struct thread_data *td, |
| 455 | struct io_u *io_u, unsigned int header_num) |
| 456 | { |
| 457 | struct vhdr_meta *vh = hdr_priv(hdr); |
| 458 | |
| 459 | vh->thread = td->thread_number; |
| 460 | |
| 461 | vh->time_sec = io_u->start_time.tv_sec; |
| 462 | vh->time_usec = io_u->start_time.tv_usec; |
| 463 | |
| 464 | vh->numberio = td->io_issues[DDIR_WRITE]; |
| 465 | |
| 466 | vh->offset = io_u->offset + header_num * td->o.verify_interval; |
| 467 | } |
| 468 | |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 469 | static void fill_sha512(struct verify_header *hdr, void *p, unsigned int len) |
| 470 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 471 | struct vhdr_sha512 *vh = hdr_priv(hdr); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 472 | struct sha512_ctx sha512_ctx = { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 473 | .buf = vh->sha512, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 474 | }; |
| 475 | |
| 476 | sha512_init(&sha512_ctx); |
| 477 | sha512_update(&sha512_ctx, p, len); |
| 478 | } |
| 479 | |
| 480 | static void fill_sha256(struct verify_header *hdr, void *p, unsigned int len) |
| 481 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 482 | struct vhdr_sha256 *vh = hdr_priv(hdr); |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 483 | struct sha256_ctx sha256_ctx = { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 484 | .buf = vh->sha256, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 485 | }; |
| 486 | |
| 487 | sha256_init(&sha256_ctx); |
| 488 | sha256_update(&sha256_ctx, p, len); |
| 489 | } |
| 490 | |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 491 | static void fill_crc7(struct verify_header *hdr, void *p, unsigned int len) |
| 492 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 493 | struct vhdr_crc7 *vh = hdr_priv(hdr); |
| 494 | |
| 495 | vh->crc7 = crc7(p, len); |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 496 | } |
| 497 | |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 498 | static void fill_crc16(struct verify_header *hdr, void *p, unsigned int len) |
| 499 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 500 | struct vhdr_crc16 *vh = hdr_priv(hdr); |
| 501 | |
| 502 | vh->crc16 = crc16(p, len); |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 503 | } |
| 504 | |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 505 | static void fill_crc32(struct verify_header *hdr, void *p, unsigned int len) |
| 506 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 507 | struct vhdr_crc32 *vh = hdr_priv(hdr); |
| 508 | |
| 509 | vh->crc32 = crc32(p, len); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 510 | } |
| 511 | |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 512 | static void fill_crc64(struct verify_header *hdr, void *p, unsigned int len) |
| 513 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 514 | struct vhdr_crc64 *vh = hdr_priv(hdr); |
| 515 | |
| 516 | vh->crc64 = crc64(p, len); |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 517 | } |
| 518 | |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 519 | static void fill_md5(struct verify_header *hdr, void *p, unsigned int len) |
| 520 | { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 521 | struct vhdr_md5 *vh = hdr_priv(hdr); |
Jens Axboe | 8c43232 | 2007-07-27 13:16:24 +0200 | [diff] [blame] | 522 | struct md5_ctx md5_ctx = { |
Jens Axboe | 546dfd9 | 2007-07-30 12:23:05 +0200 | [diff] [blame] | 523 | .hash = (uint32_t *) vh->md5_digest, |
Jens Axboe | 8c43232 | 2007-07-27 13:16:24 +0200 | [diff] [blame] | 524 | }; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 525 | |
Jens Axboe | 61f821f | 2007-07-30 10:18:06 +0200 | [diff] [blame] | 526 | md5_init(&md5_ctx); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 527 | md5_update(&md5_ctx, p, len); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | /* |
| 531 | * fill body of io_u->buf with random data and add a header with the |
| 532 | * crc32 or md5 sum of that data. |
| 533 | */ |
| 534 | void populate_verify_io_u(struct thread_data *td, struct io_u *io_u) |
| 535 | { |
Jens Axboe | baefa9b | 2007-07-27 12:57:25 +0200 | [diff] [blame] | 536 | struct verify_header *hdr; |
Jens Axboe | 9564610 | 2007-07-28 21:17:50 +0200 | [diff] [blame] | 537 | void *p = io_u->buf, *data; |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 538 | unsigned int hdr_inc, data_len, header_num = 0; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 539 | |
Jens Axboe | 9cc3d15 | 2007-03-26 10:32:30 +0200 | [diff] [blame] | 540 | if (td->o.verify == VERIFY_NULL) |
| 541 | return; |
| 542 | |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 543 | fill_pattern(td, p, io_u->buflen); |
Jens Axboe | baefa9b | 2007-07-27 12:57:25 +0200 | [diff] [blame] | 544 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 545 | hdr_inc = io_u->buflen; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 546 | if (td->o.verify_interval) |
| 547 | hdr_inc = td->o.verify_interval; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 548 | |
Jens Axboe | 9564610 | 2007-07-28 21:17:50 +0200 | [diff] [blame] | 549 | for (;p < io_u->buf + io_u->buflen; p += hdr_inc) { |
| 550 | hdr = p; |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 551 | |
| 552 | hdr->fio_magic = FIO_HDR_MAGIC; |
| 553 | hdr->verify_type = td->o.verify; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 554 | hdr->len = hdr_inc; |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 555 | data_len = hdr_inc - hdr_size(hdr); |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 556 | |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 557 | data = p + hdr_size(hdr); |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 558 | switch (td->o.verify) { |
| 559 | case VERIFY_MD5: |
| 560 | fill_md5(hdr, data, data_len); |
| 561 | break; |
| 562 | case VERIFY_CRC64: |
| 563 | fill_crc64(hdr, data, data_len); |
| 564 | break; |
| 565 | case VERIFY_CRC32: |
| 566 | fill_crc32(hdr, data, data_len); |
| 567 | break; |
| 568 | case VERIFY_CRC16: |
| 569 | fill_crc16(hdr, data, data_len); |
| 570 | break; |
| 571 | case VERIFY_CRC7: |
| 572 | fill_crc7(hdr, data, data_len); |
| 573 | break; |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 574 | case VERIFY_SHA256: |
| 575 | fill_sha256(hdr, data, data_len); |
| 576 | break; |
| 577 | case VERIFY_SHA512: |
| 578 | fill_sha512(hdr, data, data_len); |
| 579 | break; |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 580 | case VERIFY_META: |
| 581 | fill_meta(hdr, td, io_u, header_num); |
| 582 | break; |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 583 | case VERIFY_PATTERN: |
| 584 | break; |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 585 | default: |
| 586 | log_err("fio: bad verify type: %d\n", td->o.verify); |
| 587 | assert(0); |
| 588 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 589 | if (td->o.verify_offset) |
Jens Axboe | 8767783 | 2007-07-30 12:08:14 +0200 | [diff] [blame] | 590 | memswp(p, p + td->o.verify_offset, hdr_size(hdr)); |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 591 | header_num++; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 592 | } |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | int get_next_verify(struct thread_data *td, struct io_u *io_u) |
| 596 | { |
Jens Axboe | 8de8f04 | 2007-03-27 10:36:12 +0200 | [diff] [blame] | 597 | struct io_piece *ipo = NULL; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 598 | |
Jens Axboe | d2d7fa5 | 2007-02-19 13:21:35 +0100 | [diff] [blame] | 599 | /* |
| 600 | * this io_u is from a requeue, we already filled the offsets |
| 601 | */ |
| 602 | if (io_u->file) |
| 603 | return 0; |
| 604 | |
Jens Axboe | 8de8f04 | 2007-03-27 10:36:12 +0200 | [diff] [blame] | 605 | if (!RB_EMPTY_ROOT(&td->io_hist_tree)) { |
| 606 | struct rb_node *n = rb_first(&td->io_hist_tree); |
| 607 | |
Jens Axboe | 4b87898 | 2007-03-26 09:32:22 +0200 | [diff] [blame] | 608 | ipo = rb_entry(n, struct io_piece, rb_node); |
Jens Axboe | 4b87898 | 2007-03-26 09:32:22 +0200 | [diff] [blame] | 609 | rb_erase(n, &td->io_hist_tree); |
Jens Axboe | 8de8f04 | 2007-03-27 10:36:12 +0200 | [diff] [blame] | 610 | } else if (!list_empty(&td->io_hist_list)) { |
| 611 | ipo = list_entry(td->io_hist_list.next, struct io_piece, list); |
| 612 | list_del(&ipo->list); |
| 613 | } |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 614 | |
Jens Axboe | 8de8f04 | 2007-03-27 10:36:12 +0200 | [diff] [blame] | 615 | if (ipo) { |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 616 | io_u->offset = ipo->offset; |
| 617 | io_u->buflen = ipo->len; |
Jens Axboe | 36167d8 | 2007-02-18 05:41:31 +0100 | [diff] [blame] | 618 | io_u->file = ipo->file; |
Jens Axboe | 97af62c | 2007-05-22 11:12:13 +0200 | [diff] [blame] | 619 | |
| 620 | if ((io_u->file->flags & FIO_FILE_OPEN) == 0) { |
| 621 | int r = td_io_open_file(td, io_u->file); |
| 622 | |
| 623 | if (r) |
| 624 | return 1; |
| 625 | } |
| 626 | |
| 627 | get_file(ipo->file); |
| 628 | assert(io_u->file->flags & FIO_FILE_OPEN); |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 629 | io_u->ddir = DDIR_READ; |
Jens Axboe | 36167d8 | 2007-02-18 05:41:31 +0100 | [diff] [blame] | 630 | io_u->xfer_buf = io_u->buf; |
| 631 | io_u->xfer_buflen = io_u->buflen; |
Jens Axboe | e29d1b7 | 2006-10-18 15:43:15 +0200 | [diff] [blame] | 632 | free(ipo); |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | return 1; |
| 637 | } |