diff mbox

[v3] Btrfs: Show a warning message if one of objectid reaches its highest value

Message ID 56DFC051.1040409@jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Satoru Takeuchi March 9, 2016, 6:18 a.m. UTC
It's better to show a warning message for the exceptional case
that one of objectid (in most case, inode number) reaches its
highest value. For example, if inode cache is off and this event
happens, we can't create any file even if there are not so many files.
This message ease detecting such problem.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
This patch can be applied to 4.5-rc7

V3:
- Show this message every time when hitting this problem
  for simplicity (thanks to the comment from Goffredo).
- Reflect Naota's comment
  - Keep the error code as is.
V2:
 - Reflect Filipe's comment
   - Use btrfs_warn() instead of WARN_ONCE()
   - Print the id of the tree
---
 fs/btrfs/inode-map.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Sterba March 11, 2016, 4:05 p.m. UTC | #1
On Wed, Mar 09, 2016 at 03:18:57PM +0900, Satoru Takeuchi wrote:
> It's better to show a warning message for the exceptional case
> that one of objectid (in most case, inode number) reaches its
> highest value. For example, if inode cache is off and this event
> happens, we can't create any file even if there are not so many files.
> This message ease detecting such problem.
> 
> Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

Reviewed-by: David Sterba <dsterba@suse.com>

I'll queue this one, with minor fixes

> +		btrfs_warn(root->fs_info,
> +			   "The objectid of root %llu reaches its highest value.\n",

lower case 'The', no "." and no "\n" for the btrfs_* helpers
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index e50316c..5d97ee7 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -556,6 +556,9 @@  int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid)
 	mutex_lock(&root->objectid_mutex);

 	if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) {
+		btrfs_warn(root->fs_info,
+			   "The objectid of root %llu reaches its highest value.\n",
+			   root->root_key.objectid);
 		ret = -ENOSPC;
 		goto out;
 	}