Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: zlib: don't cache sectorsize in a local variable

The sectorsize is used once or at most twice in the callbacks, no need
to cache it on stack.

Signed-off-by: David Sterba <dsterba@suse.com>

+3 -5
+3 -5
fs/btrfs/zlib.c
··· 71 71 72 72 struct list_head *zlib_alloc_workspace(struct btrfs_fs_info *fs_info, unsigned int level) 73 73 { 74 - const u32 blocksize = fs_info->sectorsize; 75 74 struct workspace *workspace; 76 75 int workspacesize; 77 76 ··· 90 91 workspace->buf_size = ZLIB_DFLTCC_BUF_SIZE; 91 92 } 92 93 if (!workspace->buf) { 93 - workspace->buf = kmalloc(blocksize, GFP_KERNEL); 94 - workspace->buf_size = blocksize; 94 + workspace->buf = kmalloc(fs_info->sectorsize, GFP_KERNEL); 95 + workspace->buf_size = fs_info->sectorsize; 95 96 } 96 97 if (!workspace->strm.workspace || !workspace->buf) 97 98 goto fail; ··· 158 159 char *data_in = NULL; 159 160 struct folio *in_folio = NULL; 160 161 struct folio *out_folio = NULL; 161 - const u32 blocksize = fs_info->sectorsize; 162 162 const u64 orig_end = start + len; 163 163 164 164 ret = zlib_deflateInit(&workspace->strm, workspace->level); ··· 238 240 } 239 241 240 242 /* We're making it bigger, give up. */ 241 - if (workspace->strm.total_in > blocksize * 2 && 243 + if (workspace->strm.total_in > fs_info->sectorsize * 2 && 242 244 workspace->strm.total_in < workspace->strm.total_out) { 243 245 ret = -E2BIG; 244 246 goto out;