forked from open-iscsi/tcmu-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcmur_aio.h
54 lines (41 loc) · 1.36 KB
/
tcmur_aio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright (c) 2017 Red Hat, Inc.
*
* This file is licensed to you under your choice of the GNU Lesser
* General Public License, version 2.1 or any later version (LGPLv2.1 or
* later), or the Apache License 2.0.
*/
#ifndef __TCMUR_AIO_H
#define __TCMUR_AIO_H
#include <pthread.h>
#include "ccan/list/list.h"
struct tcmur_device;
struct tcmu_device;
struct tcmulib_cmd;
struct tcmu_track_aio {
unsigned int pending_wakeups;
unsigned int tracked_aio_ops;
pthread_mutex_t track_lock;
pthread_cond_t *is_empty_cond;
};
struct tcmu_io_queue {
pthread_mutex_t io_lock;
pthread_cond_t io_cond;
pthread_t *io_wq_threads;
struct list_head io_queue;
};
int setup_io_work_queue(struct tcmu_device *);
void cleanup_io_work_queue(struct tcmu_device *, bool);
void cleanup_io_work_queue_threads(struct tcmu_device *);
int setup_aio_tracking(struct tcmur_device *);
void cleanup_aio_tracking(struct tcmur_device *);
typedef int (*tcmu_work_fn_t)(struct tcmu_device *dev,
struct tcmulib_cmd *cmd);
int async_handle_cmd(struct tcmu_device *, struct tcmulib_cmd *,
tcmu_work_fn_t);
/* aio request tracking */
void track_aio_request_start(struct tcmur_device *);
void track_aio_request_finish(struct tcmur_device *, int *);
void track_aio_wakeup_finish(struct tcmur_device *, int *);
int aio_wait_for_empty_queue(struct tcmur_device *rdev);
#endif /* __TCMUR_AIO_H */