diff mbox series

[3/6] io_uring/slist: add list-to-list list splice helper

Message ID 20241122161645.494868-4-axboe@kernel.dk (mailing list archive)
State New
Headers show
Series task work cleanups | expand

Commit Message

Jens Axboe Nov. 22, 2024, 4:12 p.m. UTC
Add a helper to splice a source list to a destination list.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/slist.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/io_uring/slist.h b/io_uring/slist.h
index 0eb194817242..7ac7c136b702 100644
--- a/io_uring/slist.h
+++ b/io_uring/slist.h
@@ -85,6 +85,22 @@  static inline bool wq_list_splice(struct io_wq_work_list *list,
 	return false;
 }
 
+static inline bool wq_list_splice_list(struct io_wq_work_list *src,
+				       struct io_wq_work_list *dst)
+{
+	bool ret = false;
+
+	if (wq_list_empty(dst)) {
+		*dst = *src;
+	} else {
+		dst->last->next = src->first;
+		dst->last = src->last;
+		ret = true;
+	}
+	INIT_WQ_LIST(src);
+	return false;
+}
+
 static inline void wq_stack_add_head(struct io_wq_work_node *node,
 				     struct io_wq_work_node *stack)
 {