mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scst_targ: Use 'atomic_inc_return' to check 'dev->dev_cmd_count'
1. atomic_inc_return() avoids a race in between atomic_read() & atomic_inc(). 2. atomic_inc_return() is a few cycles faster than atomic_inc()/atomic_read() sequence.
This commit is contained in:
@@ -4345,8 +4345,7 @@ static int __scst_init_cmd(struct scst_cmd *cmd)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT
|
||||
atomic_inc(&dev->dev_cmd_count);
|
||||
cnt = atomic_read(&dev->dev_cmd_count);
|
||||
cnt = atomic_inc_return(&dev->dev_cmd_count);
|
||||
if (unlikely(cnt > SCST_MAX_DEV_COMMANDS)) {
|
||||
if (!failure) {
|
||||
TRACE(TRACE_FLOW_CONTROL,
|
||||
|
||||
Reference in New Issue
Block a user