Skip to contentSkip to conversation

Update errno messages

PATCH In review David Sterba 2 participants 5 messages Apr 28, 2020 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

cover Update errno messages

We have a errno -> string decoder that's used to print verbose messages, some of the codes that can be found in the wild have been missing in the table.

David Sterba (2):
btrfs: sort error decoder entries
btrfs: add more codes to decoder table

 fs/btrfs/super.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.0
author maintainer
#1 lore raw

PATCH 1/2 btrfs: sort error decoder entries

Add the raw errnos and sort them accordingly.

---
 fs/btrfs/super.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
fs/btrfs/super.c +9 -9
index 7932d8d07cff..9e5d723a0d99 100644
@@ -72,23 +72,23 @@ const char * __attribute_const__ btrfs_decode_error(int errno)
 	char *errstr = "unknown";
 
 	switch (errno) {
-	case -EIO:
+	case -ENOENT:		/* -2 */
+		errstr = "No such entry";
+		break;
+	case -EIO:		/* -5 */
 		errstr = "IO failure";
 		break;
-	case -ENOMEM:
+	case -ENOMEM:		/* -12*/
 		errstr = "Out of memory";
 		break;
-	case -EROFS:
-		errstr = "Readonly filesystem";
-		break;
-	case -EEXIST:
+	case -EEXIST:		/* -17 */
 		errstr = "Object already exists";
 		break;
-	case -ENOSPC:
+	case -ENOSPC:		/* -28 */
 		errstr = "No space left";
 		break;
-	case -ENOENT:
-		errstr = "No such entry";
+	case -EROFS:		/* -30 */
+		errstr = "Readonly filesystem";
 		break;
 	}
 
Signature · 1 line
2.25.0
author maintainer
#3 lore raw

PATCH 2/2 btrfs: add more codes to decoder table

In reply to David Sterba

I've grepped logs for 'errno=.*unknown' and found -95, -117 and -122, now added to the table. The wording is adjusted so it makes sense in context of filesystem.

---
 fs/btrfs/super.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/btrfs/super.c +9 -0
index 9e5d723a0d99..438ecba26557 100644
@@ -90,6 +90,15 @@ const char * __attribute_const__ btrfs_decode_error(int errno)
 	case -EROFS:		/* -30 */
 		errstr = "Readonly filesystem";
 		break;
+	case -EOPNOTSUPP:	/* -95 */
+		errstr = "Operation not supported";
+		break;
+	case -EUCLEAN:		/* -117 */
+		errstr = "Filesystem corrupted";
+		break;
+	case -EDQUOT:		/* -122 */
+		errstr = "Quota exceeded";
+		break;
 	}
 
 	return errstr;
Signature · 1 line
2.25.0