Skip to contentSkip to conversation

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

PATCH In review Satoru Takeuchi 2 participants 2 messages Mar 9, 2016 – Mar 11, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Btrfs: Show a warning message if one of objectid reaches its highest value

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.

---
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(+)
fs/btrfs/inode-map.c +3 -0
index e50316c..5d97ee7 100644
@@ -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;
 	}
Signature · 5 lines
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-
Reviewed-by on v3 1/1
#1 lore raw
Quoted 7 lines · Satoru Takeuchi

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.

I'll queue this one, with minor fixes

fs/btrfs/inode-map.c int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid) · line 560

Quoted 2 lines
fs/btrfs/inode-map.c +2 -0
+		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