dm-bufio
可以理解为 device-mapper framework 自己实现的简单 buf 库(dm 喜欢自己封装提供自己的 API 接口,这样的好处是可以隐藏 block layer 的一些变动,不好的地方是熟悉这些 API 需要时间,好在实现简洁易懂,实际中用到的时候可以方便查看实现细节),可以看作是 dm 的 malloc 库,dm_bufio_client 看作 buf pool 的句柄,dm_buffer 看作 pool 中单个 buf 句柄。用户有了这些句柄之后,就可以读写数据到 buf;与 malloc 不同的是,dm-bufio …
more ...struct target_type
系统中注册的 target_type 都链入 static LIST_HEAD(_targets)
中
int dm_register_target(struct target_type *tt)
向系统中注册 target_type,如果之前已经注册过了则返回 -EEXIST,否则成功注册并返回 0
void dm_unregister_target(struct target_type *tt)
从系统中注销 target_type,如果之前没有注册过,则报错 Unregistering unrecognised target: <target_type->name>
并 BUG()
,否则移出 static LIST_HEAD(_targets)
int dm_target_iterate …
kcopyd
kcopyd 提供的是一个易于使用的接口,隐藏了异步:dm-kcopyd.c 重点在于 "d",即对 kcopyd_jobs 的异步管理,而 copy 相关的具体 async IO 细节在 dm-io.c 中实现
kcopyd provides the ability to copy a range of sectors from one block-device to one or more other block-devices, with …
more ...dm-io
dm-io provides synchronous and asynchronous I/O services. There are 4 types of I/O services available, and each type has a sync and an async version.
The user must set up an dm_io_region structure to describe the desired location …
more ...