Skip to contentSkip to conversation

partition-generic: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

PATCH New Andreea-Cristina Bernat 1 participant 1 message Aug 22, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partition-generic: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

The uses of "rcu_assign_pointer()" are NULLing out the pointers. According to RCU_INIT_POINTER()'s block comment:
"1. This use of RCU_INIT_POINTER() is NULLing out the pointer"
it is better to use it instead of rcu_assign_pointer() because it has a smaller overhead.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
(..., NULL)

---
 block/partition-generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/partition-generic.c +2 -2
index 789cdea..f1ef057 100644
@@ -249,8 +249,8 @@ void delete_partition(struct gendisk *disk, int partno)
 	if (!part)
 		return;
 
-	rcu_assign_pointer(ptbl->part[partno], NULL);
-	rcu_assign_pointer(ptbl->last_lookup, NULL);
+	RCU_INIT_POINTER(ptbl->part[partno], NULL);
+	RCU_INIT_POINTER(ptbl->last_lookup, NULL);
 	kobject_put(part->holder_dir);
 	device_del(part_to_dev(part));
 	blk_free_devt(part_devt(part));
Signature · 1 line
1.9.1