Lines Matching +full:async +full:- +full:io
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 * Copy file by using an async I/O state machine.
14 * - Start read request
15 * - When read completes turn it into a write request
16 * - When write completes decrement counter and free up resources
55 # define howmany(x, y) (((x) + ((y) - 1)) / (y))
65 i -= tst_rand_data_len; in fill_with_rand_data()
80 io_prep_pread(iocb_free[i], -1, buff, aio_blksize, 0); in async_init()
91 return iocb_free[--iocb_free_count]; in get_iocb()
94 static void put_iocb(struct iocb *io) in put_iocb() argument
96 iocb_free[iocb_free_count++] = io; in put_iocb()
101 int iosize = iocb->u.c.nbytes; in async_write_done()
107 tst_brk(TBROK, "Write error: %s", tst_strerrno(-res2)); in async_write_done()
111 --busy; in async_write_done()
112 --tocopy; in async_write_done()
123 int iosize = iocb->u.c.nbytes; in async_copy()
124 char *buf = iocb->u.c.buf; in async_copy()
125 off_t offset = iocb->u.c.offset; in async_copy()
132 tst_brk(TBROK, "Read error: %s", tst_strerrno(-res2)); in async_copy()
139 tst_brk(TBROK, "io_submit error: %s", tst_strerrno(-w)); in async_copy()
150 tst_brk(TBROK, "io_getevents() failed: %s", tst_strerrno(-n)); in io_wait_run()
152 for (ep = events; n-- > 0; ep++) { in io_wait_run()
153 io_callback_t cb = (io_callback_t) ep->data; in io_wait_run()
154 struct iocb *iocb = ep->obj; in io_wait_run()
156 cb(ctx, iocb, ep->res, ep->res2); in io_wait_run()
170 n = MIN(aionum - busy, tocopy); in async_run()
176 struct iocb *io = get_iocb(); in async_run() local
178 iosize = MIN(filesize - offset, aio_blksize); in async_run()
184 io_prep_pread(io, fd, io->u.c.buf, iosize, offset); in async_run()
185 io_set_callback(io, cb); in async_run()
187 ioq[i] = io; in async_run()
193 tst_brk(TBROK, "io_submit write error: %s", tst_strerrno(-rc)); in async_run()
210 SAFE_FILE_SCANF("/proc/sys/fs/aio-max-nr", "%d", &maxaio); in setup()
214 tst_res(TCONF, "Number of async IO blocks passed the maximum (%d)", maxaio); in setup()
245 filesize = filesize - leftover + aio_blksize; in setup()
279 tst_res(TINFO, "Copy %s -> %s", srcname, dstname); in run()
330 {"n:", &str_aionum, "Number of Async IO blocks (default 16)"},