[PATCH vv6.19-rc6 3/7] fs/dlm: use list_add_tail() instead of open-coding list insertion

Alexander Aring <[email protected]>
Newsgroups dev.linux.lists.gfs2
Message-ID <[email protected]>
From: Shaurya Rane <[email protected]>

Replace the manual list pointer manipulation in add_ordered_member()
with the standard list_add_tail() helper. The original code explicitly
updated ->prev and ->next pointers to insert @newlist before @tmp,
which is exactly what list_add_tail(newlist, tmp) provides.

Using the list macro improves readability, removes a source of
potential pointer bugs, and satisfies the existing FIXME requesting
conversion to the list helpers. No functional change in the ordering
logic for DLM members.

Signed-off-by: Shaurya Rane <[email protected]>
Signed-off-by: Alexander Aring <[email protected]>
---
 fs/dlm/member.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index c0f557a80a754..c1b5598997b7f 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -299,11 +299,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
 	if (!memb)
 		list_add_tail(newlist, head);
 	else {
-		/* FIXME: can use list macro here */
-		newlist->prev = tmp->prev;
-		newlist->next = tmp;
-		tmp->prev->next = newlist;
-		tmp->prev = newlist;
+		list_add_tail(newlist, tmp);
 	}
 }
 
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.