btrfs: Print Warning only if ENOSPC_DEBUG is enabled
authorAshish Samant <ashish.samant@oracle.com>
Fri, 11 Mar 2016 22:54:05 +0000 (14:54 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2016 13:59:54 +0000 (14:59 +0100)
Dont print warning for ENOSPC error unless ENOSPC_DEBUG is enabled. Use
btrfs_debug if it is enabled.

Signed-off-by: Ashish Samant <ashish.samant@oracle.com>
[ preserve the WARN_ON ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-inode.c

index a20d541bb1904fa59cf622d4b75758c53f08a000..6cef0062f9292933435f8b6df6ff875e93a816aa 100644 (file)
@@ -650,9 +650,14 @@ static int btrfs_delayed_inode_reserve_metadata(
                        goto out;
 
                ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes);
-               if (!WARN_ON(ret))
+               if (!ret)
                        goto out;
 
+               if (btrfs_test_opt(root, ENOSPC_DEBUG)) {
+                       btrfs_debug(root->fs_info,
+                                   "block rsv migrate returned %d", ret);
+                       WARN_ON(1);
+               }
                /*
                 * Ok this is a problem, let's just steal from the global rsv
                 * since this really shouldn't happen that often.