Repository navigation
Commit 33940d0
target: encapsulate smp_mb__after_atomic()
The target code has a rather generous helping of smp_mb__after_atomic()
throughout the code base. Most atomic operations were followed by one
and none were preceded by smp_mb__before_atomic(), nor accompanied by a
comment explaining the need for a barrier.
Instead of trying to prove for every case whether or not it is needed,
this patch introduces atomic_inc_mb() and atomic_dec_mb(), which
explicitly include the memory barriers before and after the atomic
operation. For now they are defined in a target header, although they
could be of general use.
Most of the existing atomic/mb combinations were replaced by the new
helpers. In a few cases the atomic was sandwiched in
spin_lock/spin_unlock and I simply removed the barrier.
I suspect that in most cases the correct conversion would have been to
drop the barrier. I also suspect that a few cases exist where a) the
barrier was necessary and b) a second barrier before the atomic would
have been necessary and got added by this patch.
Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>1 parent 74ed7e6 commit 33940d0
7 files changed
Lines changed: 70 additions & 115 deletions
File tree
- drivers/target
- loopback
- include/target
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
963 | | - | |
964 | | - | |
| 963 | + | |
965 | 964 | | |
966 | 965 | | |
967 | 966 | | |
| |||
995 | 994 | | |
996 | 995 | | |
997 | 996 | | |
998 | | - | |
999 | | - | |
| 997 | + | |
1000 | 998 | | |
1001 | 999 | | |
1002 | 1000 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
397 | 396 | | |
398 | 397 | | |
399 | 398 | | |
| |||
403 | 402 | | |
404 | 403 | | |
405 | 404 | | |
406 | | - | |
407 | | - | |
| 405 | + | |
408 | 406 | | |
409 | 407 | | |
410 | 408 | | |
| |||
998 | 996 | | |
999 | 997 | | |
1000 | 998 | | |
1001 | | - | |
1002 | | - | |
| 999 | + | |
1003 | 1000 | | |
1004 | 1001 | | |
1005 | 1002 | | |
| |||
1028 | 1025 | | |
1029 | 1026 | | |
1030 | 1027 | | |
1031 | | - | |
1032 | | - | |
| 1028 | + | |
1033 | 1029 | | |
1034 | 1030 | | |
1035 | 1031 | | |
| |||
1063 | 1059 | | |
1064 | 1060 | | |
1065 | 1061 | | |
1066 | | - | |
1067 | 1062 | | |
1068 | 1063 | | |
1069 | 1064 | | |
| |||
1125 | 1120 | | |
1126 | 1121 | | |
1127 | 1122 | | |
1128 | | - | |
1129 | 1123 | | |
1130 | 1124 | | |
1131 | 1125 | | |
| |||
1168 | 1162 | | |
1169 | 1163 | | |
1170 | 1164 | | |
1171 | | - | |
1172 | 1165 | | |
1173 | 1166 | | |
1174 | 1167 | | |
| |||
1184 | 1177 | | |
1185 | 1178 | | |
1186 | 1179 | | |
1187 | | - | |
1188 | | - | |
| 1180 | + | |
1189 | 1181 | | |
1190 | 1182 | | |
1191 | 1183 | | |
| |||
1198 | 1190 | | |
1199 | 1191 | | |
1200 | 1192 | | |
1201 | | - | |
1202 | | - | |
| 1193 | + | |
1203 | 1194 | | |
1204 | 1195 | | |
1205 | 1196 | | |
| |||
1227 | 1218 | | |
1228 | 1219 | | |
1229 | 1220 | | |
1230 | | - | |
1231 | | - | |
| 1221 | + | |
1232 | 1222 | | |
1233 | 1223 | | |
1234 | 1224 | | |
| |||
1238 | 1228 | | |
1239 | 1229 | | |
1240 | 1230 | | |
1241 | | - | |
1242 | | - | |
| 1231 | + | |
1243 | 1232 | | |
1244 | 1233 | | |
1245 | 1234 | | |
1246 | 1235 | | |
1247 | 1236 | | |
1248 | 1237 | | |
1249 | | - | |
1250 | | - | |
| 1238 | + | |
1251 | 1239 | | |
1252 | 1240 | | |
1253 | 1241 | | |
| |||
1260 | 1248 | | |
1261 | 1249 | | |
1262 | 1250 | | |
1263 | | - | |
1264 | | - | |
| 1251 | + | |
1265 | 1252 | | |
1266 | 1253 | | |
1267 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
229 | 228 | | |
230 | 229 | | |
231 | 230 | | |
| |||
1388 | 1387 | | |
1389 | 1388 | | |
1390 | 1389 | | |
1391 | | - | |
1392 | | - | |
| 1390 | + | |
1393 | 1391 | | |
1394 | 1392 | | |
1395 | 1393 | | |
| |||
1422 | 1420 | | |
1423 | 1421 | | |
1424 | 1422 | | |
1425 | | - | |
1426 | | - | |
| 1423 | + | |
1427 | 1424 | | |
1428 | 1425 | | |
1429 | 1426 | | |
| |||
0 commit comments