[PATCH 2/2] cpukit/jffs2: Use unprotected chain calls

Kinsey Moore kinsey.moore at oarcorp.com
Wed Sep 20 18:35:08 UTC 2023


Use unprotected chain calls for delayed write workqueues since these
calls are either protected by locks or only operate on local chains and
are never accessed from interrupt context.

Updates #4956
---
 cpukit/libfs/src/jffs2/src/fs-rtems.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 36bada9a98..644c7385c5 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -1246,7 +1246,7 @@ void jffs2_queue_delayed_work(struct delayed_work *work, int delay_ms)
 	mutex_lock(&delayed_work_mutex);
 	if (rtems_chain_is_node_off_chain(&work->work.node)) {
 		work->execution_time = rtems_clock_get_uptime_nanoseconds() + delay_ms*1000000;
-		rtems_chain_append(&delayed_work_chain, &work->work.node);
+		rtems_chain_append_unprotected(&delayed_work_chain, &work->work.node);
 	}
 	mutex_unlock(&delayed_work_mutex);
 }
@@ -1267,7 +1267,7 @@ static void jffs2_remove_delayed_work(struct delayed_work *dwork)
 		work = (struct delayed_work*) node;
 		rtems_chain_node* next_node = rtems_chain_next(node);
 		if (work == dwork) {
-			rtems_chain_extract(node);
+			rtems_chain_extract_unprotected(node);
 			rtems_chain_set_off_chain(node);
 			mutex_unlock(&delayed_work_mutex);
 			return;
@@ -1296,8 +1296,8 @@ static void process_delayed_work(void)
 		work = (struct delayed_work*) node;
 		rtems_chain_node* next_node = rtems_chain_next(node);
 		if (rtems_clock_get_uptime_nanoseconds() >= work->execution_time) {
-			rtems_chain_extract(node);
-			rtems_chain_append(&process_work_chain, node);
+			rtems_chain_extract_unprotected(node);
+			rtems_chain_append_unprotected(&process_work_chain, node);
 		}
 		node = next_node;
 	}
@@ -1315,7 +1315,7 @@ static void process_delayed_work(void)
 #ifdef RTEMS_DEBUG
 		mutex_lock(&delayed_work_mutex);
 #endif
-		rtems_chain_extract(node);
+		rtems_chain_extract_unprotected(node);
 #ifdef RTEMS_DEBUG
 		node->next = node;
 		mutex_unlock(&delayed_work_mutex);
-- 
2.39.2



More information about the devel mailing list