提交 dff51cd1 编写于 作者: D David Sterba

btrfs: ratelimit WARN_ON in use_block_rsv

The WARN_ON under some circumstances heavily polute log and slow down
the machine. This is just a safety, as the warning should be fixed by
another patch, nevertheless, it still pops up during testing.
Signed-off-by: NDavid Sterba <dsterba@suse.cz>
上级 a81d3b1b
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/ratelimit.h>
#include "compat.h" #include "compat.h"
#include "hash.h" #include "hash.h"
#include "ctree.h" #include "ctree.h"
...@@ -5783,7 +5784,13 @@ use_block_rsv(struct btrfs_trans_handle *trans, ...@@ -5783,7 +5784,13 @@ use_block_rsv(struct btrfs_trans_handle *trans,
if (!ret) if (!ret)
return block_rsv; return block_rsv;
if (ret) { if (ret) {
WARN_ON(1); static DEFINE_RATELIMIT_STATE(_rs,
DEFAULT_RATELIMIT_INTERVAL,
/*DEFAULT_RATELIMIT_BURST*/ 2);
if (__ratelimit(&_rs)) {
printk(KERN_DEBUG "btrfs: block rsv returned %d\n", ret);
WARN_ON(1);
}
ret = reserve_metadata_bytes(root, block_rsv, blocksize, 0); ret = reserve_metadata_bytes(root, block_rsv, blocksize, 0);
if (!ret) { if (!ret) {
return block_rsv; return block_rsv;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册