All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Btrfs: Show a warning message if one of objectid reaches its highest value
@ 2016-03-07  3:05 Satoru Takeuchi
  2016-03-07  3:25 ` Satoru Takeuchi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Satoru Takeuchi @ 2016-03-07  3:05 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

- 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. Show this message only once to avoid filling
  dmesg with it.
- EOVERFLOW is more proper return value for this case.
  ENOSPC is for "No space left on device" case and objectid isn't
  related to any device.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
This patch can be applied to 4.5-rc7
---
 fs/btrfs/inode-map.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index e50316c..f5e3228 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -556,7 +556,15 @@ 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)) {
-		ret = -ENOSPC;
+		static bool __warned = false;
+
+		if (unlikely(!__warned)) {
+			btrfs_warn(root->fs_info,
+				   "The objectid of root %llu reaches its highest value.\n",
+				   root->root_key.objectid);
+			__warned = true;
+		}
+		ret = -EOVERFLOW;
 		goto out;
 	}

-- 
2.5.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-09  5:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07  3:05 [PATCH v2] Btrfs: Show a warning message if one of objectid reaches its highest value Satoru Takeuchi
2016-03-07  3:25 ` Satoru Takeuchi
2016-03-08 19:24 ` Goffredo Baroncelli
2016-03-09  3:21   ` Satoru Takeuchi
2016-03-09  2:32 ` Naohiro Aota
2016-03-09  5:28   ` Satoru Takeuchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.