All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] null_blk: null_alloc_page() cleanup
@ 2022-02-22 15:28 Chaitanya Kulkarni
  2022-02-22 15:28 ` [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-22 15:28 UTC (permalink / raw)
  To: linux-block
  Cc: axboe, ming.lei, damien.lemoal, shinichiro.kawasaki, Chaitanya Kulkarni

Hi,

This has null_alloc_page() cleanup to remvoe the unwanted function
parameter and remove function goto labels where we can return easily.

Below is the test log of memory backed null_blk with fio verify job and
blktests output.

-ck

Chaitanya Kulkarni (2):
  null_blk: remove hardcoded null_alloc_page() param
  null_blk: null_alloc_page() cleanup

 drivers/block/null_blk/main.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

root@dev linux-block (for-next) # gitlog -2
a87f21820d03 (HEAD -> for-next) Merge branch 'for-next' of git://git.kernel.dk/linux-block into for-next
bc2959102cb9 (origin/for-next) Merge branch 'for-5.18/block' into for-next
root@dev linux-block (for-next) # git am p/null-blk-alloc_page/*patch  ; git am --skip 
Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Applying: null_blk: remove hardcoded null_alloc_page() param
Applying: null_blk: null_alloc_page() cleanup
root@dev linux-block (for-next) # ./compile_nullb.sh 
+ umount /mnt/nullb0
umount: /mnt/nullb0: not mounted.
+ rmdir 'config/nullb/nullb*'
rmdir: failed to remove 'config/nullb/nullb*': No such file or directory
+ dmesg -c
+ modprobe -r null_blk
+ lsmod
+ grep null_blk
+ git apply wip.diff
++ nproc
+ make -j 48 M=drivers/block modules
  CC [M]  drivers/block/pktcdvd.o
  CC [M]  drivers/block/null_blk/main.o
  LD [M]  drivers/block/null_blk/null_blk.o
  MODPOST drivers/block/Module.symvers
  LD [M]  drivers/block/null_blk/null_blk.ko
  LD [M]  drivers/block/pktcdvd.ko
+ HOST=drivers/block/null_blk/
++ uname -r
+ HOST_DEST=/lib/modules/5.17.0-rc3blk+/kernel/drivers/block/null_blk/
+ cp drivers/block/null_blk//null_blk.ko /lib/modules/5.17.0-rc3blk+/kernel/drivers/block/null_blk//
+ ls -lrth /lib/modules/5.17.0-rc3blk+/kernel/drivers/block/null_blk//null_blk.ko
-rw-r--r--. 1 root root 1.1M Feb 22 06:47 /lib/modules/5.17.0-rc3blk+/kernel/drivers/block/null_blk//null_blk.ko
+ sleep 1
+ git checkout include/scsi/scsi_device.h
Updated 1 path from the index
+ dmesg -c
root@dev linux-block (for-next) # ./nullbtests.sh 3
+ rmdir 'config/nullb/nullb*'
rmdir: failed to remove 'config/nullb/nullb*': No such file or directory
+ NN=3
+ modprobe -r null_blk
+ modprobe null_blk nr_devices=0
+ echo loading devices
loading devices
++ seq 0 3
+ for i in `seq 0 $NN`
+ NULLB_DIR=config/nullb/nullb0
+ mkdir config/nullb/nullb0
+ echo 1
+ echo 4096
+ echo 2048
+ echo 2
+ cat config/nullb/nullb0/queue_mode
2
+ echo 1
++ cat config/nullb/nullb0/index
+ IDX=0
+ echo -n ' 0 '
 0 + sleep .50
+ for i in `seq 0 $NN`
+ NULLB_DIR=config/nullb/nullb1
+ mkdir config/nullb/nullb1
+ echo 1
+ echo 4096
+ echo 2048
+ echo 2
+ cat config/nullb/nullb1/queue_mode
2
+ echo 1
++ cat config/nullb/nullb1/index
+ IDX=1
+ echo -n ' 1 '
 1 + sleep .50
+ for i in `seq 0 $NN`
+ NULLB_DIR=config/nullb/nullb2
+ mkdir config/nullb/nullb2
+ echo 1
+ echo 4096
+ echo 2048
+ echo 2
+ cat config/nullb/nullb2/queue_mode
2
+ echo 1
++ cat config/nullb/nullb2/index
+ IDX=2
+ echo -n ' 2 '
 2 + sleep .50
+ for i in `seq 0 $NN`
+ NULLB_DIR=config/nullb/nullb3
+ mkdir config/nullb/nullb3
+ echo 1
+ echo 4096
+ echo 2048
+ echo 2
+ cat config/nullb/nullb3/queue_mode
2
+ echo 1
++ cat config/nullb/nullb3/index
+ IDX=3
+ echo -n ' 3 '
 3 + sleep .50
+ lsblk
+ grep null
+ sort
nullb0  251:0    0    2G  0 disk 
nullb1  251:1    0    2G  0 disk 
nullb2  251:2    0    2G  0 disk 
nullb3  251:3    0    2G  0 disk 
+ sleep 1
+ dmesg -c
[ 1086.952379] null_blk: module loaded
+ lsblk
+ grep null
nullb0  251:0    0    2G  0 disk 
nullb1  251:1    0    2G  0 disk 
nullb2  251:2    0    2G  0 disk 
nullb3  251:3    0    2G  0 disk 
++ seq 0 3
+ for i in `seq 0 $NN`
+ fio fio/verify.fio --filename=/dev/nullb0
write-and-verify: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.27
Starting 1 process
Jobs: 1 (f=1)
write-and-verify: (groupid=0, jobs=1): err= 0: pid=13415: Tue Feb 22 06:47:54 2022
  read: IOPS=93.8k, BW=366MiB/s (384MB/s)(158MiB/431msec)
    slat (nsec): min=7755, max=30347, avg=8214.90, stdev=1225.66
    clat (usec): min=3, max=202, avg=161.41, stdev= 5.89
     lat (usec): min=11, max=210, avg=169.69, stdev= 5.99
    clat percentiles (usec):
     |  1.00th=[  157],  5.00th=[  157], 10.00th=[  157], 20.00th=[  157],
     | 30.00th=[  159], 40.00th=[  159], 50.00th=[  159], 60.00th=[  159],
     | 70.00th=[  163], 80.00th=[  167], 90.00th=[  172], 95.00th=[  174],
     | 99.00th=[  178], 99.50th=[  180], 99.90th=[  188], 99.95th=[  190],
     | 99.99th=[  202]
  write: IOPS=80.0k, BW=313MiB/s (328MB/s)(250MiB/800msec); 0 zone resets
    slat (usec): min=8, max=447, avg=10.37, stdev= 3.22
    clat (usec): min=3, max=434, avg=188.97, stdev=34.29
     lat (usec): min=12, max=801, avg=199.41, stdev=36.21
    clat percentiles (usec):
     |  1.00th=[  169],  5.00th=[  174], 10.00th=[  174], 20.00th=[  176],
     | 30.00th=[  178], 40.00th=[  180], 50.00th=[  182], 60.00th=[  184],
     | 70.00th=[  188], 80.00th=[  192], 90.00th=[  198], 95.00th=[  204],
     | 99.00th=[  375], 99.50th=[  392], 99.90th=[  404], 99.95th=[  408],
     | 99.99th=[  429]
   bw (  KiB/s): min=201320, max=310680, per=80.00%, avg=256000.00, stdev=77329.20, samples=2
   iops        : min=50330, max=77670, avg=64000.00, stdev=19332.30, samples=2
  lat (usec)   : 4=0.01%, 20=0.01%, 50=0.01%, 100=0.01%, 250=97.53%
  lat (usec)   : 500=2.45%
  cpu          : usr=13.66%, sys=86.26%, ctx=1, majf=0, minf=966
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=40428,64000,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=366MiB/s (384MB/s), 366MiB/s-366MiB/s (384MB/s-384MB/s), io=158MiB (166MB), run=431-431msec
  WRITE: bw=313MiB/s (328MB/s), 313MiB/s-313MiB/s (328MB/s-328MB/s), io=250MiB (262MB), run=800-800msec

Disk stats (read/write):
  nullb0: ios=27074/64000, merge=0/0, ticks=42/177, in_queue=219, util=91.51%
+ for i in `seq 0 $NN`
+ fio fio/verify.fio --filename=/dev/nullb1
write-and-verify: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.27
Starting 1 process
Jobs: 1 (f=1)
write-and-verify: (groupid=0, jobs=1): err= 0: pid=13418: Tue Feb 22 06:47:55 2022
  read: IOPS=90.4k, BW=353MiB/s (370MB/s)(158MiB/448msec)
    slat (nsec): min=7664, max=36409, avg=8462.57, stdev=1693.70
    clat (usec): min=3, max=307, avg=167.50, stdev=12.40
     lat (usec): min=17, max=322, avg=176.03, stdev=12.82
    clat percentiles (usec):
     |  1.00th=[  157],  5.00th=[  159], 10.00th=[  161], 20.00th=[  161],
     | 30.00th=[  163], 40.00th=[  163], 50.00th=[  163], 60.00th=[  165],
     | 70.00th=[  169], 80.00th=[  174], 90.00th=[  178], 95.00th=[  182],
     | 99.00th=[  233], 99.50th=[  258], 99.90th=[  289], 99.95th=[  293],
     | 99.99th=[  302]
  write: IOPS=76.9k, BW=300MiB/s (315MB/s)(250MiB/832msec); 0 zone resets
    slat (usec): min=7, max=681, avg=10.81, stdev= 4.43
    clat (usec): min=3, max=1057, avg=196.71, stdev=50.00
     lat (usec): min=12, max=1080, avg=207.59, stdev=52.64
    clat percentiles (usec):
     |  1.00th=[  172],  5.00th=[  174], 10.00th=[  174], 20.00th=[  176],
     | 30.00th=[  178], 40.00th=[  180], 50.00th=[  182], 60.00th=[  184],
     | 70.00th=[  188], 80.00th=[  192], 90.00th=[  212], 95.00th=[  351],
     | 99.00th=[  388], 99.50th=[  396], 99.90th=[  537], 99.95th=[  578],
     | 99.99th=[  971]
   bw (  KiB/s): min=220328, max=291672, per=83.20%, avg=256000.00, stdev=50447.83, samples=2
   iops        : min=55082, max=72918, avg=64000.00, stdev=12611.96, samples=2
  lat (usec)   : 4=0.01%, 20=0.01%, 50=0.01%, 100=0.01%, 250=94.16%
  lat (usec)   : 500=5.73%, 750=0.07%, 1000=0.01%
  lat (msec)   : 2=0.01%
  cpu          : usr=14.86%, sys=85.14%, ctx=3, majf=0, minf=967
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=40495,64000,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=353MiB/s (370MB/s), 353MiB/s-353MiB/s (370MB/s-370MB/s), io=158MiB (166MB), run=448-448msec
  WRITE: bw=300MiB/s (315MB/s), 300MiB/s-300MiB/s (315MB/s-315MB/s), io=250MiB (262MB), run=832-832msec

Disk stats (read/write):
  nullb1: ios=27149/64000, merge=0/0, ticks=45/185, in_queue=231, util=91.81%
+ for i in `seq 0 $NN`
+ fio fio/verify.fio --filename=/dev/nullb2
write-and-verify: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.27
Starting 1 process
Jobs: 1 (f=1)
write-and-verify: (groupid=0, jobs=1): err= 0: pid=13428: Tue Feb 22 06:47:57 2022
  read: IOPS=94.3k, BW=368MiB/s (386MB/s)(158MiB/429msec)
    slat (nsec): min=7705, max=37021, avg=8173.44, stdev=1307.59
    clat (usec): min=3, max=223, avg=160.64, stdev= 6.55
     lat (usec): min=11, max=231, avg=168.87, stdev= 6.70
    clat percentiles (usec):
     |  1.00th=[  155],  5.00th=[  157], 10.00th=[  157], 20.00th=[  157],
     | 30.00th=[  157], 40.00th=[  157], 50.00th=[  157], 60.00th=[  159],
     | 70.00th=[  161], 80.00th=[  167], 90.00th=[  172], 95.00th=[  174],
     | 99.00th=[  180], 99.50th=[  186], 99.90th=[  208], 99.95th=[  210],
     | 99.99th=[  219]
  write: IOPS=80.5k, BW=314MiB/s (330MB/s)(250MiB/795msec); 0 zone resets
    slat (nsec): min=8055, max=92325, avg=10308.42, stdev=2763.18
    clat (usec): min=3, max=430, avg=187.82, stdev=34.03
     lat (usec): min=13, max=454, avg=198.19, stdev=35.85
    clat percentiles (usec):
     |  1.00th=[  169],  5.00th=[  172], 10.00th=[  174], 20.00th=[  176],
     | 30.00th=[  176], 40.00th=[  178], 50.00th=[  180], 60.00th=[  182],
     | 70.00th=[  186], 80.00th=[  190], 90.00th=[  196], 95.00th=[  206],
     | 99.00th=[  371], 99.50th=[  383], 99.90th=[  404], 99.95th=[  416],
     | 99.99th=[  424]
   bw (  KiB/s): min=199456, max=312544, per=79.50%, avg=256000.00, stdev=79965.29, samples=2
   iops        : min=49864, max=78136, avg=64000.00, stdev=19991.32, samples=2
  lat (usec)   : 4=0.01%, 20=0.01%, 50=0.01%, 100=0.01%, 250=97.45%
  lat (usec)   : 500=2.53%
  cpu          : usr=15.04%, sys=84.79%, ctx=1, majf=0, minf=966
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=40451,64000,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=368MiB/s (386MB/s), 368MiB/s-368MiB/s (386MB/s-386MB/s), io=158MiB (166MB), run=429-429msec
  WRITE: bw=314MiB/s (330MB/s), 314MiB/s-314MiB/s (330MB/s-330MB/s), io=250MiB (262MB), run=795-795msec

Disk stats (read/write):
  nullb2: ios=29364/64000, merge=0/0, ticks=45/174, in_queue=220, util=91.64%
+ for i in `seq 0 $NN`
+ fio fio/verify.fio --filename=/dev/nullb3
write-and-verify: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.27
Starting 1 process
Jobs: 1 (f=1)
write-and-verify: (groupid=0, jobs=1): err= 0: pid=13431: Tue Feb 22 06:47:58 2022
  read: IOPS=96.2k, BW=376MiB/s (394MB/s)(158MiB/421msec)
    slat (nsec): min=7393, max=52019, avg=7988.62, stdev=1575.15
    clat (usec): min=3, max=264, avg=157.17, stdev=10.48
     lat (usec): min=11, max=280, avg=165.22, stdev=10.81
    clat percentiles (usec):
     |  1.00th=[  151],  5.00th=[  151], 10.00th=[  151], 20.00th=[  153],
     | 30.00th=[  153], 40.00th=[  153], 50.00th=[  153], 60.00th=[  155],
     | 70.00th=[  157], 80.00th=[  163], 90.00th=[  167], 95.00th=[  169],
     | 99.00th=[  208], 99.50th=[  231], 99.90th=[  251], 99.95th=[  255],
     | 99.99th=[  265]
  write: IOPS=81.8k, BW=320MiB/s (335MB/s)(250MiB/782msec); 0 zone resets
    slat (usec): min=7, max=201, avg=10.15, stdev= 3.28
    clat (usec): min=3, max=689, avg=184.88, stdev=37.38
     lat (usec): min=13, max=699, avg=195.10, stdev=39.33
    clat percentiles (usec):
     |  1.00th=[  163],  5.00th=[  167], 10.00th=[  167], 20.00th=[  169],
     | 30.00th=[  172], 40.00th=[  174], 50.00th=[  176], 60.00th=[  178],
     | 70.00th=[  182], 80.00th=[  186], 90.00th=[  194], 95.00th=[  258],
     | 99.00th=[  375], 99.50th=[  383], 99.90th=[  404], 99.95th=[  412],
     | 99.99th=[  586]
   bw (  KiB/s): min=193824, max=318176, per=78.20%, avg=256000.00, stdev=87930.14, samples=2
   iops        : min=48456, max=79544, avg=64000.00, stdev=21982.54, samples=2
  lat (usec)   : 4=0.01%, 20=0.01%, 50=0.01%, 100=0.01%, 250=96.78%
  lat (usec)   : 500=3.19%, 750=0.01%
  cpu          : usr=15.56%, sys=84.19%, ctx=0, majf=0, minf=968
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=40513,64000,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=376MiB/s (394MB/s), 376MiB/s-376MiB/s (394MB/s-394MB/s), io=158MiB (166MB), run=421-421msec
  WRITE: bw=320MiB/s (335MB/s), 320MiB/s-320MiB/s (335MB/s-335MB/s), io=250MiB (262MB), run=782-782msec

Disk stats (read/write):
  nullb3: ios=27496/64000, merge=0/0, ticks=42/172, in_queue=215, util=91.45%
+ echo deleteing devices
deleteing devices
++ seq 0 3
+ for i in `seq 0 $NN`
+ rmdir config/nullb/nullb0
+ for i in `seq 0 $NN`
+ rmdir config/nullb/nullb1
+ for i in `seq 0 $NN`
+ rmdir config/nullb/nullb2
+ for i in `seq 0 $NN`
+ rmdir config/nullb/nullb3
+ modprobe -r null_blk
root@dev linux-block (for-next) # cdblktests 
root@dev blktests (master) # ./check block
block/001 (stress device hotplugging)                        [passed]
    runtime  94.285s  ...  107.074s
block/002 (remove a device while running blktrace)           [passed]
    runtime  1.836s  ...  1.852s
block/006 (run null-blk in blocking mode)                    [passed]
    read iops  334390    ...  376026
    runtime    197.045s  ...  176.328s
block/009 (check page-cache coherency after BLKDISCARD)      [passed]
    runtime  0.960s  ...  0.970s
block/010 (run I/O on null_blk with shared and non-shared tags) [passed]
    Individual tags read iops    ...  448657
    runtime                      ...  315.200s
    Shared tags read iops        ...  450129
block/014 (run null-blk with blk-mq and timeout injection configured) [not run]
    null_blk module does not have parameter timeout
block/015 (run null-blk on different schedulers with requeue injection configured) [not run]
    null_blk module does not have parameter requeue
block/016 (send a signal to a process waiting on a frozen queue) [passed]
    runtime  7.206s  ...  7.210s
block/017 (do I/O and check the inflight counter)            [passed]
    runtime  1.847s  ...  1.851s
block/018 (do I/O and check iostats times)                   [passed]
    runtime  5.322s  ...  5.321s
block/020 (run null-blk on different schedulers with only one hardware tag) [passed]
    runtime  31.856s  ...  31.852s
block/021 (read/write nr_requests on null-blk with different schedulers) [passed]
    runtime  4.096s  ...  4.031s
block/022 (Test hang caused by freeze/unfreeze sequence)     [passed]
    runtime  30.270s  ...  30.211s
block/023 (do I/O on all null_blk queue modes)               [passed]
    runtime  0.630s  ...  0.629s
block/024 (do I/O faster than a jiffy and check iostats times) [passed]
    runtime  3.042s  ...  3.046s
block/025 (do a huge discard with 4k sector size)            [passed]
    runtime  4.369s  ...  4.397s
block/027 (stress device hotplugging with running fio jobs and different schedulers) [passed]
    runtime  21.158s  ...  21.039s
block/028 (do I/O on scsi_debug with DIF/DIX enabled)        [passed]
    runtime  57.059s  ...  57.230s
block/029 (trigger blk_mq_update_nr_hw_queues())             [passed]
    runtime  30.511s  ...  30.535s
block/030 (trigger the blk_mq_realloc_hw_ctxs() error path)  [not run]
    null_blk module does not have parameter init_hctx
block/031 (do IO on null-blk with a host tag set)            [passed]
    runtime  30.537s  ...  30.529s
root@dev blktests (master) # 


-- 
2.29.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param
  2022-02-22 15:28 [PATCH 0/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
@ 2022-02-22 15:28 ` Chaitanya Kulkarni
  2022-02-22 16:06   ` Christoph Hellwig
  2022-02-22 15:28 ` [PATCH 2/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
  2022-02-22 20:00 ` [PATCH 0/2] " Jens Axboe
  2 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-22 15:28 UTC (permalink / raw)
  To: linux-block
  Cc: axboe, ming.lei, damien.lemoal, shinichiro.kawasaki, Chaitanya Kulkarni

Only caller of null_alloc_page() is null_insert_page() unconditionally
sets only parameter to GFP_NOIO and that is statically hard-coded in
null_blk. There is no point in having statically hardcoded function
parameter.

Remove the unnecessary parameter gfp_flags and adjust the code, so it
can retain existing behavior null_alloc_page() with GFP_NOIO.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/null_blk/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 29e183719e77..80f9a6ba376d 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -777,15 +777,15 @@ static void null_complete_rq(struct request *rq)
 	end_cmd(blk_mq_rq_to_pdu(rq));
 }
 
-static struct nullb_page *null_alloc_page(gfp_t gfp_flags)
+static struct nullb_page *null_alloc_page(void)
 {
 	struct nullb_page *t_page;
 
-	t_page = kmalloc(sizeof(struct nullb_page), gfp_flags);
+	t_page = kmalloc(sizeof(struct nullb_page), GFP_NOIO);
 	if (!t_page)
 		goto out;
 
-	t_page->page = alloc_pages(gfp_flags, 0);
+	t_page->page = alloc_pages(GFP_NOIO, 0);
 	if (!t_page->page)
 		goto out_freepage;
 
@@ -932,7 +932,7 @@ static struct nullb_page *null_insert_page(struct nullb *nullb,
 
 	spin_unlock_irq(&nullb->lock);
 
-	t_page = null_alloc_page(GFP_NOIO);
+	t_page = null_alloc_page();
 	if (!t_page)
 		goto out_lock;
 
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] null_blk: null_alloc_page() cleanup
  2022-02-22 15:28 [PATCH 0/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
  2022-02-22 15:28 ` [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param Chaitanya Kulkarni
@ 2022-02-22 15:28 ` Chaitanya Kulkarni
  2022-02-22 16:06   ` Christoph Hellwig
  2022-02-22 20:00 ` [PATCH 0/2] " Jens Axboe
  2 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-02-22 15:28 UTC (permalink / raw)
  To: linux-block
  Cc: axboe, ming.lei, damien.lemoal, shinichiro.kawasaki, Chaitanya Kulkarni

Remove goto labels and use direct returns as error unwinding code only
needs to free t_page variable if we alloc_pages() call fails as having
two labels for one kfree() can be avoided easily.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/null_blk/main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 80f9a6ba376d..05b1120e6623 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -783,18 +783,16 @@ static struct nullb_page *null_alloc_page(void)
 
 	t_page = kmalloc(sizeof(struct nullb_page), GFP_NOIO);
 	if (!t_page)
-		goto out;
+		return NULL;
 
 	t_page->page = alloc_pages(GFP_NOIO, 0);
-	if (!t_page->page)
-		goto out_freepage;
+	if (!t_page->page) {
+		kfree(t_page);
+		return NULL;
+	}
 
 	memset(t_page->bitmap, 0, sizeof(t_page->bitmap));
 	return t_page;
-out_freepage:
-	kfree(t_page);
-out:
-	return NULL;
 }
 
 static void null_free_page(struct nullb_page *t_page)
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param
  2022-02-22 15:28 ` [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param Chaitanya Kulkarni
@ 2022-02-22 16:06   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-02-22 16:06 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-block, axboe, ming.lei, damien.lemoal, shinichiro.kawasaki

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] null_blk: null_alloc_page() cleanup
  2022-02-22 15:28 ` [PATCH 2/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
@ 2022-02-22 16:06   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-02-22 16:06 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-block, axboe, ming.lei, damien.lemoal, shinichiro.kawasaki

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] null_blk: null_alloc_page() cleanup
  2022-02-22 15:28 [PATCH 0/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
  2022-02-22 15:28 ` [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param Chaitanya Kulkarni
  2022-02-22 15:28 ` [PATCH 2/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
@ 2022-02-22 20:00 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2022-02-22 20:00 UTC (permalink / raw)
  To: linux-block, Chaitanya Kulkarni
  Cc: damien.lemoal, shinichiro.kawasaki, ming.lei

On Tue, 22 Feb 2022 07:28:50 -0800, Chaitanya Kulkarni wrote:
> This has null_alloc_page() cleanup to remvoe the unwanted function
> parameter and remove function goto labels where we can return easily.
> 
> Below is the test log of memory backed null_blk with fio verify job and
> blktests output.
> 
> -ck
> 
> [...]

Applied, thanks!

[1/2] null_blk: remove hardcoded null_alloc_page() param
      commit: 4a330a241a41e4f2a9d752dea41be70803a66a94
[2/2] null_blk: null_alloc_page() cleanup
      commit: 2ff4ec783f4c635289384398d14b241f21bce269

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-22 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 15:28 [PATCH 0/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
2022-02-22 15:28 ` [PATCH 1/2] null_blk: remove hardcoded null_alloc_page() param Chaitanya Kulkarni
2022-02-22 16:06   ` Christoph Hellwig
2022-02-22 15:28 ` [PATCH 2/2] null_blk: null_alloc_page() cleanup Chaitanya Kulkarni
2022-02-22 16:06   ` Christoph Hellwig
2022-02-22 20:00 ` [PATCH 0/2] " Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.