Lines Matching refs:a

1 # Writing a Custom Block Device Module {#bdev_module}
6 device modules to integrate with SPDK's bdev layer. For a guide on how to use
11 A block device module is SPDK's equivalent of a device driver in a traditional
12 operating system. The module provides a set of function pointers that are
13 called to service block device I/O requests. SPDK provides a number of block
17 how to write a module.
22 currently possible to place the code for a bdev module elsewhere, but updates
23 to the build system could be made to enable this in the future. To create a
24 module, add a new directory with a single C file and a Makefile. A great
28 include/spdk/bdev_module.h. In that header a macro is defined that registers
29 a new bdev module - SPDK_BDEV_MODULE_REGISTER. This macro take as argument a
35 will be allocated in each I/O request for use by this module, and a callback
36 that will be called each time a new bdev is registered by another module
43 module must allocate a struct spdk_bdev, fill it out appropriately, and pass
49 * Function table for a block device backend.
51 * The backend block device function table provides a set of APIs to allow
52 * communication with a backend. The main commands are read/write API
62 /* Check if the block device supports a specific I/O type. */
69 * Output driver-specific configuration to a JSON stream. Optional - may be NULL.
72 * driver should write a name (based on the driver name) followed by a JSON value
88 freeing memory or it may be shutting down a piece of hardware.
90 The `io_type_supported` function returns whether a particular I/O type is
111 referred to as "trim" or "deallocate", and is a request to mark a set of
112 blocks as no longer containing valid data. `SPDK_BDEV_IO_TYPE_FLUSH` is a
114 require flushes. `SPDK_BDEV_IO_TYPE_WRITE_ZEROES` is just like a regular
115 write, but does not provide a data buffer (it would have just contained all
119 `SPDK_BDEV_IO_TYPE_RESET` is a request to abort all I/O and return the
129 The `get_io_channel` function should return an I/O channel. For a detailed
140 Integrating a new bdev module into the build system requires updates to various
146 test/external_code serves as a template for creating, building and linking an external
152 the I/O to other block devices. The canonical example would be a bdev module
159 way, the virtual bdev should take a claim on the underlying bdev before
164 claims that ensure there is a single writer with
168 `spdk_bdev_open_ext()` may be used to open the underlying bdev read-only. If a
169 read-only bdev descriptor successfully claims a bdev with
177 The non-preferred interface for obtaining a claim allows the caller to obtain
179 be released with `spdk_bdev_module_release_bdev()`. If a read-only bdev
181 of a bdev descriptor to avoid promotion and to block new writers. New code
192 When a virtual bdev module claims an underlying bdev from its `examine_config`
194 module and any others that establish a shared claim. If no claims are taken by