mbox series

[0/2] block: set per bio io-priority in blk-lib

Message ID 20190415055703.5512-1-chaitanya.kulkarni@wdc.com (mailing list archive)
Headers show
Series block: set per bio io-priority in blk-lib | expand

Message

Chaitanya Kulkarni April 15, 2019, 5:57 a.m. UTC
Hi,

While experimenting with the ionice I came across the scenario where
I cannot see the bio's priority field been set when use blkdiscard
for REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES.

This is a small patch-series which initializes the bio->bi_ioprio
(iopriority) field under different operations like REQ_OP_DISCARD and
REQ_OP_WRITE_ZEROES. It helps to track the priority when debugging.

In order to test this I've modified the null_blk and enabled the
write_zeroes through module param. Following are the results.

Without this patches :- 

# git log -1 --oneline
4443f8e6ac77 (HEAD -> master, origin/master, origin/HEAD) Merge tag 'for-linus-20190412' of git://git.kernel.dk/linux-block
# modprobe null_blk gb=5 nr_devices=1 write_zeroes=1
# for prio in `seq 0 3`; do ionice -c ${prio} blkdiscard -z -o 0 -l 4096 /dev/nullb0; done
# dmesg  -c 
[  402.958458] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 0
[  402.966024] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 0
[  402.973960] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 0
[  402.981373] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 0
# 

After thiese patches :-

# git log --oneline -2 
7a54a31cad5c (HEAD -> master) block: add task priority to init bio iopriority
149603fbd421 block: adjust code for get_task_ioprio()
# modprobe null_blk gb=5 nr_devices=1 write_zeroes=1
# for prio in `seq 0 3`; do ionice -c ${prio} blkdiscard -z -o 0 -l 4096 /dev/nullb0; done 
# dmesg  -c 
[ 1426.091772] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 0
[ 1426.100177] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 1
[ 1426.108035] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 2
[ 1426.115768] null_handle_cmd 1220 REQ_OP_WRITE_ZEROES priority class 3
# 

Regards,
Chaitanya

Chaitanya Kulkarni (2):
  block: adjust code for get_task_ioprio()
  block: add task priority to init bio iopriority

 block/blk-lib.c        |  6 ++++++
 block/ioprio.c         | 20 ++++++++++++++++----
 include/linux/ioprio.h |  2 ++
 3 files changed, 24 insertions(+), 4 deletions(-)