#include "bdev-enum.h"
#include "mbuf.h"
#include <spdk/bdev.h>
Go to the source code of this file.
◆ Bdev
Block device and related information.
◆ BdevRequest
◆ BdevRequestCb
typedef void(* BdevRequestCb) (BdevRequest *req, int res) |
◆ BdevStoredPacket
Length and alignment descriptor of a stored packet.
◆ anonymous enum
Enumerator |
---|
BdevBlockSize | Expected block size; other block sizes are not supported.
|
BdevMaxMbufSegs | Maximum packet segments acceptable to Bdev_ReadPacket and Bdev_WritePacket.
|
◆ Bdev_ReadPacket()
void Bdev_ReadPacket |
( |
Bdev * |
bd, |
|
|
struct spdk_io_channel * |
ch, |
|
|
uint64_t |
blockOffset, |
|
|
BdevRequest * |
req |
|
) |
| |
Read block device into mbuf.
- Precondition
- This must be called in a SPDK thread.
- Parameters
-
ch | an SPDK I/O channel associated with the bdev and the current SPDK thread. |
req | request context. All fields must be kept alive until req->cb is called. |
req->pkt
must be a uniquely owned, unsegmented, direct mbuf with sufficient dataroom. req->pkt->data_off
may be adjusted (either increased or decreased) to achieve proper alignment as required by SPDK bdev driver.
◆ Bdev_WritePacket()
void Bdev_WritePacket |
( |
Bdev * |
bd, |
|
|
struct spdk_io_channel * |
ch, |
|
|
uint64_t |
blockOffset, |
|
|
BdevRequest * |
req |
|
) |
| |
Write block device from mbuf via scatter gather list.
- Precondition
- This must be called in a SPDK thread.
- Parameters
-
ch | an SPDK I/O channel associated with the bdev and the current SPDK thread. |
req | request context. req->sp may be freed after this function returns. All other fields must be kept alive until req->cb is called. |
req->pkt->pkt_len
determines write length. Some headroom and tailroom in each mbuf segment may be written to disk to achieve proper alignment as required by SPDK bdev driver, but they will not appear in readback if the same BdevStorePacket
is passed.
◆ Bdev_WritePrepare()
Prepare writing according to bdev alignment requirements.
- Parameters
-
[in] | pkt | input packet; cannot be modified between this call and Bdev_WritePacket . |
[out] | sp | stored packet alignment information, needed to later recover the packet. |
- Returns
- whether success.
◆ BdevFiller_