# Re: Support for compressed inline extents

- From: David Sterba \<hidden\>
- Date: 2021-08-27 10:11:47 
- List: linux-btrfs
- Page: https://ratatoskr.run/linux-btrfs/2021/08/7546015
- Thread: https://ratatoskr.run/linux-btrfs/2021/08/7544822/t.md

```text
On Mon, Aug 23, 2021 at 04:23:29PM -0400, Zygo Blaxell wrote:
> On Mon, Aug 23, 2021 at 09:34:27PM +0200, Forza wrote:
> > Further up you showed that we can read encoded inlined data. What is missing
> > for that we can read encoded inlined data that decode to >page_size in size?
> 
> In uncompress_inline():
> 
> 	// decoded length of extent on disk...
> 	max_size = btrfs_file_extent_ram_bytes(leaf, item);
> 
> 	...
> 
> 	// ...can never be more than one page because of this line(*)
> 	max_size = min_t(unsigned long, PAGE_SIZE, max_size);
> 
> There might be further constraints around this code (e.g. the caller
> only fills in structures for one page, or doesn't bother to call this
> function at all for offsets above PAGE_SIZE).
> 
> All the restrictions would need to be removed in the kernel and support
> for reading multi-page inline extents added where necessary.  There would
> have to be an incompat bit on the filesystem to prevent old kernels from
> trying (and failing) to read longer inline extents.  The disk format is
> already technically capable of specifying a longer inline extent (up to
> min(UINT32_MAX, metadata_page_size)) but that was never the problem.

Regarding the idea of compressed inline extents, I'm not much in favor
of increasing the limit beyond one page (or sector). The metadata space
is more precious and that's also the motivation behind low default
max_inline. Another thing is mixing data and metadata with potentially
different block group profiles.

The inline files is IMO a nice little optimization and helps when the
size is below certain limit to avoid wasting data blocks and the
indirection.
```
