Statistics
| Branch: | Revision:

root / drivers / io-optimize.h @ abdb293f

History | View | Annotate | Download (1 kB)

1
/* Copyright (c) 2007, XenSource Inc.
2
 * All rights reserved.
3
 */
4

    
5
#ifndef __IO_OPTIMIZE_H__
6
#define __IO_OPTIMIZE_H__
7

    
8
#include <libaio.h>
9

    
10
struct opio;
11

    
12
struct opio_list {
13
        struct opio        *head;
14
        struct opio        *tail;
15
};
16

    
17
struct opio {
18
        char               *buf;
19
        unsigned long       nbytes;
20
        long long           offset;
21
        void               *data;
22
        struct iocb        *iocb;
23
        struct io_event     event;
24
        struct opio        *head;
25
        struct opio        *next;
26
        struct opio_list    list;
27
};
28

    
29
struct opioctx {
30
        int                 num_opios;
31
        int                 free_opio_cnt;
32
        struct opio        *opios;
33
        struct opio       **free_opios;
34
        struct iocb       **iocb_queue;
35
        struct io_event    *event_queue;
36
};
37

    
38
int opio_init(struct opioctx *ctx, int num_iocbs);
39
void opio_free(struct opioctx *ctx);
40
int io_merge(struct opioctx *ctx, struct iocb **queue, int num);
41
int io_split(struct opioctx *ctx, struct io_event *events, int num);
42
int io_expand_iocbs(struct opioctx *ctx, struct iocb **queue, int idx, int num);
43

    
44
#endif