xref: /OK3568_Linux_fs/kernel/Documentation/block/null_blk.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun========================
4*4882a593SmuzhiyunNull block device driver
5*4882a593Smuzhiyun========================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunOverview
8*4882a593Smuzhiyun========
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunThe null block device (``/dev/nullb*``) is used for benchmarking the various
11*4882a593Smuzhiyunblock-layer implementations. It emulates a block device of X gigabytes in size.
12*4882a593SmuzhiyunIt does not execute any read/write operation, just mark them as complete in
13*4882a593Smuzhiyunthe request queue. The following instances are possible:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun  Multi-queue block-layer
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun    - Request-based.
18*4882a593Smuzhiyun    - Configurable submission queues per device.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun  No block-layer (Known as bio-based)
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun    - Bio-based. IO requests are submitted directly to the device driver.
23*4882a593Smuzhiyun    - Directly accepts bio data structure and returns them.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunAll of them have a completion queue for each core in the system.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunModule parameters
28*4882a593Smuzhiyun=================
29*4882a593Smuzhiyun
30*4882a593Smuzhiyunqueue_mode=[0-2]: Default: 2-Multi-queue
31*4882a593Smuzhiyun  Selects which block-layer the module should instantiate with.
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun  =  ============
34*4882a593Smuzhiyun  0  Bio-based
35*4882a593Smuzhiyun  1  Single-queue (deprecated)
36*4882a593Smuzhiyun  2  Multi-queue
37*4882a593Smuzhiyun  =  ============
38*4882a593Smuzhiyun
39*4882a593Smuzhiyunhome_node=[0--nr_nodes]: Default: NUMA_NO_NODE
40*4882a593Smuzhiyun  Selects what CPU node the data structures are allocated from.
41*4882a593Smuzhiyun
42*4882a593Smuzhiyungb=[Size in GB]: Default: 250GB
43*4882a593Smuzhiyun  The size of the device reported to the system.
44*4882a593Smuzhiyun
45*4882a593Smuzhiyunbs=[Block size (in bytes)]: Default: 512 bytes
46*4882a593Smuzhiyun  The block size reported to the system.
47*4882a593Smuzhiyun
48*4882a593Smuzhiyunnr_devices=[Number of devices]: Default: 1
49*4882a593Smuzhiyun  Number of block devices instantiated. They are instantiated as /dev/nullb0,
50*4882a593Smuzhiyun  etc.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyunirqmode=[0-2]: Default: 1-Soft-irq
53*4882a593Smuzhiyun  The completion mode used for completing IOs to the block-layer.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun  =  ===========================================================================
56*4882a593Smuzhiyun  0  None.
57*4882a593Smuzhiyun  1  Soft-irq. Uses IPI to complete IOs across CPU nodes. Simulates the overhead
58*4882a593Smuzhiyun     when IOs are issued from another CPU node than the home the device is
59*4882a593Smuzhiyun     connected to.
60*4882a593Smuzhiyun  2  Timer: Waits a specific period (completion_nsec) for each IO before
61*4882a593Smuzhiyun     completion.
62*4882a593Smuzhiyun  =  ===========================================================================
63*4882a593Smuzhiyun
64*4882a593Smuzhiyuncompletion_nsec=[ns]: Default: 10,000ns
65*4882a593Smuzhiyun  Combined with irqmode=2 (timer). The time each completion event must wait.
66*4882a593Smuzhiyun
67*4882a593Smuzhiyunsubmit_queues=[1..nr_cpus]: Default: 1
68*4882a593Smuzhiyun  The number of submission queues attached to the device driver. If unset, it
69*4882a593Smuzhiyun  defaults to 1. For multi-queue, it is ignored when use_per_node_hctx module
70*4882a593Smuzhiyun  parameter is 1.
71*4882a593Smuzhiyun
72*4882a593Smuzhiyunhw_queue_depth=[0..qdepth]: Default: 64
73*4882a593Smuzhiyun  The hardware queue depth of the device.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunMulti-queue specific parameters
76*4882a593Smuzhiyun-------------------------------
77*4882a593Smuzhiyun
78*4882a593Smuzhiyunuse_per_node_hctx=[0/1]: Default: 0
79*4882a593Smuzhiyun  Number of hardware context queues.
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun  =  =====================================================================
82*4882a593Smuzhiyun  0  The number of submit queues are set to the value of the submit_queues
83*4882a593Smuzhiyun     parameter.
84*4882a593Smuzhiyun  1  The multi-queue block layer is instantiated with a hardware dispatch
85*4882a593Smuzhiyun     queue for each CPU node in the system.
86*4882a593Smuzhiyun  =  =====================================================================
87*4882a593Smuzhiyun
88*4882a593Smuzhiyunno_sched=[0/1]: Default: 0
89*4882a593Smuzhiyun  Enable/disable the io scheduler.
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun  =  ======================================
92*4882a593Smuzhiyun  0  nullb* use default blk-mq io scheduler
93*4882a593Smuzhiyun  1  nullb* doesn't use io scheduler
94*4882a593Smuzhiyun  =  ======================================
95*4882a593Smuzhiyun
96*4882a593Smuzhiyunblocking=[0/1]: Default: 0
97*4882a593Smuzhiyun  Blocking behavior of the request queue.
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun  =  ===============================================================
100*4882a593Smuzhiyun  0  Register as a non-blocking blk-mq driver device.
101*4882a593Smuzhiyun  1  Register as a blocking blk-mq driver device, null_blk will set
102*4882a593Smuzhiyun     the BLK_MQ_F_BLOCKING flag, indicating that it sometimes/always
103*4882a593Smuzhiyun     needs to block in its ->queue_rq() function.
104*4882a593Smuzhiyun  =  ===============================================================
105*4882a593Smuzhiyun
106*4882a593Smuzhiyunshared_tags=[0/1]: Default: 0
107*4882a593Smuzhiyun  Sharing tags between devices.
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun  =  ================================================================
110*4882a593Smuzhiyun  0  Tag set is not shared.
111*4882a593Smuzhiyun  1  Tag set shared between devices for blk-mq. Only makes sense with
112*4882a593Smuzhiyun     nr_devices > 1, otherwise there's no tag set to share.
113*4882a593Smuzhiyun  =  ================================================================
114*4882a593Smuzhiyun
115*4882a593Smuzhiyunzoned=[0/1]: Default: 0
116*4882a593Smuzhiyun  Device is a random-access or a zoned block device.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun  =  ======================================================================
119*4882a593Smuzhiyun  0  Block device is exposed as a random-access block device.
120*4882a593Smuzhiyun  1  Block device is exposed as a host-managed zoned block device. Requires
121*4882a593Smuzhiyun     CONFIG_BLK_DEV_ZONED.
122*4882a593Smuzhiyun  =  ======================================================================
123*4882a593Smuzhiyun
124*4882a593Smuzhiyunzone_size=[MB]: Default: 256
125*4882a593Smuzhiyun  Per zone size when exposed as a zoned block device. Must be a power of two.
126*4882a593Smuzhiyun
127*4882a593Smuzhiyunzone_nr_conv=[nr_conv]: Default: 0
128*4882a593Smuzhiyun  The number of conventional zones to create when block device is zoned.  If
129*4882a593Smuzhiyun  zone_nr_conv >= nr_zones, it will be reduced to nr_zones - 1.
130