Skip to content

Commit 7a36dde

Browse files
committed
btrfs: use printk_ratelimited instead of printk_ratelimit
As per printk_ratelimit comment, it should not be used. Signed-off-by: David Sterba <dsterba@suse.cz>
1 parent 182608c commit 7a36dde

2 files changed

Lines changed: 10 additions & 24 deletions

File tree

‎fs/btrfs/disk-io.c‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/crc32c.h>
3030
#include <linux/slab.h>
3131
#include <linux/migrate.h>
32+
#include <linux/ratelimit.h>
3233
#include <asm/unaligned.h>
3334
#include "compat.h"
3435
#include "ctree.h"
@@ -254,14 +255,12 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
254255
memcpy(&found, result, csum_size);
255256

256257
read_extent_buffer(buf, &val, 0, csum_size);
257-
if (printk_ratelimit()) {
258-
printk(KERN_INFO "btrfs: %s checksum verify "
258+
printk_ratelimited(KERN_INFO "btrfs: %s checksum verify "
259259
"failed on %llu wanted %X found %X "
260260
"level %d\n",
261261
root->fs_info->sb->s_id,
262262
(unsigned long long)buf->start, val, found,
263263
btrfs_header_level(buf));
264-
}
265264
if (result != (char *)&inline_result)
266265
kfree(result);
267266
return 1;
@@ -296,13 +295,11 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
296295
ret = 0;
297296
goto out;
298297
}
299-
if (printk_ratelimit()) {
300-
printk("parent transid verify failed on %llu wanted %llu "
298+
printk_ratelimited("parent transid verify failed on %llu wanted %llu "
301299
"found %llu\n",
302300
(unsigned long long)eb->start,
303301
(unsigned long long)parent_transid,
304302
(unsigned long long)btrfs_header_generation(eb));
305-
}
306303
ret = 1;
307304
clear_extent_buffer_uptodate(io_tree, eb, &cached_state);
308305
out:
@@ -533,12 +530,10 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
533530

534531
found_start = btrfs_header_bytenr(eb);
535532
if (found_start != start) {
536-
if (printk_ratelimit()) {
537-
printk(KERN_INFO "btrfs bad tree block start "
533+
printk_ratelimited(KERN_INFO "btrfs bad tree block start "
538534
"%llu %llu\n",
539535
(unsigned long long)found_start,
540536
(unsigned long long)eb->start);
541-
}
542537
ret = -EIO;
543538
goto err;
544539
}
@@ -550,10 +545,8 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
550545
goto err;
551546
}
552547
if (check_tree_block_fsid(root, eb)) {
553-
if (printk_ratelimit()) {
554-
printk(KERN_INFO "btrfs bad fsid on block %llu\n",
548+
printk_ratelimited(KERN_INFO "btrfs bad fsid on block %llu\n",
555549
(unsigned long long)eb->start);
556-
}
557550
ret = -EIO;
558551
goto err;
559552
}
@@ -2108,11 +2101,9 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
21082101
if (uptodate) {
21092102
set_buffer_uptodate(bh);
21102103
} else {
2111-
if (printk_ratelimit()) {
2112-
printk(KERN_WARNING "lost page write due to "
2104+
printk_ratelimited(KERN_WARNING "lost page write due to "
21132105
"I/O error on %s\n",
21142106
bdevname(bh->b_bdev, b));
2115-
}
21162107
/* note, we dont' set_buffer_write_io_error because we have
21172108
* our own ways of dealing with the IO errors
21182109
*/

‎fs/btrfs/inode.c‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/posix_acl.h>
3838
#include <linux/falloc.h>
3939
#include <linux/slab.h>
40+
#include <linux/ratelimit.h>
4041
#include "compat.h"
4142
#include "ctree.h"
4243
#include "disk-io.h"
@@ -2004,12 +2005,10 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
20042005
return 0;
20052006

20062007
zeroit:
2007-
if (printk_ratelimit()) {
2008-
printk(KERN_INFO "btrfs csum failed ino %lu off %llu csum %u "
2008+
printk_ratelimited(KERN_INFO "btrfs csum failed ino %lu off %llu csum %u "
20092009
"private %llu\n", page->mapping->host->i_ino,
20102010
(unsigned long long)start, csum,
20112011
(unsigned long long)private);
2012-
}
20132012
memset(kaddr + offset, 1, end - start + 1);
20142013
flush_dcache_page(page);
20152014
kunmap_atomic(kaddr, KM_USER0);
@@ -4243,22 +4242,18 @@ void btrfs_dirty_inode(struct inode *inode)
42434242
btrfs_end_transaction(trans, root);
42444243
trans = btrfs_start_transaction(root, 1);
42454244
if (IS_ERR(trans)) {
4246-
if (printk_ratelimit()) {
4247-
printk(KERN_ERR "btrfs: fail to "
4245+
printk_ratelimited(KERN_ERR "btrfs: fail to "
42484246
"dirty inode %lu error %ld\n",
42494247
inode->i_ino, PTR_ERR(trans));
4250-
}
42514248
return;
42524249
}
42534250
btrfs_set_trans_block_group(trans, inode);
42544251

42554252
ret = btrfs_update_inode(trans, root, inode);
42564253
if (ret) {
4257-
if (printk_ratelimit()) {
4258-
printk(KERN_ERR "btrfs: fail to "
4254+
printk_ratelimited(KERN_ERR "btrfs: fail to "
42594255
"dirty inode %lu error %d\n",
42604256
inode->i_ino, ret);
4261-
}
42624257
}
42634258
}
42644259
btrfs_end_transaction(trans, root);

0 commit comments

Comments
 (0)