summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/compress.c
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2025-05-13 13:57:21 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2025-05-27 23:52:36 +0000
commit54ca9be0bc589a0e45959ba73c76cf3f65110c63 (patch)
tree6954709af700a39b97be216bd47457110e8f0f01 /fs/f2fs/compress.c
parentf2fs: use vmalloc instead of kvmalloc in .init_{,de}compress_ctx (diff)
downloadlinux-54ca9be0bc589a0e45959ba73c76cf3f65110c63.tar.gz
linux-54ca9be0bc589a0e45959ba73c76cf3f65110c63.zip
f2fs: introduce FAULT_VMALLOC
Introduce a new fault type FAULT_VMALLOC to simulate no memory error in f2fs_vmalloc(). Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/compress.c')
-rw-r--r--fs/f2fs/compress.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index b2ec943a4c73..0dc65634cc61 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -180,7 +180,8 @@ void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio)
#ifdef CONFIG_F2FS_FS_LZO
static int lzo_init_compress_ctx(struct compress_ctx *cc)
{
- cc->private = f2fs_vmalloc(LZO1X_MEM_COMPRESS);
+ cc->private = f2fs_vmalloc(F2FS_I_SB(cc->inode),
+ LZO1X_MEM_COMPRESS);
if (!cc->private)
return -ENOMEM;
@@ -247,7 +248,7 @@ static int lz4_init_compress_ctx(struct compress_ctx *cc)
size = LZ4HC_MEM_COMPRESS;
#endif
- cc->private = f2fs_vmalloc(size);
+ cc->private = f2fs_vmalloc(F2FS_I_SB(cc->inode), size);
if (!cc->private)
return -ENOMEM;
@@ -343,7 +344,7 @@ static int zstd_init_compress_ctx(struct compress_ctx *cc)
params = zstd_get_params(level, cc->rlen);
workspace_size = zstd_cstream_workspace_bound(&params.cParams);
- workspace = f2fs_vmalloc(workspace_size);
+ workspace = f2fs_vmalloc(F2FS_I_SB(cc->inode), workspace_size);
if (!workspace)
return -ENOMEM;
@@ -423,7 +424,7 @@ static int zstd_init_decompress_ctx(struct decompress_io_ctx *dic)
workspace_size = zstd_dstream_workspace_bound(max_window_size);
- workspace = f2fs_vmalloc(workspace_size);
+ workspace = f2fs_vmalloc(F2FS_I_SB(dic->inode), workspace_size);
if (!workspace)
return -ENOMEM;