Skip to contentSkip to conversation

block/024: disable IO requests merging

PATCH New Jeffle Xu 1 participant 1 message Jul 17, 2019 Block layer

lore
Share & tools
lore

Jeffle Xu

author
#0 lore raw

PATCH 1/1 block/024: disable IO requests merging

block/024 works in a way that, if we submit N bio requests and each bio requests will consume M ns, then the total time consumed should be (N * M) ns.

However there may be some merging of write bio requests, and thus the value of the "write ticks" filed of "/sys/block/<dev>/stat" may be less than what we expect.

For example, running the following script,

```sh

modprobe -r null_blk
modprobe null_blk queue_mode=2 irqmode=2 completion_nsec=500000
dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 status=none &
dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 status=none &
wait
cat /sys/block/nullb0/stat
```

and we get output

```
       1        0        8        0     2626      411    28800     1388        0      943     1444        0        0        0        0
```

In this case, we submit 3600 (1800 * 2) write bio requests, among which 411 bio requests are merged (2626 + 411 * 2 = 3448).

Thus we need to disable the merging of bio requests by

```
```
---
 tests/block/024 | 3 +++
 1 file changed, 3 insertions(+)
tests/block/024 +3 -0
index b40a869..0ffc63f 100755
@@ -42,6 +42,9 @@ test() {
 		return 1
 	fi
 
+    # Disable IO request merging
+    echo 2 > /sys/block/nullb0/queue/nomerges
+
 	init_times
 	show_times
 
Signature · 1 line
1.8.3.1