scst: Use READ_ONCE() instead of ACCESS_ONCE()

This commit is contained in:
Bart Van Assche
2016-10-20 21:55:26 -07:00
parent a0f39ca7ae
commit bfce93686c
7 changed files with 13 additions and 13 deletions
+4 -4
View File
@@ -69,12 +69,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 <linux/compiler.h>" (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
/* <linux/cpumask.h> */
+1 -1
View File
@@ -2793,7 +2793,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.
*************************************************************/
+1 -1
View File
@@ -3495,7 +3495,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);
+2 -2
View File
@@ -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.
*/
@@ -8789,7 +8789,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;
+1 -1
View File
@@ -13525,7 +13525,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);
+2 -2
View File
@@ -3483,8 +3483,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;
+2 -2
View File
@@ -3669,7 +3669,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);
@@ -3806,7 +3806,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);