2 * Copyright (C) 2003 Sistina Software
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
5 * Device-Mapper low-level I/O.
7 * This file is released under the GPL.
10 #ifndef _LINUX_DM_IO_H
11 #define _LINUX_DM_IO_H
15 #include <linux/types.h>
18 struct block_device
*bdev
;
20 sector_t count
; /* If this is zero the region is ignored. */
24 struct page_list
*next
;
28 typedef void (*io_notify_fn
)(unsigned long error
, void *context
);
31 DM_IO_PAGE_LIST
,/* Page list */
32 DM_IO_BVEC
, /* Bio vector */
33 DM_IO_VMA
, /* Virtual memory area */
34 DM_IO_KMEM
, /* Kernel memory */
38 enum dm_io_mem_type type
;
51 io_notify_fn fn
; /* Callback for asynchronous requests */
52 void *context
; /* Passed to callback */
56 * IO request structure
59 struct dm_io_request
{
60 int bi_rw
; /* READ|WRITE - not READA */
61 struct dm_io_memory mem
; /* Memory to use for io */
62 struct dm_io_notify notify
; /* Synchronous if notify.fn is NULL */
63 struct dm_io_client
*client
; /* Client memory handler */
67 * For async io calls, users can alternatively use the dm_io() function below
68 * and dm_io_client_create() to create private mempools for the client.
70 * Create/destroy may block.
72 struct dm_io_client
*dm_io_client_create(void);
73 void dm_io_client_destroy(struct dm_io_client
*client
);
76 * IO interface using private per-client pools.
77 * Each bit in the optional 'sync_error_bits' bitset indicates whether an
78 * error occurred doing io to the corresponding region.
80 int dm_io(struct dm_io_request
*io_req
, unsigned num_regions
,
81 struct dm_io_region
*region
, unsigned long *sync_error_bits
);
83 #endif /* __KERNEL__ */
84 #endif /* _LINUX_DM_IO_H */