<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/btrfs/compression.h, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-03-18T19:35:50Z</updated>
<entry>
<title>btrfs: defrag: extend ioctl to accept compression levels</title>
<updated>2025-03-18T19:35:50Z</updated>
<author>
<name>Daniel Vacek</name>
</author>
<published>2025-03-06T13:15:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fc5c0c5825874859069ac44c367c724acd7190fb'/>
<id>urn:sha1:fc5c0c5825874859069ac44c367c724acd7190fb</id>
<content type='text'>
The zstd and zlib compression types support setting compression levels.
Enhance the defrag interface to specify the levels as well. For zstd the
negative (realtime) levels are also accepted.

Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
Signed-off-by: Daniel Vacek &lt;neelx@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: zstd: enable negative compression levels mount option</title>
<updated>2025-03-18T19:35:41Z</updated>
<author>
<name>Daniel Vacek</name>
</author>
<published>2025-01-30T17:58:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da798fa519df6f995a493ca5105c72ccc4fc7b75'/>
<id>urn:sha1:da798fa519df6f995a493ca5105c72ccc4fc7b75</id>
<content type='text'>
Allow using the fast modes (negative compression levels) of zstd as a
mount option.

As per the results, the compression ratio is (expectedly) lower:

for level in {-15..-1} 1 2 3; \
do printf "level %3d\n" $level; \
  mount -o compress=zstd:$level /dev/sdb /mnt/test/; \
  grep sdb /proc/mounts; \
  cp -r /usr/bin       /mnt/test/; sync; compsize /mnt/test/bin; \
  cp -r /usr/share/doc /mnt/test/; sync; compsize /mnt/test/doc; \
  cp    enwik9         /mnt/test/; sync; compsize /mnt/test/enwik9; \
  cp    linux-6.13.tar /mnt/test/; sync; compsize /mnt/test/linux-6.13.tar; \
  rm -r /mnt/test/{bin,doc,enwik9,linux-6.13.tar}; \
  umount /mnt/test/; \
done |&amp; tee results | \
awk '/^level/{print}/^TOTAL/{print$3"\t"$2"  |"}' | paste - - - - -

		266M	bin  |	45M	doc  |	953M	wiki |	1.4G	source
=============================+===============+===============+===============+
level -15	180M	67%  |	30M	68%  |	694M	72%  |	598M	40%  |
level -14	180M	67%  |	30M	67%  |	683M	71%  |	581M	39%  |
level -13	177M	66%  |	29M	66%  |	671M	70%  |	566M	38%  |
level -12	174M	65%  |	29M	65%  |	658M	69%  |	548M	37%  |
level -11	174M	65%  |	28M	64%  |	645M	67%  |	530M	35%  |
level -10	171M	64%  |	28M	62%  |	631M	66%  |	512M	34%  |
level  -9	165M	62%  |	27M	61%  |	615M	64%  |	493M	33%  |
level  -8	161M	60%  |	27M	59%  |	598M	62%  |	475M	32%  |
level  -7	155M	58%  |	26M	58%  |	582M	61%  |	457M	30%  |
level  -6	151M	56%  |	25M	56%  |	565M	59%  |	437M	29%  |
level  -5	145M	54%  |	24M	55%  |	545M	57%  |	417M	28%  |
level  -4	139M	52%  |	23M	52%  |	520M	54%  |	391M	26%  |
level  -3	135M	50%  |	22M	50%  |	495M	51%  |	369M	24%  |
level  -2	127M	47%  |	22M	48%  |	470M	49%  |	349M	23%  |
level  -1	120M	45%  |	21M	47%  |	452M	47%  |	332M	22%  |
level   1	110M	41%  |	17M	39%  |	362M	38%  |	290M	19%  |
level   2	106M	40%  |	17M	38%  |	349M	36%  |	288M	19%  |
level   3	104M	39%  |	16M	37%  |	340M	35%  |	276M	18%  |

The samples represent some data sets that can be commonly found and show
approximate compressibility. The fast levels trade off speed for ratio
and are best suitable for highly compressible data.

As can be seen above, comparing the results to the current default zstd
level 3, the negative levels are roughly 2x worse at -15 and the
ratio increases almost linearly with each level.

Signed-off-by: Daniel Vacek &lt;neelx@suse.com&gt;
[ update changelog ]
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: lzo: drop unused paramter level from lzo_alloc_workspace()</title>
<updated>2024-11-11T13:34:16Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2024-10-09T14:31:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3f4b1bc1c0b594bb6b059e6e2be0f3a7c2bca1d0'/>
<id>urn:sha1:3f4b1bc1c0b594bb6b059e6e2be0f3a7c2bca1d0</id>
<content type='text'>
The LZO compression has only one level, we don't need to pass the
parameter.

Reviewed-by: Anand Jain &lt;anand.jain@oracle.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: convert btrfs_decompress() to take a folio</title>
<updated>2024-09-10T14:51:21Z</updated>
<author>
<name>Li Zetao</name>
</author>
<published>2024-08-28T18:29:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aeb6d8814841ec106acc5ffea772d4102ffc72b6'/>
<id>urn:sha1:aeb6d8814841ec106acc5ffea772d4102ffc72b6</id>
<content type='text'>
The old page API is being gradually replaced and converted to use folio
to improve code readability and avoid repeated conversion between page
and folio. Based on the previous patch, the compression path can be
directly used in folio without converting to page.

Signed-off-by: Li Zetao &lt;lizetao1@huawei.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: convert zstd_decompress() to take a folio</title>
<updated>2024-09-10T14:51:21Z</updated>
<author>
<name>Li Zetao</name>
</author>
<published>2024-08-28T18:29:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b70f3a45464b012feb8e86f15f37e0c4b2f69fe1'/>
<id>urn:sha1:b70f3a45464b012feb8e86f15f37e0c4b2f69fe1</id>
<content type='text'>
The old page API is being gradually replaced and converted to use folio
to improve code readability and avoid repeated conversion between page
and folio. And memcpy_to_page() can be replaced with memcpy_to_folio().
But there is no memzero_folio(), but it can be replaced equivalently by
folio_zero_range().

Signed-off-by: Li Zetao &lt;lizetao1@huawei.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: convert lzo_decompress() to take a folio</title>
<updated>2024-09-10T14:51:21Z</updated>
<author>
<name>Li Zetao</name>
</author>
<published>2024-08-28T18:29:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9f9a4e43a87082144e43320edaf38d980d18d069'/>
<id>urn:sha1:9f9a4e43a87082144e43320edaf38d980d18d069</id>
<content type='text'>
The old page API is being gradually replaced and converted to use folio
to improve code readability and avoid repeated conversion between page
and folio. And memcpy_to_page() can be replaced with memcpy_to_folio().
But there is no memzero_folio(), but it can be replaced equivalently by
folio_zero_range().

Signed-off-by: Li Zetao &lt;lizetao1@huawei.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: convert zlib_decompress() to take a folio</title>
<updated>2024-09-10T14:51:21Z</updated>
<author>
<name>Li Zetao</name>
</author>
<published>2024-08-28T18:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=54c78d497b383f5828b019d41149a9e76cfc771c'/>
<id>urn:sha1:54c78d497b383f5828b019d41149a9e76cfc771c</id>
<content type='text'>
The old page API is being gradually replaced and converted to use folio
to improve code readability and avoid repeated conversion between page
and folio. And memcpy_to_page() can be replaced with memcpy_to_folio().
But there is no memzero_folio(), but it can be replaced equivalently by
folio_zero_range().

Signed-off-by: Li Zetao &lt;lizetao1@huawei.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: make compression path to be subpage compatible</title>
<updated>2024-09-10T14:51:20Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2024-05-29T07:33:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd1e75d0105d2289e24b6d63cee49e6f7952c8bf'/>
<id>urn:sha1:fd1e75d0105d2289e24b6d63cee49e6f7952c8bf</id>
<content type='text'>
Currently btrfs compression path is not really subpage compatible, every
thing is still done in page unit.

That's fine for regular sector size and subpage routine. As even for
subpage routine compression is only enabled if the whole range is page
aligned, so reading the page cache in page unit is totally fine.

However in preparation for the future subpage perfect compression
support, we need to change the compression routine to properly handle a
subpage range.

This patch would prepare both zlib and zstd to only read the subpage
range for compression.
Lzo is already doing subpage aware read, as lzo's on-disk format is
already sectorsize dependent.

Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: pass a btrfs_inode to btrfs_compress_heuristic()</title>
<updated>2024-07-11T13:33:28Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2022-01-31T18:16:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e2877c2a032d821ca339dc333401e0c63bf67d5c'/>
<id>urn:sha1:e2877c2a032d821ca339dc333401e0c63bf67d5c</id>
<content type='text'>
Pass a struct btrfs_inode to btrfs_compress_heuristic() as it's an
internal interface, allowing to remove some use of BTRFS_I.

Reviewed-by: Boris Burkov &lt;boris@bur.io&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: compression: migrate compression/decompression paths to folios</title>
<updated>2024-05-07T19:31:02Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2024-01-29T09:46:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=400b172b8cdcff87038697169fe9e4222120dd9a'/>
<id>urn:sha1:400b172b8cdcff87038697169fe9e4222120dd9a</id>
<content type='text'>
For both compression and decompression paths, we always require a
"struct page **pages" and "unsigned long nr_pages", this involves quite
some part of the btrfs compression paths:

- All the compression entry points

- compressed_bio structure
  This affects both compression and decompression.

- async_extent structure

Unfortunately with all those involved parts, there is no good way to
split the conversion into smaller patches while still passing compiling.
So do this in one big conversion in one go.

Please note this is direct page-&gt;folio conversion, no change on the page
sized folio requirement yet.

Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
[ minor style fixups ]
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
</feed>
