fs: ramfs: Use dynamically sized chunks
This changes the way ramfs stores its data. So far we used equally sized
chunks, this patch changes it to use chunks in a size that fits our
needs. The chunks are always allocated in the size they are needed for
the current truncation. Only if we fail to allocate all desired memory
at once we fall back to allocating smaller chunks. Together with using
the generic list implementation this results in smaller code and has
the advantage that many image files end up being contiguously in memory
and thus we can provide a memmap for them. Files will end up
contiguously in memory when they are first created, then truncated to
the final size and then filled up with data. This is something which
is normally easily achievable when desired.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 925f7bb commit b9ce4012e9c63be6861ec60f704597feb9805372
@Sascha Hauer Sascha Hauer authored on 10 Jun 2020
Showing 1 changed file
View
fs/ramfs.c