Re: [PATCH 1/2] Use list.h instead of file_system_type next
From: Matthew Wilcox
Date: Sun May 05 2019 - 22:50:50 EST
On Sun, May 05, 2019 at 09:25:21PM +0300, Tamir Carmeli wrote:
> I just found it weird that there is a proprietary implementation of a
> linked list while surely the kernel already offers well established
> data structures.
It's a singly linked list rather than a doubly linked list.
> IMO, the current code is a bit hard to understand, especially the
> addition of a new struct to the list in the line "*p = fs" after
> find_filesystem returned the last member.
> Correct, I'm not familiar with all the use cases of the code.
It looks like a fairly standard implementation of a singly-linked
list in C to me.
> I'm not sure that XArray is a good choice since there is no notion of
> an index attached to the pointer, it's really just a linked list of
> pointers.
You don't need to attach an index to the pointer; you can just use
xa_alloc() to store it at the first available index.