Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 1 | /* |
| 2 | * blktrace support code for fio |
| 3 | */ |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
Jens Axboe | 5e6c206 | 2007-05-16 14:40:29 +0200 | [diff] [blame] | 6 | #include <sys/stat.h> |
| 7 | #include <dirent.h> |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 8 | |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 9 | #include "list.h" |
| 10 | #include "fio.h" |
| 11 | #include "blktrace_api.h" |
| 12 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 13 | #define TRACE_FIFO_SIZE 65536 |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 14 | |
| 15 | /* |
| 16 | * fifo refill frontend, to avoid reading data in trace sized bites |
| 17 | */ |
| 18 | static int refill_fifo(struct thread_data *td, struct fifo *fifo, int fd) |
| 19 | { |
| 20 | char buf[TRACE_FIFO_SIZE]; |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 21 | unsigned int total; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 22 | int ret; |
| 23 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 24 | total = sizeof(buf); |
| 25 | if (total > fifo_room(fifo)) |
| 26 | total = fifo_room(fifo); |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 27 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 28 | ret = read(fd, buf, total); |
| 29 | if (ret < 0) { |
| 30 | td_verror(td, errno, "read blktrace file"); |
| 31 | return -1; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 32 | } |
| 33 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 34 | if (ret > 0) |
| 35 | ret = fifo_put(fifo, buf, ret); |
| 36 | |
| 37 | return ret; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | /* |
| 41 | * Retrieve 'len' bytes from the fifo, refilling if necessary. |
| 42 | */ |
| 43 | static int trace_fifo_get(struct thread_data *td, struct fifo *fifo, int fd, |
| 44 | void *buf, unsigned int len) |
| 45 | { |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 46 | if (fifo_len(fifo) < len) { |
| 47 | int ret = refill_fifo(td, fifo, fd); |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 48 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 49 | if (ret < 0) |
| 50 | return ret; |
| 51 | } |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 52 | |
| 53 | return fifo_get(fifo, buf, len); |
| 54 | } |
| 55 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 56 | /* |
| 57 | * Just discard the pdu by seeking past it. |
| 58 | */ |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 59 | static int discard_pdu(struct thread_data *td, struct fifo *fifo, int fd, |
| 60 | struct blk_io_trace *t) |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 61 | { |
| 62 | if (t->pdu_len == 0) |
| 63 | return 0; |
| 64 | |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 65 | return trace_fifo_get(td, fifo, fd, NULL, t->pdu_len); |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 66 | } |
| 67 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 68 | /* |
| 69 | * Check if this is a blktrace binary data file. We read a single trace |
| 70 | * into memory and check for the magic signature. |
| 71 | */ |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 72 | int is_blktrace(const char *filename) |
| 73 | { |
| 74 | struct blk_io_trace t; |
| 75 | int fd, ret; |
| 76 | |
| 77 | fd = open(filename, O_RDONLY); |
Jens Axboe | 4dced40 | 2007-07-23 14:16:55 +0200 | [diff] [blame] | 78 | if (fd < 0) |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 79 | return 0; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 80 | |
| 81 | ret = read(fd, &t, sizeof(t)); |
| 82 | close(fd); |
| 83 | |
| 84 | if (ret < 0) { |
| 85 | perror("read blktrace"); |
| 86 | return 0; |
| 87 | } else if (ret != sizeof(t)) { |
| 88 | log_err("fio: short read on blktrace file\n"); |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | if ((t.magic & 0xffffff00) == BLK_IO_TRACE_MAGIC) |
| 93 | return 1; |
| 94 | |
| 95 | return 0; |
| 96 | } |
| 97 | |
Jens Axboe | 5e6c206 | 2007-05-16 14:40:29 +0200 | [diff] [blame] | 98 | static int lookup_device(char *path, unsigned int maj, unsigned int min) |
| 99 | { |
| 100 | struct dirent *dir; |
| 101 | struct stat st; |
| 102 | int found = 0; |
| 103 | DIR *D; |
| 104 | |
| 105 | D = opendir(path); |
| 106 | if (!D) |
| 107 | return 0; |
| 108 | |
| 109 | while ((dir = readdir(D)) != NULL) { |
| 110 | char full_path[256]; |
| 111 | |
| 112 | if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) |
| 113 | continue; |
| 114 | |
| 115 | sprintf(full_path, "%s/%s", path, dir->d_name); |
| 116 | if (lstat(full_path, &st) == -1) { |
| 117 | perror("lstat"); |
| 118 | break; |
| 119 | } |
| 120 | |
| 121 | if (S_ISDIR(st.st_mode)) { |
| 122 | found = lookup_device(full_path, maj, min); |
| 123 | if (found) { |
| 124 | strcpy(path, full_path); |
| 125 | break; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | if (!S_ISBLK(st.st_mode)) |
| 130 | continue; |
| 131 | |
| 132 | if (maj == major(st.st_rdev) && min == minor(st.st_rdev)) { |
| 133 | strcpy(path, full_path); |
| 134 | found = 1; |
| 135 | break; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | closedir(D); |
| 140 | return found; |
| 141 | } |
| 142 | |
Jens Axboe | c69aa91 | 2007-05-22 15:51:50 +0200 | [diff] [blame] | 143 | #define FMINORBITS 20 |
| 144 | #define FMINORMASK ((1U << FMINORBITS) - 1) |
| 145 | #define FMAJOR(dev) ((unsigned int) ((dev) >> FMINORBITS)) |
| 146 | #define FMINOR(dev) ((unsigned int) ((dev) & FMINORMASK)) |
Jens Axboe | eeb9c2a | 2007-05-16 18:28:47 +0200 | [diff] [blame] | 147 | |
Jens Axboe | 5e6c206 | 2007-05-16 14:40:29 +0200 | [diff] [blame] | 148 | static void trace_add_file(struct thread_data *td, __u32 device) |
| 149 | { |
| 150 | static unsigned int last_maj, last_min; |
Jens Axboe | c69aa91 | 2007-05-22 15:51:50 +0200 | [diff] [blame] | 151 | unsigned int maj = FMAJOR(device); |
| 152 | unsigned int min = FMINOR(device); |
Jens Axboe | 5e6c206 | 2007-05-16 14:40:29 +0200 | [diff] [blame] | 153 | struct fio_file *f; |
| 154 | char dev[256]; |
| 155 | unsigned int i; |
| 156 | |
| 157 | if (last_maj == maj && last_min == min) |
| 158 | return; |
| 159 | |
| 160 | last_maj = maj; |
| 161 | last_min = min; |
| 162 | |
| 163 | /* |
| 164 | * check for this file in our list |
| 165 | */ |
| 166 | for_each_file(td, f, i) |
| 167 | if (f->major == maj && f->minor == min) |
| 168 | return; |
| 169 | |
| 170 | strcpy(dev, "/dev"); |
| 171 | if (lookup_device(dev, maj, min)) |
| 172 | add_file(td, dev); |
| 173 | } |
| 174 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 175 | /* |
| 176 | * Store blk_io_trace data in an ipo for later retrieval. |
| 177 | */ |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 178 | static void store_ipo(struct thread_data *td, unsigned long long offset, |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 179 | unsigned int bytes, int rw, unsigned long long ttime) |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 180 | { |
| 181 | struct io_piece *ipo = malloc(sizeof(*ipo)); |
| 182 | |
| 183 | memset(ipo, 0, sizeof(*ipo)); |
| 184 | INIT_LIST_HEAD(&ipo->list); |
Jens Axboe | a2eea81 | 2007-05-15 13:10:41 +0200 | [diff] [blame] | 185 | /* |
| 186 | * the 512 is wrong here, it should be the hardware sector size... |
| 187 | */ |
| 188 | ipo->offset = offset * 512; |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 189 | ipo->len = bytes; |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 190 | ipo->delay = ttime / 1000; |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 191 | if (rw) |
| 192 | ipo->ddir = DDIR_WRITE; |
| 193 | else |
| 194 | ipo->ddir = DDIR_READ; |
| 195 | |
| 196 | list_add_tail(&ipo->list, &td->io_log_list); |
| 197 | } |
| 198 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 199 | /* |
| 200 | * We only care for queue traces, most of the others are side effects |
| 201 | * due to internal workings of the block layer. |
| 202 | */ |
| 203 | static void handle_trace(struct thread_data *td, struct blk_io_trace *t, |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 204 | unsigned long long ttime, unsigned long *ios, |
| 205 | unsigned int *bs) |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 206 | { |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 207 | int rw; |
| 208 | |
| 209 | if ((t->action & 0xffff) != __BLK_TA_QUEUE) |
| 210 | return; |
Jens Axboe | a2eea81 | 2007-05-15 13:10:41 +0200 | [diff] [blame] | 211 | if (t->action & BLK_TC_ACT(BLK_TC_PC)) |
| 212 | return; |
Jens Axboe | 3f3d361 | 2007-05-16 12:29:06 +0200 | [diff] [blame] | 213 | if (t->action & BLK_TC_ACT(BLK_TC_NOTIFY)) |
Jens Axboe | a2eea81 | 2007-05-15 13:10:41 +0200 | [diff] [blame] | 214 | return; |
Jens Axboe | fdefd98 | 2007-05-15 10:12:26 +0200 | [diff] [blame] | 215 | |
Jens Axboe | 5e6c206 | 2007-05-16 14:40:29 +0200 | [diff] [blame] | 216 | trace_add_file(td, t->device); |
| 217 | |
Jens Axboe | e7a7d70 | 2007-05-15 10:13:04 +0200 | [diff] [blame] | 218 | rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 219 | |
| 220 | if (t->bytes > bs[rw]) |
| 221 | bs[rw] = t->bytes; |
| 222 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 223 | ios[rw]++; |
Jens Axboe | 6df8ada | 2007-05-15 13:23:19 +0200 | [diff] [blame] | 224 | td->o.size += t->bytes; |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 225 | store_ipo(td, t->sector, t->bytes, rw, ttime); |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 226 | } |
| 227 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 228 | /* |
| 229 | * Load a blktrace file by reading all the blk_io_trace entries, and storing |
| 230 | * them as io_pieces like the fio text version would do. |
| 231 | */ |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 232 | int load_blktrace(struct thread_data *td, const char *filename) |
| 233 | { |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 234 | unsigned long long ttime, delay; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 235 | struct blk_io_trace t; |
Jens Axboe | 4241ea8 | 2007-09-12 08:18:36 +0200 | [diff] [blame] | 236 | unsigned long ios[2], skipped_writes; |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 237 | unsigned int cpu; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 238 | unsigned int rw_bs[2]; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 239 | struct fifo *fifo; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 240 | int fd; |
| 241 | |
| 242 | fd = open(filename, O_RDONLY); |
| 243 | if (fd < 0) { |
| 244 | td_verror(td, errno, "open blktrace file"); |
| 245 | return 1; |
| 246 | } |
| 247 | |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 248 | fifo = fifo_alloc(TRACE_FIFO_SIZE); |
| 249 | |
Jens Axboe | 6df8ada | 2007-05-15 13:23:19 +0200 | [diff] [blame] | 250 | td->o.size = 0; |
| 251 | |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 252 | cpu = 0; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 253 | ttime = 0; |
| 254 | ios[0] = ios[1] = 0; |
| 255 | rw_bs[0] = rw_bs[1] = 0; |
Jens Axboe | 4241ea8 | 2007-09-12 08:18:36 +0200 | [diff] [blame] | 256 | skipped_writes = 0; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 257 | do { |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 258 | int ret = trace_fifo_get(td, fifo, fd, &t, sizeof(t)); |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 259 | |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 260 | if (ret < 0) |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 261 | goto err; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 262 | else if (!ret) |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 263 | break; |
Jens Axboe | e288756 | 2007-05-16 09:25:09 +0200 | [diff] [blame] | 264 | else if (ret < (int) sizeof(t)) { |
| 265 | log_err("fio: short fifo get\n"); |
| 266 | break; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | if ((t.magic & 0xffffff00) != BLK_IO_TRACE_MAGIC) { |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 270 | log_err("fio: bad magic in blktrace data: %x\n", t.magic); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 271 | goto err; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 272 | } |
| 273 | if ((t.magic & 0xff) != BLK_IO_TRACE_VERSION) { |
| 274 | log_err("fio: bad blktrace version %d\n", t.magic & 0xff); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 275 | goto err; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 276 | } |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 277 | ret = discard_pdu(td, fifo, fd, &t); |
| 278 | if (ret < 0) { |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 279 | td_verror(td, ret, "blktrace lseek"); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 280 | goto err; |
Jens Axboe | f12b323 | 2007-05-16 12:16:44 +0200 | [diff] [blame] | 281 | } else if (t.pdu_len != ret) { |
| 282 | log_err("fio: discarded %d of %d\n", ret, t.pdu_len); |
| 283 | goto err; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 284 | } |
Jens Axboe | f3f72c5 | 2007-08-23 09:03:26 +0200 | [diff] [blame] | 285 | if (t.action & BLK_TC_ACT(BLK_TC_NOTIFY)) |
| 286 | continue; |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 287 | if (!ttime) { |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 288 | ttime = t.time; |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 289 | cpu = t.cpu; |
| 290 | } |
| 291 | delay = 0; |
| 292 | if (cpu == t.cpu) |
| 293 | delay = t.time - ttime; |
Jens Axboe | 4241ea8 | 2007-09-12 08:18:36 +0200 | [diff] [blame] | 294 | if ((t.action & BLK_TC_ACT(BLK_TC_WRITE)) && read_only) |
| 295 | skipped_writes++; |
| 296 | else |
| 297 | handle_trace(td, &t, delay, ios, rw_bs); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 298 | ttime = t.time; |
Jens Axboe | a61edde | 2007-05-15 14:29:58 +0200 | [diff] [blame] | 299 | cpu = t.cpu; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 300 | } while (1); |
| 301 | |
Jens Axboe | 38470f8 | 2007-05-16 09:26:23 +0200 | [diff] [blame] | 302 | fifo_free(fifo); |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 303 | close(fd); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 304 | |
Jens Axboe | 4241ea8 | 2007-09-12 08:18:36 +0200 | [diff] [blame] | 305 | if (skipped_writes) |
| 306 | log_err("fio: <%s> skips replay of %lu writes due to read-only\n", td->o.name, skipped_writes); |
| 307 | |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 308 | if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) { |
| 309 | log_err("fio: found no ios in blktrace data\n"); |
| 310 | return 1; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 311 | } else if (ios[DDIR_READ] && !ios[DDIR_READ]) { |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 312 | td->o.td_ddir = TD_DDIR_READ; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 313 | td->o.max_bs[DDIR_READ] = rw_bs[DDIR_READ]; |
| 314 | } else if (!ios[DDIR_READ] && ios[DDIR_WRITE]) { |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 315 | td->o.td_ddir = TD_DDIR_WRITE; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 316 | td->o.max_bs[DDIR_WRITE] = rw_bs[DDIR_WRITE]; |
| 317 | } else { |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 318 | td->o.td_ddir = TD_DDIR_RW; |
Jens Axboe | d84f8d4 | 2007-05-16 08:47:46 +0200 | [diff] [blame] | 319 | td->o.max_bs[DDIR_READ] = rw_bs[DDIR_READ]; |
| 320 | td->o.max_bs[DDIR_WRITE] = rw_bs[DDIR_WRITE]; |
| 321 | } |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 322 | |
| 323 | /* |
| 324 | * We need to do direct/raw ios to the device, to avoid getting |
| 325 | * read-ahead in our way. |
| 326 | */ |
| 327 | td->o.odirect = 1; |
| 328 | |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 329 | return 0; |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 330 | err: |
| 331 | close(fd); |
Jens Axboe | 38470f8 | 2007-05-16 09:26:23 +0200 | [diff] [blame] | 332 | fifo_free(fifo); |
Jens Axboe | 8c1fdf0 | 2007-05-15 11:54:21 +0200 | [diff] [blame] | 333 | return 1; |
Jens Axboe | fb7b71a | 2007-05-15 08:44:04 +0200 | [diff] [blame] | 334 | } |