0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 ========================
0004 Null block device driver
0005 ========================
0006
0007 Overview
0008 ========
0009
0010 The null block device (``/dev/nullb*``) is used for benchmarking the various
0011 block-layer implementations. It emulates a block device of X gigabytes in size.
0012 It does not execute any read/write operation, just mark them as complete in
0013 the request queue. The following instances are possible:
0014
0015 Multi-queue block-layer
0016
0017 - Request-based.
0018 - Configurable submission queues per device.
0019
0020 No block-layer (Known as bio-based)
0021
0022 - Bio-based. IO requests are submitted directly to the device driver.
0023 - Directly accepts bio data structure and returns them.
0024
0025 All of them have a completion queue for each core in the system.
0026
0027 Module parameters
0028 =================
0029
0030 queue_mode=[0-2]: Default: 2-Multi-queue
0031 Selects which block-layer the module should instantiate with.
0032
0033 = ============
0034 0 Bio-based
0035 1 Single-queue (deprecated)
0036 2 Multi-queue
0037 = ============
0038
0039 home_node=[0--nr_nodes]: Default: NUMA_NO_NODE
0040 Selects what CPU node the data structures are allocated from.
0041
0042 gb=[Size in GB]: Default: 250GB
0043 The size of the device reported to the system.
0044
0045 bs=[Block size (in bytes)]: Default: 512 bytes
0046 The block size reported to the system.
0047
0048 nr_devices=[Number of devices]: Default: 1
0049 Number of block devices instantiated. They are instantiated as /dev/nullb0,
0050 etc.
0051
0052 irqmode=[0-2]: Default: 1-Soft-irq
0053 The completion mode used for completing IOs to the block-layer.
0054
0055 = ===========================================================================
0056 0 None.
0057 1 Soft-irq. Uses IPI to complete IOs across CPU nodes. Simulates the overhead
0058 when IOs are issued from another CPU node than the home the device is
0059 connected to.
0060 2 Timer: Waits a specific period (completion_nsec) for each IO before
0061 completion.
0062 = ===========================================================================
0063
0064 completion_nsec=[ns]: Default: 10,000ns
0065 Combined with irqmode=2 (timer). The time each completion event must wait.
0066
0067 submit_queues=[1..nr_cpus]: Default: 1
0068 The number of submission queues attached to the device driver. If unset, it
0069 defaults to 1. For multi-queue, it is ignored when use_per_node_hctx module
0070 parameter is 1.
0071
0072 hw_queue_depth=[0..qdepth]: Default: 64
0073 The hardware queue depth of the device.
0074
0075 memory_backed=[0/1]: Default: 0
0076 Whether or not to use a memory buffer to respond to IO requests
0077
0078 = =============================================
0079 0 Transfer no data in response to IO requests
0080 1 Use a memory buffer to respond to IO requests
0081 = =============================================
0082
0083 discard=[0/1]: Default: 0
0084 Support discard operations (requires memory-backed null_blk device).
0085
0086 = =====================================
0087 0 Do not support discard operations
0088 1 Enable support for discard operations
0089 = =====================================
0090
0091 cache_size=[Size in MB]: Default: 0
0092 Cache size in MB for memory-backed device.
0093
0094 mbps=[Maximum bandwidth in MB/s]: Default: 0 (no limit)
0095 Bandwidth limit for device performance.
0096
0097 Multi-queue specific parameters
0098 -------------------------------
0099
0100 use_per_node_hctx=[0/1]: Default: 0
0101 Number of hardware context queues.
0102
0103 = =====================================================================
0104 0 The number of submit queues are set to the value of the submit_queues
0105 parameter.
0106 1 The multi-queue block layer is instantiated with a hardware dispatch
0107 queue for each CPU node in the system.
0108 = =====================================================================
0109
0110 no_sched=[0/1]: Default: 0
0111 Enable/disable the io scheduler.
0112
0113 = ======================================
0114 0 nullb* use default blk-mq io scheduler
0115 1 nullb* doesn't use io scheduler
0116 = ======================================
0117
0118 blocking=[0/1]: Default: 0
0119 Blocking behavior of the request queue.
0120
0121 = ===============================================================
0122 0 Register as a non-blocking blk-mq driver device.
0123 1 Register as a blocking blk-mq driver device, null_blk will set
0124 the BLK_MQ_F_BLOCKING flag, indicating that it sometimes/always
0125 needs to block in its ->queue_rq() function.
0126 = ===============================================================
0127
0128 shared_tags=[0/1]: Default: 0
0129 Sharing tags between devices.
0130
0131 = ================================================================
0132 0 Tag set is not shared.
0133 1 Tag set shared between devices for blk-mq. Only makes sense with
0134 nr_devices > 1, otherwise there's no tag set to share.
0135 = ================================================================
0136
0137 zoned=[0/1]: Default: 0
0138 Device is a random-access or a zoned block device.
0139
0140 = ======================================================================
0141 0 Block device is exposed as a random-access block device.
0142 1 Block device is exposed as a host-managed zoned block device. Requires
0143 CONFIG_BLK_DEV_ZONED.
0144 = ======================================================================
0145
0146 zone_size=[MB]: Default: 256
0147 Per zone size when exposed as a zoned block device. Must be a power of two.
0148
0149 zone_nr_conv=[nr_conv]: Default: 0
0150 The number of conventional zones to create when block device is zoned. If
0151 zone_nr_conv >= nr_zones, it will be reduced to nr_zones - 1.