Skip to content

Commit a781184

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: use f2fs_{err,info}_ratelimited() for cleanup
Commit b1c9d3f ("f2fs: support printk_ratelimited() in f2fs_printk()") missed some cases, cover all remains for cleanup. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent aa4074e commit a781184

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

fs/f2fs/compress.c

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ static int lzo_compress_pages(struct compress_ctx *cc)
198198
ret = lzo1x_1_compress(cc->rbuf, cc->rlen, cc->cbuf->cdata,
199199
&cc->clen, cc->private);
200200
if (ret != LZO_E_OK) {
201-
printk_ratelimited("%sF2FS-fs (%s): lzo compress failed, ret:%d\n",
202-
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, ret);
201+
f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
202+
"lzo compress failed, ret:%d", ret);
203203
return -EIO;
204204
}
205205
return 0;
@@ -212,17 +212,15 @@ static int lzo_decompress_pages(struct decompress_io_ctx *dic)
212212
ret = lzo1x_decompress_safe(dic->cbuf->cdata, dic->clen,
213213
dic->rbuf, &dic->rlen);
214214
if (ret != LZO_E_OK) {
215-
printk_ratelimited("%sF2FS-fs (%s): lzo decompress failed, ret:%d\n",
216-
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, ret);
215+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
216+
"lzo decompress failed, ret:%d", ret);
217217
return -EIO;
218218
}
219219

220220
if (dic->rlen != PAGE_SIZE << dic->log_cluster_size) {
221-
printk_ratelimited("%sF2FS-fs (%s): lzo invalid rlen:%zu, "
222-
"expected:%lu\n", KERN_ERR,
223-
F2FS_I_SB(dic->inode)->sb->s_id,
224-
dic->rlen,
225-
PAGE_SIZE << dic->log_cluster_size);
221+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
222+
"lzo invalid rlen:%zu, expected:%lu",
223+
dic->rlen, PAGE_SIZE << dic->log_cluster_size);
226224
return -EIO;
227225
}
228226
return 0;
@@ -294,16 +292,15 @@ static int lz4_decompress_pages(struct decompress_io_ctx *dic)
294292
ret = LZ4_decompress_safe(dic->cbuf->cdata, dic->rbuf,
295293
dic->clen, dic->rlen);
296294
if (ret < 0) {
297-
printk_ratelimited("%sF2FS-fs (%s): lz4 decompress failed, ret:%d\n",
298-
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id, ret);
295+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
296+
"lz4 decompress failed, ret:%d", ret);
299297
return -EIO;
300298
}
301299

302300
if (ret != PAGE_SIZE << dic->log_cluster_size) {
303-
printk_ratelimited("%sF2FS-fs (%s): lz4 invalid ret:%d, "
304-
"expected:%lu\n", KERN_ERR,
305-
F2FS_I_SB(dic->inode)->sb->s_id, ret,
306-
PAGE_SIZE << dic->log_cluster_size);
301+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
302+
"lz4 invalid ret:%d, expected:%lu",
303+
ret, PAGE_SIZE << dic->log_cluster_size);
307304
return -EIO;
308305
}
309306
return 0;
@@ -350,9 +347,8 @@ static int zstd_init_compress_ctx(struct compress_ctx *cc)
350347

351348
stream = zstd_init_cstream(&params, 0, workspace, workspace_size);
352349
if (!stream) {
353-
printk_ratelimited("%sF2FS-fs (%s): %s zstd_init_cstream failed\n",
354-
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id,
355-
__func__);
350+
f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
351+
"%s zstd_init_cstream failed", __func__);
356352
kvfree(workspace);
357353
return -EIO;
358354
}
@@ -390,16 +386,16 @@ static int zstd_compress_pages(struct compress_ctx *cc)
390386

391387
ret = zstd_compress_stream(stream, &outbuf, &inbuf);
392388
if (zstd_is_error(ret)) {
393-
printk_ratelimited("%sF2FS-fs (%s): %s zstd_compress_stream failed, ret: %d\n",
394-
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id,
389+
f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
390+
"%s zstd_compress_stream failed, ret: %d",
395391
__func__, zstd_get_error_code(ret));
396392
return -EIO;
397393
}
398394

399395
ret = zstd_end_stream(stream, &outbuf);
400396
if (zstd_is_error(ret)) {
401-
printk_ratelimited("%sF2FS-fs (%s): %s zstd_end_stream returned %d\n",
402-
KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id,
397+
f2fs_err_ratelimited(F2FS_I_SB(cc->inode),
398+
"%s zstd_end_stream returned %d",
403399
__func__, zstd_get_error_code(ret));
404400
return -EIO;
405401
}
@@ -432,9 +428,8 @@ static int zstd_init_decompress_ctx(struct decompress_io_ctx *dic)
432428

433429
stream = zstd_init_dstream(max_window_size, workspace, workspace_size);
434430
if (!stream) {
435-
printk_ratelimited("%sF2FS-fs (%s): %s zstd_init_dstream failed\n",
436-
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id,
437-
__func__);
431+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
432+
"%s zstd_init_dstream failed", __func__);
438433
kvfree(workspace);
439434
return -EIO;
440435
}
@@ -469,16 +464,15 @@ static int zstd_decompress_pages(struct decompress_io_ctx *dic)
469464

470465
ret = zstd_decompress_stream(stream, &outbuf, &inbuf);
471466
if (zstd_is_error(ret)) {
472-
printk_ratelimited("%sF2FS-fs (%s): %s zstd_decompress_stream failed, ret: %d\n",
473-
KERN_ERR, F2FS_I_SB(dic->inode)->sb->s_id,
467+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
468+
"%s zstd_decompress_stream failed, ret: %d",
474469
__func__, zstd_get_error_code(ret));
475470
return -EIO;
476471
}
477472

478473
if (dic->rlen != outbuf.pos) {
479-
printk_ratelimited("%sF2FS-fs (%s): %s ZSTD invalid rlen:%zu, "
480-
"expected:%lu\n", KERN_ERR,
481-
F2FS_I_SB(dic->inode)->sb->s_id,
474+
f2fs_err_ratelimited(F2FS_I_SB(dic->inode),
475+
"%s ZSTD invalid rlen:%zu, expected:%lu",
482476
__func__, dic->rlen,
483477
PAGE_SIZE << dic->log_cluster_size);
484478
return -EIO;

fs/f2fs/segment.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,9 +1109,8 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi,
11091109
dc->error = 0;
11101110

11111111
if (dc->error)
1112-
printk_ratelimited(
1113-
"%sF2FS-fs (%s): Issue discard(%u, %u, %u) failed, ret: %d",
1114-
KERN_INFO, sbi->sb->s_id,
1112+
f2fs_info_ratelimited(sbi,
1113+
"Issue discard(%u, %u, %u) failed, ret: %d",
11151114
dc->di.lstart, dc->di.start, dc->di.len, dc->error);
11161115
__detach_discard_cmd(dcc, dc);
11171116
}

0 commit comments

Comments
 (0)