fs: Introduce discard_range()
discard_range() is a way to tell the lower layers that we are no longer
interested in a data range of a file, so that the lower layers can
discard the underlying data if desired.

This is mainly designed to bypass the deficiencies of our block layer.
We cache the block data in chunks of multiple KiB (16 currently) if
we fall into the block layer with write requests smaller than that
we have to read/modify/write a chunk. With the help of discard_range()
code writing files to a raw block device can now discard the range the
file will be written to. The block layer then no longer has to read
the chunks first that are inside the discard range.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent ee6a508 commit 6a1daf5adcefad3d08f97dd85e2917eac12e7202
@Sascha Hauer Sascha Hauer authored on 13 Dec 2019
Showing 2 changed files
View
fs/fs.c
View
include/fs.h