All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] target: code cleanup
@ 2021-02-28  5:56 Chaitanya Kulkarni
  2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
                   ` (26 more replies)
  0 siblings, 27 replies; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

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
#
-- 
2.22.1


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

* [PATCH 01/23] target/iblock: remove an extra argument
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 10:40   ` Johannes Thumshirn
  2021-03-09 17:15   ` Bart Van Assche
  2021-02-28  5:56 ` [PATCH 02/23] target/iblock: trim down line longer than 80 char Chaitanya Kulkarni
                   ` (25 subsequent siblings)
  26 siblings, 2 replies; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

The twp arguments to the functions op and opf which are REQ_OP_XXX and
REQ_XXX flags belong to the two different namespaces, i.e. they can be
combined safely given that REQ_OP_XXX takes 8bits of the flags and rest 
is available to REQ_XXX flags.

Replace op and op_flag arguments with opf.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_iblock.c | 34 ++++++++++++++---------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index ee3d52061281..04aeed6558d6 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -304,9 +304,8 @@ static void iblock_bio_done(struct bio *bio)
 	iblock_complete_cmd(cmd);
 }
 
-static struct bio *
-iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op,
-	       int op_flags)
+static struct bio *iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num,
+				  unsigned int opf)
 {
 	struct iblock_dev *ib_dev = IBLOCK_DEV(cmd->se_dev);
 	struct bio *bio;
@@ -326,7 +325,7 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op,
 	bio->bi_private = cmd;
 	bio->bi_end_io = &iblock_bio_done;
 	bio->bi_iter.bi_sector = lba;
-	bio_set_op_attrs(bio, op, op_flags);
+	bio->bi_opf = opf;
 
 	return bio;
 }
@@ -477,7 +476,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
 		goto fail;
 	cmd->priv = ibr;
 
-	bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE, 0);
+	bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE);
 	if (!bio)
 		goto fail_free_ibr;
 
@@ -490,8 +489,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
 		while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
 				!= sg->length) {
 
-			bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE,
-					     0);
+			bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE);
 			if (!bio)
 				goto fail_put_bios;
 
@@ -685,9 +683,11 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 	struct bio_list list;
 	struct scatterlist *sg;
 	u32 sg_num = sgl_nents;
+	unsigned int opf;
 	unsigned bio_cnt;
-	int i, rc, op, op_flags = 0;
+	int i, rc;
 	struct sg_mapping_iter prot_miter;
+	unsigned int miter_dir;
 
 	if (data_direction == DMA_TO_DEVICE) {
 		struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
@@ -696,15 +696,17 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 		 * Force writethrough using REQ_FUA if a volatile write cache
 		 * is not enabled, or if initiator set the Force Unit Access bit.
 		 */
-		op = REQ_OP_WRITE;
+		opf = REQ_OP_WRITE;
+		miter_dir = SG_MITER_TO_SG;
 		if (test_bit(QUEUE_FLAG_FUA, &q->queue_flags)) {
 			if (cmd->se_cmd_flags & SCF_FUA)
-				op_flags = REQ_FUA;
+				opf |= REQ_FUA;
 			else if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
-				op_flags = REQ_FUA;
+				opf |= REQ_FUA;
 		}
 	} else {
-		op = REQ_OP_READ;
+		opf = REQ_OP_READ;
+		miter_dir = SG_MITER_FROM_SG;
 	}
 
 	ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
@@ -718,7 +720,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 		return 0;
 	}
 
-	bio = iblock_get_bio(cmd, block_lba, sgl_nents, op, op_flags);
+	bio = iblock_get_bio(cmd, block_lba, sgl_nents, opf);
 	if (!bio)
 		goto fail_free_ibr;
 
@@ -730,8 +732,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	if (cmd->prot_type && dev->dev_attrib.pi_prot_type)
 		sg_miter_start(&prot_miter, cmd->t_prot_sg, cmd->t_prot_nents,
-			       op == REQ_OP_READ ? SG_MITER_FROM_SG :
-						   SG_MITER_TO_SG);
+			       miter_dir);
 
 	for_each_sg(sgl, sg, sgl_nents, i) {
 		/*
@@ -752,8 +753,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 				bio_cnt = 0;
 			}
 
-			bio = iblock_get_bio(cmd, block_lba, sg_num, op,
-					     op_flags);
+			bio = iblock_get_bio(cmd, block_lba, sg_num, opf);
 			if (!bio)
 				goto fail_put_bios;
 
-- 
2.22.1


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

* [PATCH 02/23] target/iblock: trim down line longer than 80 char
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
  2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 10:41   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 03/23] target/iblock: fix the type of the logs_per_phys Chaitanya Kulkarni
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Trim the lines that are longer than 80 char, which is inconsistent
with the rest of the code.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_iblock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 04aeed6558d6..db9bd571acb1 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -813,7 +813,8 @@ static unsigned int iblock_get_lbppbe(struct se_device *dev)
 {
 	struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
 	struct block_device *bd = ib_dev->ibd_bd;
-	int logs_per_phys = bdev_physical_block_size(bd) / bdev_logical_block_size(bd);
+	int logs_per_phys =
+		bdev_physical_block_size(bd) / bdev_logical_block_size(bd);
 
 	return ilog2(logs_per_phys);
 }
-- 
2.22.1


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

* [PATCH 03/23] target/iblock: fix the type of the logs_per_phys
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
  2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
  2021-02-28  5:56 ` [PATCH 02/23] target/iblock: trim down line longer than 80 char Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 10:45   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd Chaitanya Kulkarni
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 903 bytes --]

According to the ilog2() it expects 32/64 bit unsigned value.
"  147  * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value"

Replace the type of the logs_per_phys from int to unsigned int.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_iblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index db9bd571acb1..12999d39c398 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -813,7 +813,7 @@ static unsigned int iblock_get_lbppbe(struct se_device *dev)
 {
 	struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
 	struct block_device *bd = ib_dev->ibd_bd;
-	int logs_per_phys =
+	unsigned int logs_per_phys =
 		bdev_physical_block_size(bd) / bdev_logical_block_size(bd);
 
 	return ilog2(logs_per_phys);
-- 
2.22.1


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

* [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (2 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 03/23] target/iblock: fix the type of the logs_per_phys Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:30   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 05/23] target/sbc: get rid of the warning in cmp & write Chaitanya Kulkarni
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

This fixes the compilation warning in pscsi_complete_cmd():-

    drivers/target/target_core_pscsi.c: In function ‘pscsi_complete_cmd’:
    drivers/target/target_core_pscsi.c:624:5: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
         ; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
         ^

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 3cbc074992bc..689e503e3301 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -620,8 +620,9 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,
 			unsigned char *buf;
 
 			buf = transport_kmap_data_sg(cmd);
-			if (!buf)
+			if (!buf) {
 				; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
+			}
 
 			if (cdb[0] == MODE_SENSE_10) {
 				if (!(buf[3] & 0x80))
-- 
2.22.1


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

* [PATCH 05/23] target/sbc: get rid of the warning in cmp & write
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (3 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:51   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT Chaitanya Kulkarni
                   ` (21 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Rename the function local variable i -> sg_cnt so we can get rid of the
shadow variable compilation warning:-

drivers/target//target_core_sbc.c: In function ‘compare_and_write_do_cmp’:
drivers/target//target_core_sbc.c:475:17: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
    unsigned int i;
                 ^
drivers/target//target_core_sbc.c:451:6: note: shadowed declaration is here
  int i;
      ^
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_sbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index f7c527a826fd..7b07e557dc8d 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -448,7 +448,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 	sense_reason_t ret;
 	unsigned int offset;
 	size_t rc;
-	int i;
+	int sg_cnt;
 
 	buf = kzalloc(cmp_len, GFP_KERNEL);
 	if (!buf) {
@@ -467,7 +467,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 	 */
 	offset = 0;
 	ret = TCM_NO_SENSE;
-	for_each_sg(read_sgl, sg, read_nents, i) {
+	for_each_sg(read_sgl, sg, read_nents, sg_cnt) {
 		unsigned int len = min(sg->length, cmp_len);
 		unsigned char *addr = kmap_atomic(sg_page(sg));
 
-- 
2.22.1


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

* [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (4 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 05/23] target/sbc: get rid of the warning in cmp & write Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:56   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 07/23] target/stat: " Chaitanya Kulkarni
                   ` (20 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 847 bytes --]

Remove the unused macro that fixes the following compilation warning:-

drivers/target//target_core_pscsi.c:37: warning: macro "ISPRINT" is not used [-Wunused-macros]
 #define ISPRINT(a)  ((a >= ' ') && (a <= '~'))

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pscsi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 689e503e3301..7b1035e08419 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -34,8 +34,6 @@
 #include "target_core_internal.h"
 #include "target_core_pscsi.h"
 
-#define ISPRINT(a)  ((a >= ' ') && (a <= '~'))
-
 static inline struct pscsi_dev_virt *PSCSI_DEV(struct se_device *dev)
 {
 	return container_of(dev, struct pscsi_dev_virt, dev);
-- 
2.22.1


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

* [PATCH 07/23] target/stat: remove unsed macro ISPRINT
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (5 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:56   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 08/23] target/stat: remove unsed macro NONE Chaitanya Kulkarni
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 728 bytes --]

Remove the unused macro that fixes the following compilation warning:-

drivers/target//iscsi/iscsi_target_stat.c:36: warning: macro "ISPRINT" is not used [-Wunused-macros]
#define ISPRINT(a)   ((a >= ' ') && (a <= '~'))

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_stat.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 237309db4b33..2d2c7e377722 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -32,7 +32,6 @@
 #endif
 
 #define NONE		"None"
-#define ISPRINT(a)   ((a >= ' ') && (a <= '~'))
 
 #define SCSI_LU_INDEX			1
 #define LU_COUNT			1
-- 
2.22.1


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

* [PATCH 08/23] target/stat: remove unsed macro NONE
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (6 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 07/23] target/stat: " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:57   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 09/23] target/stat: remove unsed macro Chaitanya Kulkarni
                   ` (18 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 713 bytes --]

Remove the unused macro that fixes the following compilation warning:-

drivers/target//target_core_stat.c:34: warning: macro "NONE" is not used [-Wunused-macros]
#define NONE  "None"

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_stat.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 2d2c7e377722..62d15bcc3d93 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -31,8 +31,6 @@
 #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
 #endif
 
-#define NONE		"None"
-
 #define SCSI_LU_INDEX			1
 #define LU_COUNT			1
 
-- 
2.22.1


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

* [PATCH 09/23] target/stat: remove unsed macro
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (7 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 08/23] target/stat: remove unsed macro NONE Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:58   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN Chaitanya Kulkarni
                   ` (17 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Remove the unused macro that fixes the following compilation warning:-

drivers/target//iscsi/iscsi_target_stat.c:31: warning: macro "ISCSI_INST_LAST_FAILURE_TYPE" is not used [-Wunused-macros]
#define ISCSI_INST_LAST_FAILURE_TYPE 0

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/iscsi/iscsi_target_stat.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c
index 35e75a3569c9..cce3a827059e 100644
--- a/drivers/target/iscsi/iscsi_target_stat.c
+++ b/drivers/target/iscsi/iscsi_target_stat.c
@@ -28,7 +28,6 @@
 /* Instance Attributes Table */
 #define ISCSI_INST_NUM_NODES		1
 #define ISCSI_INST_DESCR		"Storage Engine Target"
-#define ISCSI_INST_LAST_FAILURE_TYPE	0
 #define ISCSI_DISCONTINUITY_TIME	0
 
 #define ISCSI_NODE_INDEX		1
-- 
2.22.1


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

* [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (8 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 09/23] target/stat: remove unsed macro Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:58   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF Chaitanya Kulkarni
                   ` (16 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Remove the unused macro that fixes the following compilation warning:-

drivers/target//iscsi/iscsi_target_nego.c:31: warning: macro "TEXT_LEN" is not used [-Wunused-macros]
#define TEXT_LEN 4096

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/iscsi/iscsi_target_nego.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 8b40f10976ff..151e2949bb75 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -28,7 +28,6 @@
 #include "iscsi_target_auth.h"
 
 #define MAX_LOGIN_PDUS  7
-#define TEXT_LEN	4096
 
 void convert_null_to_semi(char *buf, int len)
 {
-- 
2.22.1


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

* [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (9 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:58   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 12/23] target/iscsi: remove the memset with declare-init Chaitanya Kulkarni
                   ` (15 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1167 bytes --]

Remove the unused macro that fixes the following compilation warning:-

drivers/target//iscsi/iscsi_target_util.c:31: warning: macro "PRINT_BUFF" is not used [-Wunused-macros]
#define PRINT_BUFF(buff, len)     \

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/iscsi/iscsi_target_util.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 9468b017b4a7..6dd5810e2af1 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -28,23 +28,6 @@
 #include "iscsi_target_util.h"
 #include "iscsi_target.h"
 
-#define PRINT_BUFF(buff, len)					\
-{								\
-	int zzz;						\
-								\
-	pr_debug("%d:\n", __LINE__);				\
-	for (zzz = 0; zzz < len; zzz++) {			\
-		if (zzz % 16 == 0) {				\
-			if (zzz)				\
-				pr_debug("\n");			\
-			pr_debug("%4i: ", zzz);			\
-		}						\
-		pr_debug("%02x ", (unsigned char) (buff)[zzz]);	\
-	}							\
-	if ((len + 1) % 16)					\
-		pr_debug("\n");					\
-}
-
 extern struct list_head g_tiqn_list;
 extern spinlock_t tiqn_lock;
 
-- 
2.22.1


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

* [PATCH 12/23] target/iscsi: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (10 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:59   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 13/23] target/configfs: " Chaitanya Kulkarni
                   ` (14 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/iscsi/iscsi_target_configfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 0fa1d57b26fa..f4a24fa5058e 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -161,14 +161,13 @@ static struct se_tpg_np *lio_target_call_addnptotpg(
 	char *str, *str2, *ip_str, *port_str;
 	struct sockaddr_storage sockaddr = { };
 	int ret;
-	char buf[MAX_PORTAL_LEN + 1];
+	char buf[MAX_PORTAL_LEN + 1] = { };
 
 	if (strlen(name) > MAX_PORTAL_LEN) {
 		pr_err("strlen(name): %d exceeds MAX_PORTAL_LEN: %d\n",
 			(int)strlen(name), MAX_PORTAL_LEN);
 		return ERR_PTR(-EOVERFLOW);
 	}
-	memset(buf, 0, MAX_PORTAL_LEN + 1);
 	snprintf(buf, MAX_PORTAL_LEN + 1, "%s", name);
 
 	str = strstr(buf, "[");
-- 
2.22.1


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

* [PATCH 13/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (11 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 12/23] target/iscsi: remove the memset with declare-init Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:59   ` Johannes Thumshirn
  2021-03-01 13:00   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 14/23] " Chaitanya Kulkarni
                   ` (13 subsequent siblings)
  26 siblings, 2 replies; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index f04352285155..56ea47f5cda9 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1494,7 +1494,7 @@ static ssize_t target_wwn_vpd_unit_serial_store(struct config_item *item,
 {
 	struct t10_wwn *t10_wwn = to_t10_wwn(item);
 	struct se_device *dev = t10_wwn->t10_dev;
-	unsigned char buf[INQUIRY_VPD_SERIAL_LEN];
+	unsigned char buf[INQUIRY_VPD_SERIAL_LEN] = { };
 
 	/*
 	 * If Linux/SCSI subsystem_api_t plugin got a VPD Unit Serial
@@ -1536,7 +1536,6 @@ static ssize_t target_wwn_vpd_unit_serial_store(struct config_item *item,
 	 * Also, strip any newline added from the userspace
 	 * echo $UUID > $TARGET/$HBA/$STORAGE_OBJECT/wwn/vpd_unit_serial
 	 */
-	memset(buf, 0, INQUIRY_VPD_SERIAL_LEN);
 	snprintf(buf, INQUIRY_VPD_SERIAL_LEN, "%s", page);
 	snprintf(dev->t10_wwn.unit_serial, INQUIRY_VPD_SERIAL_LEN,
 			"%s", strstrip(buf));
-- 
2.22.1


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

* [PATCH 14/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (12 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 13/23] target/configfs: " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 12:59   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 15/23] " Chaitanya Kulkarni
                   ` (12 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 56ea47f5cda9..4c60334a1e9f 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1555,11 +1555,9 @@ static ssize_t target_wwn_vpd_protocol_identifier_show(struct config_item *item,
 {
 	struct t10_wwn *t10_wwn = to_t10_wwn(item);
 	struct t10_vpd *vpd;
-	unsigned char buf[VPD_TMP_BUF_SIZE];
+	unsigned char buf[VPD_TMP_BUF_SIZE] = { };
 	ssize_t len = 0;
 
-	memset(buf, 0, VPD_TMP_BUF_SIZE);
-
 	spin_lock(&t10_wwn->t10_vpd_lock);
 	list_for_each_entry(vpd, &t10_wwn->t10_vpd_list, vpd_list) {
 		if (!vpd->protocol_identifier_set)
-- 
2.22.1


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

* [PATCH 15/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (13 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 14/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:00   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 16/23] " Chaitanya Kulkarni
                   ` (11 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 4c60334a1e9f..315791b5554a 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -2283,7 +2283,7 @@ static ssize_t target_dev_alua_lu_gp_store(struct config_item *item,
 	struct se_hba *hba = dev->se_hba;
 	struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL;
 	struct t10_alua_lu_gp_member *lu_gp_mem;
-	unsigned char buf[LU_GROUP_NAME_BUF];
+	unsigned char buf[LU_GROUP_NAME_BUF] = { };
 	int move = 0;
 
 	lu_gp_mem = dev->dev_alua_lu_gp_mem;
@@ -2294,7 +2294,6 @@ static ssize_t target_dev_alua_lu_gp_store(struct config_item *item,
 		pr_err("ALUA LU Group Alias too large!\n");
 		return -EINVAL;
 	}
-	memset(buf, 0, LU_GROUP_NAME_BUF);
 	memcpy(buf, page, count);
 	/*
 	 * Any ALUA logical unit alias besides "NULL" means we will be
-- 
2.22.1


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

* [PATCH 16/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (14 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 15/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:00   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 17/23] " Chaitanya Kulkarni
                   ` (10 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 315791b5554a..ca5b083d2958 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1660,9 +1660,7 @@ static ssize_t target_core_dev_pr_show_spc3_res(struct se_device *dev,
 {
 	struct se_node_acl *se_nacl;
 	struct t10_pr_registration *pr_reg;
-	char i_buf[PR_REG_ISID_ID_LEN];
-
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 
 	pr_reg = dev->dev_pr_res_holder;
 	if (!pr_reg)
-- 
2.22.1


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

* [PATCH 17/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (15 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 16/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:01   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 18/23] " Chaitanya Kulkarni
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index ca5b083d2958..0ec9fe1ebade 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -2609,9 +2609,7 @@ static ssize_t target_lu_gp_members_show(struct config_item *item, char *page)
 	struct se_hba *hba;
 	struct t10_alua_lu_gp_member *lu_gp_mem;
 	ssize_t len = 0, cur_len;
-	unsigned char buf[LU_GROUP_NAME_BUF];
-
-	memset(buf, 0, LU_GROUP_NAME_BUF);
+	unsigned char buf[LU_GROUP_NAME_BUF] = { };
 
 	spin_lock(&lu_gp->lu_gp_lock);
 	list_for_each_entry(lu_gp_mem, &lu_gp->lu_gp_mem_list, lu_gp_mem_list) {
-- 
2.22.1


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

* [PATCH 18/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (16 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 17/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:01   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 19/23] " Chaitanya Kulkarni
                   ` (8 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 0ec9fe1ebade..d6554468ef65 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3012,9 +3012,7 @@ static ssize_t target_tg_pt_gp_members_show(struct config_item *item,
 	struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item);
 	struct se_lun *lun;
 	ssize_t len = 0, cur_len;
-	unsigned char buf[TG_PT_GROUP_NAME_BUF];
-
-	memset(buf, 0, TG_PT_GROUP_NAME_BUF);
+	unsigned char buf[TG_PT_GROUP_NAME_BUF] = { };
 
 	spin_lock(&tg_pt_gp->tg_pt_gp_lock);
 	list_for_each_entry(lun, &tg_pt_gp->tg_pt_gp_lun_list,
-- 
2.22.1


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

* [PATCH 19/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (17 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 18/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:01   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 20/23] target/pr: " Chaitanya Kulkarni
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_configfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index d6554468ef65..9cb1ca8421c8 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3399,11 +3399,10 @@ static struct config_group *target_core_call_addhbatotarget(
 {
 	char *se_plugin_str, *str, *str2;
 	struct se_hba *hba;
-	char buf[TARGET_CORE_NAME_MAX_LEN];
+	char buf[TARGET_CORE_NAME_MAX_LEN] = { };
 	unsigned long plugin_dep_id = 0;
 	int ret;
 
-	memset(buf, 0, TARGET_CORE_NAME_MAX_LEN);
 	if (strlen(name) >= TARGET_CORE_NAME_MAX_LEN) {
 		pr_err("Passed *name strlen(): %d exceeds"
 			" TARGET_CORE_NAME_MAX_LEN: %d\n", (int)strlen(name),
-- 
2.22.1


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

* [PATCH 20/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (18 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 19/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:01   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 21/23] " Chaitanya Kulkarni
                   ` (6 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 14db5e568f22..942b93d12295 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -928,12 +928,10 @@ static int __core_scsi3_check_aptpl_registration(
 {
 	struct t10_pr_registration *pr_reg, *pr_reg_tmp;
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
-	unsigned char i_port[PR_APTPL_MAX_IPORT_LEN];
-	unsigned char t_port[PR_APTPL_MAX_TPORT_LEN];
+	unsigned char i_port[PR_APTPL_MAX_IPORT_LEN] = { };
+	unsigned char t_port[PR_APTPL_MAX_TPORT_LEN] = { };
 	u16 tpgt;
 
-	memset(i_port, 0, PR_APTPL_MAX_IPORT_LEN);
-	memset(t_port, 0, PR_APTPL_MAX_TPORT_LEN);
 	/*
 	 * Copy Initiator Port information from struct se_node_acl
 	 */
-- 
2.22.1


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

* [PATCH 21/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (19 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 20/23] target/pr: " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:02   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 22/23] " Chaitanya Kulkarni
                   ` (5 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 942b93d12295..3644d2642929 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1202,10 +1202,10 @@ static struct t10_pr_registration *core_scsi3_locate_pr_reg(
 	struct se_session *sess)
 {
 	struct se_portal_group *tpg = nacl->se_tpg;
-	unsigned char buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
+	unsigned char buf[PR_REG_ISID_LEN] = { };
+	unsigned char *isid_ptr = NULL;
 
 	if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) {
-		memset(&buf[0], 0, PR_REG_ISID_LEN);
 		tpg->se_tpg_tfo->sess_get_initiator_sid(sess, &buf[0],
 					PR_REG_ISID_LEN);
 		isid_ptr = &buf[0];
-- 
2.22.1


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

* [PATCH 22/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (20 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 21/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:02   ` Johannes Thumshirn
  2021-02-28  5:56 ` [PATCH 23/23] target/core: don't duplicate memset 0xff Chaitanya Kulkarni
                   ` (4 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

Instead of initializing the array with memset, use declare init pattern
that is present under the kernel tree in other drivers so we can remove
the memset call.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pr.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 3644d2642929..894cda06261c 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -896,9 +896,8 @@ static void core_scsi3_aptpl_reserve(
 	struct se_node_acl *node_acl,
 	struct t10_pr_registration *pr_reg)
 {
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN);
 
 	spin_lock(&dev->dev_reservation_lock);
@@ -1021,9 +1020,8 @@ static void __core_scsi3_dump_registration(
 	enum register_type register_type)
 {
 	struct se_portal_group *se_tpg = nacl->se_tpg;
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 
-	memset(&i_buf[0], 0, PR_REG_ISID_ID_LEN);
 	core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN);
 
 	pr_debug("SPC-3 PR [%s] Service Action: REGISTER%s Initiator"
@@ -1283,11 +1281,10 @@ static void __core_scsi3_free_registration(
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
 	struct se_node_acl *nacl = pr_reg->pr_reg_nacl;
 	struct se_dev_entry *deve;
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 
 	lockdep_assert_held(&pr_tmpl->registration_lock);
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN);
 
 	if (!list_empty(&pr_reg->pr_reg_list))
@@ -2057,7 +2054,8 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
 	struct se_portal_group *se_tpg;
 	struct t10_pr_registration *pr_reg, *pr_reg_p, *pr_reg_tmp;
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
-	unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
+	unsigned char isid_buf[PR_REG_ISID_LEN] = { };
+	unsigned char *isid_ptr = NULL;
 	sense_reason_t ret = TCM_NO_SENSE;
 	int pr_holder = 0, type;
 
@@ -2068,7 +2066,6 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
 	se_tpg = se_sess->se_tpg;
 
 	if (se_tpg->se_tpg_tfo->sess_get_initiator_sid) {
-		memset(&isid_buf[0], 0, PR_REG_ISID_LEN);
 		se_tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, &isid_buf[0],
 				PR_REG_ISID_LEN);
 		isid_ptr = &isid_buf[0];
@@ -2280,11 +2277,9 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)
 	struct se_lun *se_lun = cmd->se_lun;
 	struct t10_pr_registration *pr_reg, *pr_res_holder;
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 	sense_reason_t ret;
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
-
 	if (!se_sess || !se_lun) {
 		pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n");
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
@@ -2455,12 +2450,11 @@ static void __core_scsi3_complete_pro_release(
 	int unreg)
 {
 	const struct target_core_fabric_ops *tfo = se_nacl->se_tpg->se_tpg_tfo;
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 	int pr_res_type = 0, pr_res_scope = 0;
 
 	lockdep_assert_held(&dev->dev_reservation_lock);
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN);
 	/*
 	 * Go ahead and release the current PR reservation holder.
@@ -2766,11 +2760,10 @@ static void __core_scsi3_complete_pro_preempt(
 {
 	struct se_node_acl *nacl = pr_reg->pr_reg_nacl;
 	const struct target_core_fabric_ops *tfo = nacl->se_tpg->se_tpg_tfo;
-	char i_buf[PR_REG_ISID_ID_LEN];
+	char i_buf[PR_REG_ISID_ID_LEN] = { };
 
 	lockdep_assert_held(&dev->dev_reservation_lock);
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN);
 	/*
 	 * Do an implicit RELEASE of the existing reservation.
@@ -3156,7 +3149,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
 	unsigned char *buf;
 	const unsigned char *initiator_str;
-	char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN];
+	char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN] = { };
 	u32 tid_len, tmp_tid_len;
 	int new_reg = 0, type, scope, matching_iname;
 	sense_reason_t ret;
@@ -3168,7 +3161,6 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 
-	memset(i_buf, 0, PR_REG_ISID_ID_LEN);
 	se_tpg = se_sess->se_tpg;
 	tf_ops = se_tpg->se_tpg_tfo;
 	/*
-- 
2.22.1


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

* [PATCH 23/23] target/core: don't duplicate memset 0xff
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (21 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 22/23] " Chaitanya Kulkarni
@ 2021-02-28  5:56 ` Chaitanya Kulkarni
  2021-03-01 13:05   ` Johannes Thumshirn
  2021-02-28 20:13 ` [PATCH 00/23] target: code cleanup michael.christie
                   ` (3 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-28  5:56 UTC (permalink / raw)
  To: linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu, Chaitanya Kulkarni

The function fd_do_prot_fill() is called from two callers
fd_do_prot_unmap() and fd_format_prot(). Both the callers initialize
the passed buffer with memset to 0xff with its length.

Instead of duplicating the memset call, move the memset call to the
fd_do_prot_fill().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 5a66854def95..ef4a8e189fba 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -498,6 +498,7 @@ fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
 
 	prot_length = nolb * se_dev->prot_length;
 
+	memset(buf, 0xff, bufsize);
 	for (prot = 0; prot < prot_length;) {
 		sector_t len = min_t(sector_t, bufsize, prot_length - prot);
 		ssize_t ret = kernel_write(prot_fd, buf, len, &pos);
@@ -523,7 +524,6 @@ fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
 		pr_err("Unable to allocate FILEIO prot buf\n");
 		return -ENOMEM;
 	}
-	memset(buf, 0xff, PAGE_SIZE);
 
 	rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE);
 
@@ -882,7 +882,6 @@ static int fd_format_prot(struct se_device *dev)
 		 (unsigned long long)(dev->transport->get_blocks(dev) + 1) *
 					dev->prot_length);
 
-	memset(buf, 0xff, unit_size);
 	ret = fd_do_prot_fill(dev, 0, dev->transport->get_blocks(dev) + 1,
 			      buf, unit_size);
 	vfree(buf);
-- 
2.22.1


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

* Re: [PATCH 00/23] target: code cleanup
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (22 preceding siblings ...)
  2021-02-28  5:56 ` [PATCH 23/23] target/core: don't duplicate memset 0xff Chaitanya Kulkarni
@ 2021-02-28 20:13 ` michael.christie
  2021-03-01  0:06   ` Chaitanya Kulkarni
  2021-03-09  5:04 ` Chaitanya Kulkarni
                   ` (2 subsequent siblings)
  26 siblings, 1 reply; 56+ messages in thread
From: michael.christie @ 2021-02-28 20:13 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, bvanassche, houpu

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>

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

* Re: [PATCH 00/23] target: code cleanup
  2021-02-28 20:13 ` [PATCH 00/23] target: code cleanup michael.christie
@ 2021-03-01  0:06   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-03-01  0:06 UTC (permalink / raw)
  To: michael.christie, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, bvanassche, houpu

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.

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

* Re: [PATCH 01/23] target/iblock: remove an extra argument
  2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
@ 2021-03-01 10:40   ` Johannes Thumshirn
  2021-03-09 17:15   ` Bart Van Assche
  1 sibling, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 10:40 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 02/23] target/iblock: trim down line longer than 80 char
  2021-02-28  5:56 ` [PATCH 02/23] target/iblock: trim down line longer than 80 char Chaitanya Kulkarni
@ 2021-03-01 10:41   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 10:41 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 03/23] target/iblock: fix the type of the logs_per_phys
  2021-02-28  5:56 ` [PATCH 03/23] target/iblock: fix the type of the logs_per_phys Chaitanya Kulkarni
@ 2021-03-01 10:45   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 10:45 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

On 28/02/2021 07:00, Chaitanya Kulkarni wrote:
> "  147  * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value"

Not sure if it's only my mail client, but there's some stray characters
in the quotation.

Code wise it looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd
  2021-02-28  5:56 ` [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd Chaitanya Kulkarni
@ 2021-03-01 12:30   ` Johannes Thumshirn
  2021-03-02  3:57     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:30 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

On 28/02/2021 07:00, Chaitanya Kulkarni wrote:
> This fixes the compilation warning in pscsi_complete_cmd():-
> 
>     drivers/target/target_core_pscsi.c: In function ‘pscsi_complete_cmd’:
>     drivers/target/target_core_pscsi.c:624:5: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
>          ; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
>          ^
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/target/target_core_pscsi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
> index 3cbc074992bc..689e503e3301 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -620,8 +620,9 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,
>  			unsigned char *buf;
>  
>  			buf = transport_kmap_data_sg(cmd);
> -			if (!buf)
> +			if (!buf) {
>  				; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
> +			}
>  
>  			if (cdb[0] == MODE_SENSE_10) {
>  				if (!(buf[3] & 0x80))
> 

Do you have any plans to actually address that XXX? Because if
transport_kmap_data_sg() fails (and it can fail for various reasons)
and we get a MODE_SENSE_10 we'll trip over a NULL pointer.

I know this is outside of the scope of this patchset, but would be nice anyways.

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

* Re: [PATCH 05/23] target/sbc: get rid of the warning in cmp & write
  2021-02-28  5:56 ` [PATCH 05/23] target/sbc: get rid of the warning in cmp & write Chaitanya Kulkarni
@ 2021-03-01 12:51   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:51 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Oops,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT
  2021-02-28  5:56 ` [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT Chaitanya Kulkarni
@ 2021-03-01 12:56   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:56 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 07/23] target/stat: remove unsed macro ISPRINT
  2021-02-28  5:56 ` [PATCH 07/23] target/stat: " Chaitanya Kulkarni
@ 2021-03-01 12:56   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:56 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 08/23] target/stat: remove unsed macro NONE
  2021-02-28  5:56 ` [PATCH 08/23] target/stat: remove unsed macro NONE Chaitanya Kulkarni
@ 2021-03-01 12:57   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:57 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 09/23] target/stat: remove unsed macro
  2021-02-28  5:56 ` [PATCH 09/23] target/stat: remove unsed macro Chaitanya Kulkarni
@ 2021-03-01 12:58   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:58 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN
  2021-02-28  5:56 ` [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN Chaitanya Kulkarni
@ 2021-03-01 12:58   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:58 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF
  2021-02-28  5:56 ` [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF Chaitanya Kulkarni
@ 2021-03-01 12:58   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:58 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 12/23] target/iscsi: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 12/23] target/iscsi: remove the memset with declare-init Chaitanya Kulkarni
@ 2021-03-01 12:59   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 13/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 13/23] target/configfs: " Chaitanya Kulkarni
@ 2021-03-01 12:59   ` Johannes Thumshirn
  2021-03-01 13:00   ` Johannes Thumshirn
  1 sibling, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 14/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 14/23] " Chaitanya Kulkarni
@ 2021-03-01 12:59   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 12:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 15/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 15/23] " Chaitanya Kulkarni
@ 2021-03-01 13:00   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:00 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 16/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 16/23] " Chaitanya Kulkarni
@ 2021-03-01 13:00   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:00 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 13/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 13/23] target/configfs: " Chaitanya Kulkarni
  2021-03-01 12:59   ` Johannes Thumshirn
@ 2021-03-01 13:00   ` Johannes Thumshirn
  1 sibling, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:00 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 17/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 17/23] " Chaitanya Kulkarni
@ 2021-03-01 13:01   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:01 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 18/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 18/23] " Chaitanya Kulkarni
@ 2021-03-01 13:01   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:01 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 19/23] target/configfs: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 19/23] " Chaitanya Kulkarni
@ 2021-03-01 13:01   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:01 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 20/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 20/23] target/pr: " Chaitanya Kulkarni
@ 2021-03-01 13:01   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:01 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 21/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 21/23] " Chaitanya Kulkarni
@ 2021-03-01 13:02   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:02 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 22/23] target/pr: remove the memset with declare-init
  2021-02-28  5:56 ` [PATCH 22/23] " Chaitanya Kulkarni
@ 2021-03-01 13:02   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:02 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 23/23] target/core: don't duplicate memset 0xff
  2021-02-28  5:56 ` [PATCH 23/23] target/core: don't duplicate memset 0xff Chaitanya Kulkarni
@ 2021-03-01 13:05   ` Johannes Thumshirn
  0 siblings, 0 replies; 56+ messages in thread
From: Johannes Thumshirn @ 2021-03-01 13:05 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd
  2021-03-01 12:30   ` Johannes Thumshirn
@ 2021-03-02  3:57     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-03-02  3:57 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie,
	bvanassche, houpu

On 3/1/21 04:30, Johannes Thumshirn wrote:
>> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
>> index 3cbc074992bc..689e503e3301 100644
>> --- a/drivers/target/target_core_pscsi.c
>> +++ b/drivers/target/target_core_pscsi.c
>> @@ -620,8 +620,9 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,
>>  			unsigned char *buf;
>>  
>>  			buf = transport_kmap_data_sg(cmd);
>> -			if (!buf)
>> +			if (!buf) {
>>  				; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
>> +			}
>>  
>>  			if (cdb[0] == MODE_SENSE_10) {
>>  				if (!(buf[3] & 0x80))
>>
> Do you have any plans to actually address that XXX? Because if
> transport_kmap_data_sg() fails (and it can fail for various reasons)
> and we get a MODE_SENSE_10 we'll trip over a NULL pointer.
>
> I know this is outside of the scope of this patchset, but would be nice anyways.
>
Yes we I can try and fix that, but surprisingly parse cmd return type is
void.
It maybe a bigger change will keep it separate. Thanks for the reviews.

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

* Re: [PATCH 00/23] target: code cleanup
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (23 preceding siblings ...)
  2021-02-28 20:13 ` [PATCH 00/23] target: code cleanup michael.christie
@ 2021-03-09  5:04 ` Chaitanya Kulkarni
  2021-03-09 17:15   ` Bart Van Assche
  2021-03-10  4:32 ` Martin K. Petersen
  2021-03-16  3:14 ` Martin K. Petersen
  26 siblings, 1 reply; 56+ messages in thread
From: Chaitanya Kulkarni @ 2021-03-09  5:04 UTC (permalink / raw)
  To: linux-scsi, target-devel, martin.petersen, hare, bvanassche
  Cc: jejb, mlombard, michael.christie, houpu

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 ?

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

* Re: [PATCH 00/23] target: code cleanup
  2021-03-09  5:04 ` Chaitanya Kulkarni
@ 2021-03-09 17:15   ` Bart Van Assche
  0 siblings, 0 replies; 56+ messages in thread
From: Bart Van Assche @ 2021-03-09 17:15 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel, martin.petersen, hare
  Cc: jejb, mlombard, michael.christie, houpu

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.



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

* Re: [PATCH 01/23] target/iblock: remove an extra argument
  2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
  2021-03-01 10:40   ` Johannes Thumshirn
@ 2021-03-09 17:15   ` Bart Van Assche
  1 sibling, 0 replies; 56+ messages in thread
From: Bart Van Assche @ 2021-03-09 17:15 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-scsi, target-devel
  Cc: martin.petersen, hare, jejb, mlombard, michael.christie, houpu

On 2/27/21 9:56 PM, Chaitanya Kulkarni wrote:
> The twp arguments to the functions op and opf which are REQ_OP_XXX and
       ^^^

typo?


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

* Re: [PATCH 00/23] target: code cleanup
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (24 preceding siblings ...)
  2021-03-09  5:04 ` Chaitanya Kulkarni
@ 2021-03-10  4:32 ` Martin K. Petersen
  2021-03-16  3:14 ` Martin K. Petersen
  26 siblings, 0 replies; 56+ messages in thread
From: Martin K. Petersen @ 2021-03-10  4:32 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: linux-scsi, target-devel, martin.petersen, hare, jejb, mlombard,
	michael.christie, bvanassche, houpu


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	Oracle Linux Engineering

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

* Re: [PATCH 00/23] target: code cleanup
  2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
                   ` (25 preceding siblings ...)
  2021-03-10  4:32 ` Martin K. Petersen
@ 2021-03-16  3:14 ` Martin K. Petersen
  26 siblings, 0 replies; 56+ messages in thread
From: Martin K. Petersen @ 2021-03-16  3:14 UTC (permalink / raw)
  To: linux-scsi, target-devel, Chaitanya Kulkarni
  Cc: Martin K . Petersen, jejb, bvanassche, hare, michael.christie,
	houpu, mlombard

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-03-16  3:16 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28  5:56 [PATCH 00/23] target: code cleanup Chaitanya Kulkarni
2021-02-28  5:56 ` [PATCH 01/23] target/iblock: remove an extra argument Chaitanya Kulkarni
2021-03-01 10:40   ` Johannes Thumshirn
2021-03-09 17:15   ` Bart Van Assche
2021-02-28  5:56 ` [PATCH 02/23] target/iblock: trim down line longer than 80 char Chaitanya Kulkarni
2021-03-01 10:41   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 03/23] target/iblock: fix the type of the logs_per_phys Chaitanya Kulkarni
2021-03-01 10:45   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 04/23] targe/pscsi: fix the warning in pscsi_complete_cmd Chaitanya Kulkarni
2021-03-01 12:30   ` Johannes Thumshirn
2021-03-02  3:57     ` Chaitanya Kulkarni
2021-02-28  5:56 ` [PATCH 05/23] target/sbc: get rid of the warning in cmp & write Chaitanya Kulkarni
2021-03-01 12:51   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 06/23] target/pscsi: remove unsed macro ISPRINT Chaitanya Kulkarni
2021-03-01 12:56   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 07/23] target/stat: " Chaitanya Kulkarni
2021-03-01 12:56   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 08/23] target/stat: remove unsed macro NONE Chaitanya Kulkarni
2021-03-01 12:57   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 09/23] target/stat: remove unsed macro Chaitanya Kulkarni
2021-03-01 12:58   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 10/23] target/iscsi: remove unsed macro TEXT_LEN Chaitanya Kulkarni
2021-03-01 12:58   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 11/23] target/iscsi: remove unsed macro PRINT_BUF Chaitanya Kulkarni
2021-03-01 12:58   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 12/23] target/iscsi: remove the memset with declare-init Chaitanya Kulkarni
2021-03-01 12:59   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 13/23] target/configfs: " Chaitanya Kulkarni
2021-03-01 12:59   ` Johannes Thumshirn
2021-03-01 13:00   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 14/23] " Chaitanya Kulkarni
2021-03-01 12:59   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 15/23] " Chaitanya Kulkarni
2021-03-01 13:00   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 16/23] " Chaitanya Kulkarni
2021-03-01 13:00   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 17/23] " Chaitanya Kulkarni
2021-03-01 13:01   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 18/23] " Chaitanya Kulkarni
2021-03-01 13:01   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 19/23] " Chaitanya Kulkarni
2021-03-01 13:01   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 20/23] target/pr: " Chaitanya Kulkarni
2021-03-01 13:01   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 21/23] " Chaitanya Kulkarni
2021-03-01 13:02   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 22/23] " Chaitanya Kulkarni
2021-03-01 13:02   ` Johannes Thumshirn
2021-02-28  5:56 ` [PATCH 23/23] target/core: don't duplicate memset 0xff Chaitanya Kulkarni
2021-03-01 13:05   ` Johannes Thumshirn
2021-02-28 20:13 ` [PATCH 00/23] target: code cleanup michael.christie
2021-03-01  0:06   ` Chaitanya Kulkarni
2021-03-09  5:04 ` Chaitanya Kulkarni
2021-03-09 17:15   ` Bart Van Assche
2021-03-10  4:32 ` Martin K. Petersen
2021-03-16  3:14 ` Martin K. Petersen

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.