<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/btrfs/compression.c, 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-05-02T11:19:52Z</updated>
<entry>
<title>btrfs: compression: adjust cb-&gt;compressed_folios allocation type</title>
<updated>2025-05-02T11:19:52Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2025-04-26T06:23:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f9a8ab796c6528d22de3c504c81fce7dde63d8a'/>
<id>urn:sha1:6f9a8ab796c6528d22de3c504c81fce7dde63d8a</id>
<content type='text'>
In preparation for making the kmalloc() family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct folio **" but the returned type will be
"struct page **". These are the same allocation size (pointer size), but
the types don't match. Adjust the allocation type to match the assignment.

Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
Signed-off-by: Kees Cook &lt;kees@kernel.org&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: 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: use filemap_get_folio() helper</title>
<updated>2024-11-11T13:34:19Z</updated>
<author>
<name>Anand Jain</name>
</author>
<published>2024-10-14T15:11:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d07eaa9995fc81eb18e390d860442e598427547d'/>
<id>urn:sha1:d07eaa9995fc81eb18e390d860442e598427547d</id>
<content type='text'>
When fgp_flags and gfp_flags are zero, use filemap_get_folio(A, B)
instead of __filemap_get_folio(A, B, 0, 0)—no need for the extra
arguments 0, 0.

Signed-off-by: Anand Jain &lt;anand.jain@oracle.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: rename btrfs_folio_(set|start|end)_writer_lock()</title>
<updated>2024-11-11T13:34:18Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2024-10-09T05:51:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0f7120266584490616f031873e7148495d77dd68'/>
<id>urn:sha1:0f7120266584490616f031873e7148495d77dd68</id>
<content type='text'>
Since there is no user of reader locks, rename the writer locks into a
more generic name, by removing the "_writer" part from the name.

And also rename btrfs_subpage::writer into btrfs_subpage::locked.

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: unify to use writer locks for subpage locking</title>
<updated>2024-11-11T13:34:18Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2024-10-09T05:51:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=336e69f3025fb70db9d0dfb7f36ac79887bf5341'/>
<id>urn:sha1:336e69f3025fb70db9d0dfb7f36ac79887bf5341</id>
<content type='text'>
Since commit d7172f52e993 ("btrfs: use per-buffer locking for
extent_buffer reading"), metadata read no longer relies on the subpage
reader locking.

This means we do not need to maintain a different metadata/data split
for locking, so we can convert the existing reader lock users by:

- add_ra_bio_pages()
  Convert to btrfs_folio_set_writer_lock()

- end_folio_read()
  Convert to btrfs_folio_end_writer_lock()

- begin_folio_read()
  Convert to btrfs_folio_set_writer_lock()

- folio_range_has_eb()
  Remove the subpage-&gt;readers checks, since it is always 0.

- Remove btrfs_subpage_start_reader() and btrfs_subpage_end_reader()

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: drop unused parameter level from alloc_heuristic_ws()</title>
<updated>2024-11-11T13:34:17Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2024-10-09T14:32:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a9c50c975656e551ea4bfe0f292b05d0e2a664c5'/>
<id>urn:sha1:a9c50c975656e551ea4bfe0f292b05d0e2a664c5</id>
<content type='text'>
The compression heuristic pass does not need a level, so we can drop 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: 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: compression: add an ASSERT() to ensure the read-in length is sane</title>
<updated>2024-11-11T13:34:12Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2024-09-06T04:57:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dd5e2762544d9bd59c101de0afaad1317c2876a0'/>
<id>urn:sha1:dd5e2762544d9bd59c101de0afaad1317c2876a0</id>
<content type='text'>
There are already two bugs (one in zlib, one in zstd) that involved
compression path is not handling sector size &lt; page size cases well.

So it makes more sense to make sure that btrfs_compress_folios() returns

Since we already have two bugs (one in zlib, one in zstd) in the
compression path resulting the @total_in be to larger than the
to-be-compressed range length, there is enough reason to add an ASSERT()
to make sure the total read-in length doesn't exceed the input length.

Signed-off-by: Qu Wenruo &lt;wqu@suse.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>
</feed>
