Skip to content

Commit 6155b40

Browse files
shauryarane05teigland
authored andcommitted
fs/dlm: use list_add_tail() instead of open-coding list insertion
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 <ssrane_b23@ee.vjti.ac.in> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 080e556 commit 6155b40

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

fs/dlm/member.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
299299
if (!memb)
300300
list_add_tail(newlist, head);
301301
else {
302-
/* FIXME: can use list macro here */
303-
newlist->prev = tmp->prev;
304-
newlist->next = tmp;
305-
tmp->prev->next = newlist;
306-
tmp->prev = newlist;
302+
list_add_tail(newlist, tmp);
307303
}
308304
}
309305

0 commit comments

Comments
 (0)