From 38991d1222cdbd808ffa21c89a8d86f97e62b954 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 05:06:36 +0000 Subject: [PATCH 1/6] scst_mem: Fix indentation See also trunk r677. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7040 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 56d51c09c..2ad23d665 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1329,7 +1329,7 @@ struct scatterlist *scst_alloc_sg(int size, gfp_t gfp_mask, int *count) * on free again. */ sgv_hiwmk_uncheck(-pages); - } + } } res = kmalloc_array(pages, sizeof(*res), gfp_mask); From 89e17d75c9a3738093e06b17ae6186b5ee0bbd7f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 05:07:48 +0000 Subject: [PATCH 2/6] scst: Use READ_ONCE() instead of ACCESS_ONCE() This is a stylistic change only. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7041 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 8 ++++---- scst/include/scst.h | 2 +- scst/src/dev_handlers/scst_user.c | 2 +- scst/src/dev_handlers/scst_vdisk.c | 4 ++-- scst/src/scst_lib.c | 2 +- scst/src/scst_sysfs.c | 4 ++-- scst/src/scst_targ.c | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 8bb03ea6c..93e1b004a 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -70,12 +70,12 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q) #endif #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(READ_ONCE) /* - * See also patch "Move ACCESS_ONCE() to " (commit ID - * 9c3cdc1f83a6e07092392ff4aba6466517dbd1d0). + * See also patch "kernel: Provide READ_ONCE and ASSIGN_ONCE" (commit ID + * 230fa253df6352af12ad0a16128760b5cb3f92df). */ -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +#define READ_ONCE(x) (*(volatile typeof(x) *)&(x)) #endif /* */ diff --git a/scst/include/scst.h b/scst/include/scst.h index 797d756f2..b4930e086 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2789,7 +2789,7 @@ struct scst_device { ** Dev's control mode page related values. Updates serialized ** by device blocking. Since device blocking protects only ** commands on the execution stage, in all other read cases - ** use ACCESS_ONCE(), if necessary. Modified independently + ** use READ_ONCE(), if necessary. Modified independently ** to the above fields, hence the alignment. *************************************************************/ diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 34f5fb1be..aad69ee01 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -3500,7 +3500,7 @@ static int dev_user_register_dev(struct file *file, } /* * Assumption here is that the private_data reading is atomic, - * hence could be lockless and without ACCESS_ONCE(). + * hence could be lockless and without READ_ONCE(). */ file->private_data = dev; spin_unlock(&dev_list_lock); diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index fb24562de..768686c70 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -148,7 +148,7 @@ struct scst_vdisk_dev { /* * Not protected, because assignments to aligned 64-bit integers are - * atomic. At worst, accesses to it should be covered by ACCESS_ONCE(), + * atomic. At worst, accesses to it should be covered by READ_ONCE(), * but not sure if that is really needed, so would prefer to keep it * away from the fast path. */ @@ -8791,7 +8791,7 @@ static ssize_t vdev_size_show(struct kobject *kobj, struct kobj_attribute *attr, dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - size = ACCESS_ONCE(virt_dev->file_size); + size = READ_ONCE(virt_dev->file_size); if (virt_dev->nullio && size == VDISK_NULLIO_SIZE) key = false; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 5017447d9..01e737fe5 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -13420,7 +13420,7 @@ static void scst_process_qerr(struct scst_cmd *cmd) /* dev->qerr can be changed behind our back */ q = dev->qerr; - qerr = ACCESS_ONCE(q); /* ACCESS_ONCE doesn't work for bit fields */ + qerr = READ_ONCE(q); /* READ_ONCE() doesn't work for bit fields */ TRACE_DBG("Processing QErr %d for cmd %p", qerr, cmd); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 8bc922cc8..473a7dfff 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -3484,8 +3484,8 @@ static ssize_t scst_dev_block_show(struct kobject *kobj, dev = container_of(kobj, struct scst_device, dev_kobj); - pos = sprintf(buf, "%d %d\n", ACCESS_ONCE(dev->ext_blocks_cnt), - dev->ext_blocking_pending); + pos = sprintf(buf, "%d %d\n", READ_ONCE(dev->ext_blocks_cnt), + dev->ext_blocking_pending); TRACE_EXIT_RES(pos); return pos; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d3e46430c..5d27607e9 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3679,7 +3679,7 @@ static inline bool scst_check_alua(struct scst_cmd *cmd, int *out_res) int (*alua_filter)(struct scst_cmd *cmd); bool res = false; - alua_filter = ACCESS_ONCE(cmd->tgt_dev->alua_filter); + alua_filter = READ_ONCE(cmd->tgt_dev->alua_filter); if (unlikely(alua_filter)) { int ac = alua_filter(cmd); @@ -3816,7 +3816,7 @@ static int scst_exec_check_sn(struct scst_cmd **active_cmd) EXTRACHECKS_BUG_ON(!cmd->sn_set); - expected_sn = ACCESS_ONCE(order_data->expected_sn); + expected_sn = READ_ONCE(order_data->expected_sn); /* Optimized for lockless fast path */ if ((cmd->sn != expected_sn) || (order_data->hq_cmd_count > 0)) { spin_lock_irq(&order_data->sn_lock); From 07e91f348ea8327a87a4dd8f815e250aa48d9a31 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 05:08:58 +0000 Subject: [PATCH 3/6] scripts/run-regression-tests: Avoid that "make oldconfig" hangs git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7042 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/run-regression-tests | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index b61ea45f1..79648564b 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -303,7 +303,7 @@ CONFIG_X86_X32 \ fi && make -s allmodconfig &>"${outputdir}/make-config-output.txt" && for c in $disable; do sed -i.tmp "s/^$c=[ym]\$/$c=n/" .config; done && - make -s oldconfig &>/dev/null + make -s oldconfig /dev/null ) } @@ -402,7 +402,7 @@ function run_smatch { echo "Running smatch on the patched kernel in ${subdir} $@ ..." if (cd "${outputdir}/linux-$k" && for c in $disable; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done && - make -s oldconfig && + make -s oldconfig Date: Thu, 1 Dec 2016 05:10:43 +0000 Subject: [PATCH 4/6] scst.spec.in: Remove %dir /lib/modules/%{kversion}/extra This avoids that the SCST RPM conflicts with other kernel RPMs that install kernel modules in the "extra" directory. Reported and suggested by Consus . git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7043 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst.spec.in | 1 - 1 file changed, 1 deletion(-) diff --git a/scst.spec.in b/scst.spec.in index 31df8353c..aeab505a0 100644 --- a/scst.spec.in +++ b/scst.spec.in @@ -164,7 +164,6 @@ rm -rf /usr/local/include/scst %files %defattr(0644,root,root) -%dir /lib/modules/%{kversion}/extra /lib/modules/%{kversion}/extra/fcst.ko /lib/modules/%{kversion}/extra/ib_srpt.ko /lib/modules/%{kversion}/extra/iscsi-scst.ko From e42dfbbb724a6927b060a86bdf7b646d3f6c22eb Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 05:16:15 +0000 Subject: [PATCH 5/6] scst_vdisk: Remove a superfluous cast git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7044 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 768686c70..93fdc3c0c 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2048,7 +2048,7 @@ static int vdisk_format_dif(struct scst_cmd *cmd, uint64_t start_lba, iv_count, &loff, 0); if (err < 0) { PRINT_ERROR("Formatting DIF write() returned %lld from " - "%zd", (long long)err, full_len); + "%zd", err, full_len); if (err == -EAGAIN) scst_set_busy(cmd); else From 2470b10ad098208923d826b32ad44e72a86411f5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 05:22:01 +0000 Subject: [PATCH 6/6] scst_vdisk: Remove more unneeded casts git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7045 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 93fdc3c0c..50da21958 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2961,8 +2961,7 @@ static bool vdisk_parse_offset(struct vdisk_cmd_params *p, struct scst_cmd *cmd) fua = (cdb[10] & 0x8); if (fua) TRACE(TRACE_ORDER, "FUA: loff=%lld, data_len=%lld", - (unsigned long long)loff, - (unsigned long long)data_len); + loff, data_len); } break; case WRITE_10: @@ -6022,7 +6021,7 @@ restart: unsigned long flags; PRINT_ERROR("DIF write() returned %lld from %zd", - (long long)err, full_len); + err, full_len); /* To protect sense setting with blockio */ spin_lock_irqsave(&vdev_err_lock, flags); if (err == -EAGAIN)