1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2003 Sistina Software
4 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
6 * Device-Mapper low-level I/O.
8 * This file is released under the GPL.
11 #ifndef _LINUX_DM_IO_H
12 #define _LINUX_DM_IO_H
16 #include <linux/types.h>
17 #include <linux/blk_types.h>
20 struct block_device *bdev;
22 sector_t count; /* If this is zero the region is ignored. */
26 struct page_list *next;
30 typedef void (*io_notify_fn)(unsigned int long error, void *context);
33 DM_IO_PAGE_LIST,/* Page list */
34 DM_IO_BIO, /* Bio vector */
35 DM_IO_VMA, /* Virtual memory area */
36 DM_IO_KMEM, /* Kernel memory */
40 enum dm_io_mem_type type;
53 io_notify_fn fn; /* Callback for asynchronous requests */
54 void *context; /* Passed to callback */
58 * IO request structure
61 struct dm_io_request {
62 blk_opf_t bi_opf; /* Request type and flags */
63 struct dm_io_memory mem; /* Memory to use for io */
64 struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */
65 struct dm_io_client *client; /* Client memory handler */
69 * For async io calls, users can alternatively use the dm_io() function below
70 * and dm_io_client_create() to create private mempools for the client.
72 * Create/destroy may block.
74 struct dm_io_client *dm_io_client_create(void);
75 void dm_io_client_destroy(struct dm_io_client *client);
78 * IO interface using private per-client pools.
79 * Each bit in the optional 'sync_error_bits' bitset indicates whether an
80 * error occurred doing io to the corresponding region.
82 int dm_io(struct dm_io_request *io_req, unsigned int num_regions,
83 struct dm_io_region *region, unsigned int long *sync_error_bits);
85 #endif /* __KERNEL__ */
86 #endif /* _LINUX_DM_IO_H */