mbox series

[00/23] target: code cleanup

Message ID 20210228055645.22253-1-chaitanya.kulkarni@wdc.com (mailing list archive)
Headers show
Series target: code cleanup | expand

Message

Chaitanya Kulkarni Feb. 28, 2021, 5:56 a.m. UTC
Hi,

This removes unused macros, various memset, extra variable in the 
target/iblock for bio get and fixes type mismatch for the same.

The unused macros warning are found at compile time and they are
documented in each patch commit log. For memset removal, there are no
warnings.

First four patches are target_core_iblock.c cleanup. The next six
patches are removal of the unused macros followed by elevan patches to 
remove the memset for local array buffers. The last patch is for
removing the duplicate memset to initialize the buffer to 0xff.
 
I've tested this patch series with creating target bdev backend with
loop back transport, fio verification job seems to work fine.

Any feedback is welcome.

This is generated on today's linux-block for-next.

-ck

Chaitanya Kulkarni (23):
  target/iblock: remove an extra argument
  target/iblock: trim down line longer than 80 char
  target/iblock: fix the type of the logs_per_phys
  targe/pscsi: fix the warning in pscsi_complete_cmd
  target/sbc: get rid of the warning in cmp & write
  target/pscsi: remove unsed macro ISPRINT
  target/stat: remove unsed macro ISPRINT
  target/stat: remove unsed macro NONE
  target/stat: remove unsed macro
  target/iscsi: remove unsed macro TEXT_LEN
  target/iscsi: remove unsed macro PRINT_BUF
  target/iscsi: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/configfs: remove the memset with declare-init
  target/pr: remove the memset with declare-init
  target/pr: remove the memset with declare-init
  target/pr: remove the memset with declare-init
  target/core: don't duplicate memset 0xff

 drivers/target/iscsi/iscsi_target_configfs.c |  3 +-
 drivers/target/iscsi/iscsi_target_nego.c     |  1 -
 drivers/target/iscsi/iscsi_target_stat.c     |  1 -
 drivers/target/iscsi/iscsi_target_util.c     | 17 ---------
 drivers/target/target_core_configfs.c        | 25 ++++---------
 drivers/target/target_core_file.c            |  3 +-
 drivers/target/target_core_iblock.c          | 37 ++++++++++----------
 drivers/target/target_core_pr.c              | 36 +++++++------------
 drivers/target/target_core_pscsi.c           |  5 ++-
 drivers/target/target_core_sbc.c             |  4 +--
 drivers/target/target_core_stat.c            |  3 --
 11 files changed, 45 insertions(+), 90 deletions(-)

Test log for fio verification job with bdev backend with loop transport:-
# ./create_lio.sh 
+ targetcli clearconfig confirm=True
+ clear_dmesg
All configuration cleared
+ rmdir config/target/iscsi
+ rmdir config/target/loopback
+ modprobe -r iscsi_target_mod
+ modprobe -r tcm_loop
+ modprobe -r target_core_file
+ modprobe -r target_core_pscsi
+ modprobe -r target_core_iblock
+ modprobe -r target_core_user
+ modprobe -r target_core_mod
+ lsmod
+ grep target
++ nproc
+ make -j 64 M=drivers/target modules
+ TARGET=drivers/target
++ uname -r
+ TARGET_DEST=/lib/modules/5.11.0blk+/kernel/drivers/target/
+ TARGET_LOOPBACK=drivers/target/loopback
++ uname -r
+ TARGET_LOOPBACK_DEST=/lib/modules/5.11.0blk+/kernel/drivers/target/loopback
+ TARGET_ISCSI=drivers/target/iscsi/
++ uname -r
+ TARGET_ISCSI_DEST=/lib/modules/5.11.0blk+/kernel/drivers/target/iscsi
+ cp drivers/target/target_core_file.ko drivers/target/target_core_iblock.ko drivers/target/target_core_mod.ko drivers/target/target_core_pscsi.ko drivers/target/target_core_user.ko /lib/modules/5.11.0blk+/kernel/drivers/target//
+ cp drivers/target/loopback/tcm_loop.ko /lib/modules/5.11.0blk+/kernel/drivers/target/loopback/
+ cp drivers/target/iscsi//iscsi_target_mod.ko /lib/modules/5.11.0blk+/kernel/drivers/target/iscsi/
+ find /lib/modules/5.11.0blk+/kernel/drivers/target/ -name '*ko'
+ xargs ls -l
-rw-r--r--. 1 root root 3650814 Feb 27 18:32 /lib/modules/5.11.0blk+/kernel/drivers/target/iscsi/cxgbit/cxgbit.ko
-rw-r--r--. 1 root root 9502192 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/iscsi/iscsi_target_mod.ko
-rw-r--r--. 1 root root 9502192 Feb 27 21:02 /lib/modules/5.11.0blk+/kernel/drivers/target/loopback/iscsi_target_mod.ko
-rw-r--r--. 1 root root  610912 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/loopback/tcm_loop.ko
-rw-r--r--. 1 root root  554664 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/target_core_file.ko
-rw-r--r--. 1 root root  573760 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/target_core_iblock.ko
-rw-r--r--. 1 root root 9450112 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/target_core_mod.ko
-rw-r--r--. 1 root root  626880 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/target_core_pscsi.ko
-rw-r--r--. 1 root root 1044992 Feb 27 21:15 /lib/modules/5.11.0blk+/kernel/drivers/target/target_core_user.ko
-rw-r--r--. 1 root root 1808854 Feb 27 18:32 /lib/modules/5.11.0blk+/kernel/drivers/target/tcm_fc/tcm_fc.ko
+ modprobe target_core_file
+ modprobe target_core_pscsi
+ modprobe target_core_iblock
+ modprobe target_core_user
+ modprobe target_core_mod
+ lsmod
+ grep target_core
target_core_user       57344  0 
uio                    24576  1 target_core_user
target_core_iblock     28672  0 
target_core_pscsi      28672  0 
target_core_file       28672  0 
target_core_mod       450560  4 target_core_file,target_core_iblock,target_core_pscsi,target_core_user
+ tree config/target
config/target
├── core
│   └── alua
│       └── lu_gps
│           └── default_lu_gp
│               ├── lu_gp_id
│               └── members
├── dbroot
└── version

4 directories, 4 files
+ targetcli restoreconfig ./lio.json
Configuration restored, 2 recoverable errors:
Storage Object block/bdev: Cannot set attribute alua_support: [Errno 22] Invalid argument, skipped
Storage Object block/bdev: Cannot set attribute pgr_support: [Errno 22] Invalid argument, skipped
+ lsscsi
[0:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdc 
[0:0:1:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdd 
[1:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sda 
[1:0:1:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdb 
[2:0:1:0]    disk    LIO-ORG  bdev             4.0   /dev/sde 
# 
# 
# 
# cat fio/verify.fio 
[write-and-verify]
rw=randwrite
bs=4k
direct=1
ioengine=libaio
iodepth=16
norandommap
randrepeat=0
verify=crc32c
size=500m
group_reporting
# lsblk | grep sde 
sde                 8:64   0    2G  0 disk 
# fio fio/verify.fio --filename=/dev/sde
write-and-verify: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.8-5-g464b
Starting 1 process
Jobs: 1 (f=1): [V(1)][84.6%][r=81.2MiB/s,w=0KiB/s][r=20.8k,w=0 IOPS][eta 00m:02s]      
write-and-verify: (groupid=0, jobs=1): err= 0: pid=20096: Sat Feb 27 21:17:35 2021
   read: IOPS=21.3k, BW=83.3MiB/s (87.4MB/s)(316MiB/3796msec)
    slat (usec): min=9, max=348, avg=11.37, stdev= 4.64
    clat (usec): min=138, max=1946, avg=737.14, stdev=199.40
     lat (usec): min=208, max=2273, avg=748.62, stdev=202.00
    clat percentiles (usec):
     |  1.00th=[  490],  5.00th=[  502], 10.00th=[  519], 20.00th=[  701],
     | 30.00th=[  709], 40.00th=[  717], 50.00th=[  725], 60.00th=[  725],
     | 70.00th=[  725], 80.00th=[  734], 90.00th=[  750], 95.00th=[ 1352],
     | 99.00th=[ 1549], 99.50th=[ 1598], 99.90th=[ 1844], 99.95th=[ 1876],
     | 99.99th=[ 1926]
  write: IOPS=17.0k, BW=70.2MiB/s (73.6MB/s)(500MiB/7123msec)
    slat (usec): min=10, max=420, avg=13.99, stdev= 5.67
    clat (usec): min=103, max=2436, avg=875.65, stdev=233.59
     lat (usec): min=116, max=2508, avg=889.75, stdev=236.91
    clat percentiles (usec):
     |  1.00th=[  498],  5.00th=[  611], 10.00th=[  709], 20.00th=[  791],
     | 30.00th=[  807], 40.00th=[  816], 50.00th=[  824], 60.00th=[  832],
     | 70.00th=[  848], 80.00th=[  906], 90.00th=[  996], 95.00th=[ 1516],
     | 99.00th=[ 1795], 99.50th=[ 1876], 99.90th=[ 2073], 99.95th=[ 2147],
     | 99.99th=[ 2343]
   bw (  KiB/s): min=16864, max=90064, per=94.95%, avg=68247.93, stdev=15516.59, samples=15
   iops        : min= 4216, max=22516, avg=17061.93, stdev=3879.14, samples=15
  lat (usec)   : 250=0.01%, 500=2.09%, 750=40.08%, 1000=49.07%
  lat (msec)   : 2=8.63%, 4=0.13%
  cpu          : usr=5.50%, sys=26.40%, ctx=13071, majf=0, minf=1913
  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=80978,128000,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=83.3MiB/s (87.4MB/s), 83.3MiB/s-83.3MiB/s (87.4MB/s-87.4MB/s), io=316MiB (332MB), run=3796-3796msec
  WRITE: bw=70.2MiB/s (73.6MB/s), 70.2MiB/s-70.2MiB/s (73.6MB/s-73.6MB/s), io=500MiB (524MB), run=7123-7123msec

Disk stats (read/write):
  sde: ios=78668/128000, merge=0/0, ticks=47413/92827, in_queue=140240, util=99.16%
# targetcli clearconfig confirm=True
All configuration cleared
#

Comments

Mike Christie Feb. 28, 2021, 8:13 p.m. UTC | #1
On 2/27/21 11:56 PM, Chaitanya Kulkarni wrote:
> Hi,
> 
> This removes unused macros, various memset, extra variable in the 
> target/iblock for bio get and fixes type mismatch for the same.
> 
> The unused macros warning are found at compile time and they are
> documented in each patch commit log. For memset removal, there are no
> warnings.
> 
> First four patches are target_core_iblock.c cleanup. The next six
> patches are removal of the unused macros followed by elevan patches to 
> remove the memset for local array buffers. The last patch is for
> removing the duplicate memset to initialize the buffer to 0xff.
>  
> I've tested this patch series with creating target bdev backend with
> loop back transport, fio verification job seems to work fine.
> 
> Any feedback is welcome.
> 
> This is generated on today's linux-block for-next.
> 

The patches look ok to me.

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Chaitanya Kulkarni March 1, 2021, 12:06 a.m. UTC | #2
On 2/28/21 12:14, michael.christie@oracle.com wrote:
> On 2/27/21 11:56 PM, Chaitanya Kulkarni wrote:
>> Any feedback is welcome.
>>
>> This is generated on today's linux-block for-next.
>>
> The patches look ok to me.
>
> Reviewed-by: Mike Christie <michael.christie@oracle.com>
>
Thanks for the review tag Mike.
Chaitanya Kulkarni March 9, 2021, 5:04 a.m. UTC | #3
Bart, Martin, Hannes,

On 2/27/21 21:56, Chaitanya Kulkarni wrote:
> Hi,
>
> This removes unused macros, various memset, extra variable in the 
> target/iblock for bio get and fixes type mismatch for the same.
>
> The unused macros warning are found at compile time and they are
> documented in each patch commit log. For memset removal, there are no
> warnings.
>
> First four patches are target_core_iblock.c cleanup. The next six
> patches are removal of the unused macros followed by elevan patches to 
> remove the memset for local array buffers. The last patch is for
> removing the duplicate memset to initialize the buffer to 0xff.
>  
> I've tested this patch series with creating target bdev backend with
> loop back transport, fio verification job seems to work fine.
>
> Any feedback is welcome.
>
> This is generated on today's linux-block for-next.
>
> -ck

any comments on this ?
Bart Van Assche March 9, 2021, 5:15 p.m. UTC | #4
On 3/8/21 9:04 PM, Chaitanya Kulkarni wrote:
> Bart, Martin, Hannes,
> 
> On 2/27/21 21:56, Chaitanya Kulkarni wrote:
>> Hi,
>>
>> This removes unused macros, various memset, extra variable in the
>> target/iblock for bio get and fixes type mismatch for the same.
>>
>> The unused macros warning are found at compile time and they are
>> documented in each patch commit log. For memset removal, there are no
>> warnings.
>>
>> First four patches are target_core_iblock.c cleanup. The next six
>> patches are removal of the unused macros followed by elevan patches to
>> remove the memset for local array buffers. The last patch is for
>> removing the duplicate memset to initialize the buffer to 0xff.
>>   
>> I've tested this patch series with creating target bdev backend with
>> loop back transport, fio verification job seems to work fine.
>>
>> Any feedback is welcome.
>>
>> This is generated on today's linux-block for-next.
>>
>> -ck
> 
> any comments on this ?

Although I'm not sure all patches in this series are useful, the patches 
in this series look good to me.

Bart.
Martin K. Petersen March 10, 2021, 4:32 a.m. UTC | #5
Chaitanya,

> This removes unused macros, various memset, extra variable in the
> target/iblock for bio get and fixes type mismatch for the same.

Applied to 5.13/scsi-staging, thanks!
Martin K. Petersen March 16, 2021, 3:14 a.m. UTC | #6
On Sat, 27 Feb 2021 21:56:22 -0800, Chaitanya Kulkarni wrote:

> This removes unused macros, various memset, extra variable in the
> target/iblock for bio get and fixes type mismatch for the same.
> 
> The unused macros warning are found at compile time and they are
> documented in each patch commit log. For memset removal, there are no
> warnings.
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[01/23] target/iblock: remove an extra argument
        https://git.kernel.org/mkp/scsi/c/bc9e0e366fce
[02/23] target/iblock: trim down line longer than 80 char
        https://git.kernel.org/mkp/scsi/c/a2c6c6a3b1ff
[03/23] target/iblock: fix the type of the logs_per_phys
        https://git.kernel.org/mkp/scsi/c/c151eddbef7e
[04/23] targe/pscsi: fix the warning in pscsi_complete_cmd
        https://git.kernel.org/mkp/scsi/c/fd48c056a32e
[05/23] target/sbc: get rid of the warning in cmp & write
        https://git.kernel.org/mkp/scsi/c/5cfb5b0258a0
[06/23] target/pscsi: remove unsed macro ISPRINT
        https://git.kernel.org/mkp/scsi/c/2c958a8c1f15
[07/23] target/stat: remove unsed macro ISPRINT
        https://git.kernel.org/mkp/scsi/c/c3a27351d6db
[08/23] target/stat: remove unsed macro NONE
        https://git.kernel.org/mkp/scsi/c/c3a27351d6db
[09/23] target/stat: remove unsed macro
        https://git.kernel.org/mkp/scsi/c/fdc1339a421d
[10/23] target/iscsi: remove unsed macro TEXT_LEN
        https://git.kernel.org/mkp/scsi/c/91ce84a3d789
[11/23] target/iscsi: remove unsed macro PRINT_BUF
        https://git.kernel.org/mkp/scsi/c/c4d81e7c53e7
[12/23] target/iscsi: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/c22659fbb98b
[13/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[14/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[15/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[16/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[17/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[18/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[19/23] target/configfs: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/2d4e2daf4fed
[20/23] target/pr: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/4db6dfe62c5f
[21/23] target/pr: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/4db6dfe62c5f
[22/23] target/pr: remove the memset with declare-init
        https://git.kernel.org/mkp/scsi/c/4db6dfe62c5f
[23/23] target/core: don't duplicate memset 0xff
        https://git.kernel.org/mkp/scsi/c/4524a0b15902