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);