[PATCH 1/2] list: introduce a new cutting helper
Chaitanya Kulkarni
chaitanyak at nvidia.com
Wed Jun 12 10:19:25 PDT 2024
On 6/12/24 08:51, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
>
> Provide a helper to remove elements from a list to the end, and place
> those elements in a new list.
>
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
-ck
I did quick run before the review if anybody cares :-
head entry list
node [3 | | 2] [1 | | 3] [2 | | 1] [X | | X]
addr 1 2 3 4
+ list->next = entry;
+ list->prev = head->prev;
node [3 | | 2]
addr 4
+ head->prev = entry->prev;
node [1 | | 2]
addr 1
+ entry->prev->next = head; node [1 | | 1]
addr 1
+ entry->prev = list; node [4 | | 3]
addr 2
+ list->prev->next = list;
node [2 | | 4] addr 3
reordering with list at front with head :-
head
node [1 | | 1]
addr
list
node [3 | | 2] [4 | | 3] [2 | | 4]
addr 4 2 3
More information about the Linux-nvme
mailing list