Commit a7811840 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: use f2fs_{err,info}_ratelimited() for cleanup

Commit b1c9d3f8 ("f2fs: support printk_ratelimited() in f2fs_printk()")
missed some cases, cover all remains for cleanup.
Signed-off-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent aa4074e8
...@@ -198,8 +198,8 @@ static int lzo_compress_pages(struct compress_ctx *cc) ...@@ -198,8 +198,8 @@ static int lzo_compress_pages(struct compress_ctx *cc)
ret = lzo1x_1_compress(cc->rbuf, cc->rlen, cc->cbuf->cdata, ret = lzo1x_1_compress(cc->rbuf, cc->rlen, cc->cbuf->cdata,
&cc->clen, cc->private); &cc->clen, cc->private);
if (ret != LZO_E_OK) { if (ret != LZO_E_OK) {
printk_ratelimited("%sF2FS-fs (%s): lzo compress failed, ret:%d\n", f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, ret); "lzo compress failed, ret:%d", ret);
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -212,17 +212,15 @@ static int lzo_decompress_pages(struct decompress_io_ctx *dic) ...@@ -212,17 +212,15 @@ static int lzo_decompress_pages(struct decompress_io_ctx *dic)
ret = lzo1x_decompress_safe(dic->cbuf->cdata, dic->clen, ret = lzo1x_decompress_safe(dic->cbuf->cdata, dic->clen,
dic->rbuf, &dic->rlen); dic->rbuf, &dic->rlen);
if (ret != LZO_E_OK) { if (ret != LZO_E_OK) {
printk_ratelimited("%sF2FS-fs (%s): lzo decompress failed, ret:%d\n", f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, ret); "lzo decompress failed, ret:%d", ret);
return -EIO; return -EIO;
} }
if (dic->rlen != PAGE_SIZE << dic->log_cluster_size) { if (dic->rlen != PAGE_SIZE << dic->log_cluster_size) {
printk_ratelimited("%sF2FS-fs (%s): lzo invalid rlen:%zu, " f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
"expected:%lu\n", KERN_ERR, "lzo invalid rlen:%zu, expected:%lu",
F2FS_I_SB(dic->inode)->sb->s_id, dic->rlen, PAGE_SIZE << dic->log_cluster_size);
dic->rlen,
PAGE_SIZE << dic->log_cluster_size);
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -294,16 +292,15 @@ static int lz4_decompress_pages(struct decompress_io_ctx *dic) ...@@ -294,16 +292,15 @@ static int lz4_decompress_pages(struct decompress_io_ctx *dic)
ret = LZ4_decompress_safe(dic->cbuf->cdata, dic->rbuf, ret = LZ4_decompress_safe(dic->cbuf->cdata, dic->rbuf,
dic->clen, dic->rlen); dic->clen, dic->rlen);
if (ret < 0) { if (ret < 0) {
printk_ratelimited("%sF2FS-fs (%s): lz4 decompress failed, ret:%d\n", f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, ret); "lz4 decompress failed, ret:%d", ret);
return -EIO; return -EIO;
} }
if (ret != PAGE_SIZE << dic->log_cluster_size) { if (ret != PAGE_SIZE << dic->log_cluster_size) {
printk_ratelimited("%sF2FS-fs (%s): lz4 invalid ret:%d, " f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
"expected:%lu\n", KERN_ERR, "lz4 invalid ret:%d, expected:%lu",
F2FS_I_SB(dic->inode)->sb->s_id, ret, ret, PAGE_SIZE << dic->log_cluster_size);
PAGE_SIZE << dic->log_cluster_size);
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -350,9 +347,8 @@ static int zstd_init_compress_ctx(struct compress_ctx *cc) ...@@ -350,9 +347,8 @@ static int zstd_init_compress_ctx(struct compress_ctx *cc)
stream = zstd_init_cstream(&params, 0, workspace, workspace_size); stream = zstd_init_cstream(&params, 0, workspace, workspace_size);
if (!stream) { if (!stream) {
printk_ratelimited("%sF2FS-fs (%s): %s zstd_init_cstream failed\n", f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, "%s zstd_init_cstream failed", __func__);
__func__);
kvfree(workspace); kvfree(workspace);
return -EIO; return -EIO;
} }
...@@ -390,16 +386,16 @@ static int zstd_compress_pages(struct compress_ctx *cc) ...@@ -390,16 +386,16 @@ static int zstd_compress_pages(struct compress_ctx *cc)
ret = zstd_compress_stream(stream, &outbuf, &inbuf); ret = zstd_compress_stream(stream, &outbuf, &inbuf);
if (zstd_is_error(ret)) { if (zstd_is_error(ret)) {
printk_ratelimited("%sF2FS-fs (%s): %s zstd_compress_stream failed, ret: %d\n", f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, "%s zstd_compress_stream failed, ret: %d",
__func__, zstd_get_error_code(ret)); __func__, zstd_get_error_code(ret));
return -EIO; return -EIO;
} }
ret = zstd_end_stream(stream, &outbuf); ret = zstd_end_stream(stream, &outbuf);
if (zstd_is_error(ret)) { if (zstd_is_error(ret)) {
printk_ratelimited("%sF2FS-fs (%s): %s zstd_end_stream returned %d\n", f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, "%s zstd_end_stream returned %d",
__func__, zstd_get_error_code(ret)); __func__, zstd_get_error_code(ret));
return -EIO; return -EIO;
} }
...@@ -432,9 +428,8 @@ static int zstd_init_decompress_ctx(struct decompress_io_ctx *dic) ...@@ -432,9 +428,8 @@ static int zstd_init_decompress_ctx(struct decompress_io_ctx *dic)
stream = zstd_init_dstream(max_window_size, workspace, workspace_size); stream = zstd_init_dstream(max_window_size, workspace, workspace_size);
if (!stream) { if (!stream) {
printk_ratelimited("%sF2FS-fs (%s): %s zstd_init_dstream failed\n", f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, "%s zstd_init_dstream failed", __func__);
__func__);
kvfree(workspace); kvfree(workspace);
return -EIO; return -EIO;
} }
...@@ -469,16 +464,15 @@ static int zstd_decompress_pages(struct decompress_io_ctx *dic) ...@@ -469,16 +464,15 @@ static int zstd_decompress_pages(struct decompress_io_ctx *dic)
ret = zstd_decompress_stream(stream, &outbuf, &inbuf); ret = zstd_decompress_stream(stream, &outbuf, &inbuf);
if (zstd_is_error(ret)) { if (zstd_is_error(ret)) {
printk_ratelimited("%sF2FS-fs (%s): %s zstd_decompress_stream failed, ret: %d\n", f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, "%s zstd_decompress_stream failed, ret: %d",
__func__, zstd_get_error_code(ret)); __func__, zstd_get_error_code(ret));
return -EIO; return -EIO;
} }
if (dic->rlen != outbuf.pos) { if (dic->rlen != outbuf.pos) {
printk_ratelimited("%sF2FS-fs (%s): %s ZSTD invalid rlen:%zu, " f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
"expected:%lu\n", KERN_ERR, "%s ZSTD invalid rlen:%zu, expected:%lu",
F2FS_I_SB(dic->inode)->sb->s_id,
__func__, dic->rlen, __func__, dic->rlen,
PAGE_SIZE << dic->log_cluster_size); PAGE_SIZE << dic->log_cluster_size);
return -EIO; return -EIO;
......
...@@ -1109,9 +1109,8 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi, ...@@ -1109,9 +1109,8 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi,
dc->error = 0; dc->error = 0;
if (dc->error) if (dc->error)
printk_ratelimited( f2fs_info_ratelimited(sbi,
"%sF2FS-fs (%s): Issue discard(%u, %u, %u) failed, ret: %d", "Issue discard(%u, %u, %u) failed, ret: %d",
KERN_INFO, sbi->sb->s_id,
dc->di.lstart, dc->di.start, dc->di.len, dc->error); dc->di.lstart, dc->di.start, dc->di.len, dc->error);
__detach_discard_cmd(dcc, dc); __detach_discard_cmd(dcc, dc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment