Skip to content

variables fixes in compression.c

Anand Jain linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: reduce the variable size to fit nr_pagesfs/btrfs/compression.c+3 -30 replies
2/4btrfs: optimize variables size in btrfs_submit_compressed_readfs/btrfs/compression.c+3 -30 replies
3/4btrfs: optimize variables size in btrfs_submit_compressed_writefs/btrfs/compression.c fs/btrfs/compression.h+6 -60 replies
4/4btrfs: fix comment about max_out in btrfs_compress_pagesfs/btrfs/compression.c+0 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] variables fixes in compression.c

Patch (btrfs: reduce compressed_bio member's types) reduced the size to unsigned int as in [1]. Fix its cascading effects here. And one stale comment in the patch 4/4.

[1]
- unsigned long len;
+ unsigned int len;

- int compress_type;
+ u8 compress_type;

- unsigned long nr_pages;
+ unsigned int nr_pages;

- unsigned long compressed_len;
+ unsigned int compressed_len;

- int errors;
+ u8 errors;

As shown in [2], we set the max compressable block size to 128K. So struct async_extent can reduce some of its members to unsigned int as well.

[2]
static noinline int compress_file_range(struct async_chunk *async_chunk) ::
617 total_compressed = min_t(unsigned long, total_compressed,
618 BTRFS_MAX_UNCOMPRESSED);

But changes touches too many places, and my first attempt to fix is unsatisfactory to me, so I am just sending the changes limited to the file compression.c.

Anand Jain (4):
btrfs: optimize users of members of the struct compressed_bio
btrfs: optimize variables size in btrfs_submit_compressed_read
btrfs: optimize variables size in btrfs_submit_compressed_write
btrfs: fix comment about max_out in btrfs_compress_pages

 fs/btrfs/compression.c | 21 +++++++++------------
 fs/btrfs/compression.h |  6 +++---
 2 files changed, 12 insertions(+), 15 deletions(-)
Signature · 1 line
2.30.2