Skip to content

Commit ac2aa2c

Browse files
committed
Kill of IO engine cancelation support
This was more of a thought experiment back in the day, but even for an old interface like libaio on Linux, it does not support canceling IOs at all. Neither does posixaio. And while cancel support could get plumbed up to io_uring, since Linux doesn't support canceling normal IO, then it will never do anything. Hence it's utterly pointless to have a cancel ops in the IO engine, and the backend attempts at first reaping done IO and then canceling the rest is also then pointless. Just replace the at-exit cancelation with waiting on pending IO. Signed-off-by: Jens Axboe <[email protected]>
1 parent a475300 commit ac2aa2c

File tree

6 files changed

+5
-82
lines changed

6 files changed

+5
-82
lines changed

backend.c

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -222,39 +222,6 @@ static bool check_min_rate(struct thread_data *td, struct timespec *now)
222222
return ret;
223223
}
224224

225-
/*
226-
* When job exits, we can cancel the in-flight IO if we are using async
227-
* io. Attempt to do so.
228-
*/
229-
static void cleanup_pending_aio(struct thread_data *td)
230-
{
231-
int r;
232-
233-
/*
234-
* get immediately available events, if any
235-
*/
236-
r = io_u_queued_complete(td, 0);
237-
238-
/*
239-
* now cancel remaining active events
240-
*/
241-
if (td->io_ops->cancel) {
242-
struct io_u *io_u;
243-
int i;
244-
245-
io_u_qiter(&td->io_u_all, io_u, i) {
246-
if (io_u->flags & IO_U_F_FLIGHT) {
247-
r = td->io_ops->cancel(td, io_u);
248-
if (!r)
249-
put_io_u(td, io_u);
250-
}
251-
}
252-
}
253-
254-
if (td->cur_depth)
255-
r = io_u_queued_complete(td, td->cur_depth);
256-
}
257-
258225
/*
259226
* Helper to handle the final sync of a file. Works just like the normal
260227
* io path, just does everything sync.
@@ -614,8 +581,8 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
614581
{
615582
struct fio_file *f;
616583
struct io_u *io_u;
617-
int ret, min_events;
618584
unsigned int i;
585+
int ret;
619586

620587
dprint(FD_VERIFY, "starting loop\n");
621588

@@ -751,13 +718,8 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
751718

752719
check_update_rusage(td);
753720

754-
if (!td->error) {
755-
min_events = td->cur_depth;
756-
757-
if (min_events)
758-
ret = io_u_queued_complete(td, min_events);
759-
} else
760-
cleanup_pending_aio(td);
721+
if (td->cur_depth)
722+
ret = io_u_queued_complete(td, td->cur_depth);
761723

762724
td_set_runstate(td, TD_RUNNING);
763725

@@ -1313,7 +1275,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
13131275
} else {
13141276
if (td->o.io_submit_mode == IO_MODE_OFFLOAD)
13151277
workqueue_flush(&td->io_wq);
1316-
cleanup_pending_aio(td);
1278+
ret = io_u_queued_complete(td, td->cur_depth);
13171279
}
13181280

13191281
/*

engines/libaio.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,6 @@ static int fio_libaio_commit(struct thread_data *td)
389389
return ret;
390390
}
391391

392-
static int fio_libaio_cancel(struct thread_data *td, struct io_u *io_u)
393-
{
394-
struct libaio_data *ld = td->io_ops_data;
395-
396-
return io_cancel(ld->aio_ctx, &io_u->iocb, ld->aio_events);
397-
}
398-
399392
static void fio_libaio_cleanup(struct thread_data *td)
400393
{
401394
struct libaio_data *ld = td->io_ops_data;
@@ -470,7 +463,6 @@ FIO_STATIC struct ioengine_ops ioengine = {
470463
.prep = fio_libaio_prep,
471464
.queue = fio_libaio_queue,
472465
.commit = fio_libaio_commit,
473-
.cancel = fio_libaio_cancel,
474466
.getevents = fio_libaio_getevents,
475467
.event = fio_libaio_event,
476468
.cleanup = fio_libaio_cleanup,

engines/posixaio.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@ static unsigned long long ts_utime_since_now(const struct timespec *start)
2727
return utime_since(start, &now);
2828
}
2929

30-
static int fio_posixaio_cancel(struct thread_data fio_unused *td,
31-
struct io_u *io_u)
32-
{
33-
struct fio_file *f = io_u->file;
34-
int r = aio_cancel(f->fd, &io_u->aiocb);
35-
36-
if (r == AIO_ALLDONE || r == AIO_CANCELED)
37-
return 0;
38-
39-
return 1;
40-
}
41-
4230
static int fio_posixaio_prep(struct thread_data fio_unused *td,
4331
struct io_u *io_u)
4432
{
@@ -212,7 +200,6 @@ static struct ioengine_ops ioengine = {
212200
.init = fio_posixaio_init,
213201
.prep = fio_posixaio_prep,
214202
.queue = fio_posixaio_queue,
215-
.cancel = fio_posixaio_cancel,
216203
.getevents = fio_posixaio_getevents,
217204
.event = fio_posixaio_event,
218205
.cleanup = fio_posixaio_cleanup,

engines/skeleton_external.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@ static int fio_skeleton_getevents(struct thread_data *td, unsigned int min,
7171
return 0;
7272
}
7373

74-
/*
75-
* The ->cancel() hook attempts to cancel the io_u. Only relevant for
76-
* async io engines, and need not be supported.
77-
*/
78-
static int fio_skeleton_cancel(struct thread_data *td, struct io_u *io_u)
79-
{
80-
return 0;
81-
}
82-
8374
/*
8475
* The ->queue() hook is responsible for initiating io on the io_u
8576
* being passed in. If the io engine is a synchronous one, io may complete
@@ -214,7 +205,6 @@ struct ioengine_ops ioengine = {
214205
.init = fio_skeleton_init,
215206
.prep = fio_skeleton_prep,
216207
.queue = fio_skeleton_queue,
217-
.cancel = fio_skeleton_cancel,
218208
.getevents = fio_skeleton_getevents,
219209
.event = fio_skeleton_event,
220210
.cleanup = fio_skeleton_cleanup,

engines/solarisaio.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ struct solarisaio_data {
1919
unsigned int max_depth;
2020
};
2121

22-
static int fio_solarisaio_cancel(struct thread_data fio_unused *td,
23-
struct io_u *io_u)
24-
{
25-
return aiocancel(&io_u->resultp);
26-
}
27-
2822
static int fio_solarisaio_prep(struct thread_data fio_unused *td,
2923
struct io_u *io_u)
3024
{
@@ -213,7 +207,6 @@ static struct ioengine_ops ioengine = {
213207
.init = fio_solarisaio_init,
214208
.prep = fio_solarisaio_prep,
215209
.queue = fio_solarisaio_queue,
216-
.cancel = fio_solarisaio_cancel,
217210
.getevents = fio_solarisaio_getevents,
218211
.event = fio_solarisaio_event,
219212
.cleanup = fio_solarisaio_cleanup,

ioengines.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "zbd_types.h"
1010
#include "dataplacement.h"
1111

12-
#define FIO_IOOPS_VERSION 38
12+
#define FIO_IOOPS_VERSION 39
1313

1414
#ifndef CONFIG_DYNAMIC_ENGINES
1515
#define FIO_STATIC static
@@ -41,7 +41,6 @@ struct ioengine_ops {
4141
int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *);
4242
struct io_u *(*event)(struct thread_data *, int);
4343
char *(*errdetails)(struct thread_data *, struct io_u *);
44-
int (*cancel)(struct thread_data *, struct io_u *);
4544
void (*cleanup)(struct thread_data *);
4645
int (*open_file)(struct thread_data *, struct fio_file *);
4746
int (*close_file)(struct thread_data *, struct fio_file *);

0 commit comments

Comments
 (0)