Block layer introduction part 2: the request layer

By Neil Brown  November 9, 2017, lwn.net

The Linux block layer provides an upstream interface to filesystems and block-special devices allowing them to access a multitude of storage backends in a uniform …

more ...

A block layer introduction part 1: the bio layer


single queue VS multiqueue


The multiqueue block layer

Jonathan Corbet  June 5, 2013, lwn.net

The kernel's block layer is charged with managing I/O to the system's block ("disk drive") devices. It was designed in an era when a high-performance drive …

more ...

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 …

more ...

lsblk - list information about block devices

The lsblk command is part of the util-linux package. lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs …

more ...

Concurrency Managed Workqueue (cmwq)

Whenever a driver or subsystem wants a function to be executed asynchronously it has to set up a work item pointing to that function and queue that work item on a workqueue.

There are many cases where an asynchronous process execution context is needed and …

more ...

atomic_xchg & atomic_cmpxchg

If someone wants to use xchg(), cmpxchg() and their variants, linux/atomic.h should be included rather than asm/cmpxchg.h, unless the code is in arch/* and can take care of itself.

    "compare and swap" atomically:
        1) Compares "old" with the value currently at …
more ...

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 ...