解决多线程dmabuffer竞态问题
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
typedef struct zvfs_blob_handle {
|
||||
spdk_blob_id blob_id;
|
||||
struct spdk_blob *blob;
|
||||
void *dma_buf;
|
||||
uint64_t dma_buf_size;
|
||||
atomic_uint ref_count;
|
||||
} zvfs_blob_handle_t;
|
||||
|
||||
@@ -48,13 +46,27 @@ typedef struct zvfs_spdk_io_engine {
|
||||
|
||||
uint64_t io_unit_size;
|
||||
uint64_t cluster_size;
|
||||
|
||||
|
||||
/**
|
||||
* 全局 DMA buf pool。
|
||||
* 所有 IO 请求(read / write)从这里借用 buf,完成后归还。
|
||||
* buf 大小固定为 ZVFS_DMA_BUF_SIZE(1MB),对齐到 io_unit_size。
|
||||
* 在 io_engine_init 完成、io_unit_size 确定后创建。
|
||||
*/
|
||||
struct dma_buf_pool *dma_pool;
|
||||
} zvfs_spdk_io_engine_t;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* handle cache 操作(实现在 spdk_engine.c) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
int engine_cache_insert(struct zvfs_blob_handle *handle, zvfs_handle_id_t *out_id);
|
||||
struct zvfs_blob_handle *engine_cache_lookup(zvfs_handle_id_t handle_id);
|
||||
void engine_cache_remove(zvfs_handle_id_t handle_id);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* 引擎公开接口 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
int io_engine_init(const char *bdev_name, const char *json_file, int thread_num);
|
||||
int blob_create(struct zvfs_req *req);
|
||||
int blob_open(struct zvfs_req *req);
|
||||
|
||||
Reference in New Issue
Block a user