ext4: save the error code which triggered an ext4_error() in the superblock
[linux-block.git] / fs / ext4 / ext4.h
index f8578caba40d5b899e7950581eb41ced929f7834..b00d07bad45ba2e286a72a3055b2cb10e67ca775 100644 (file)
@@ -1343,7 +1343,8 @@ struct ext4_super_block {
        __u8    s_lastcheck_hi;
        __u8    s_first_error_time_hi;
        __u8    s_last_error_time_hi;
-       __u8    s_pad[2];
+       __u8    s_first_error_errcode;
+       __u8    s_last_error_errcode;
        __le16  s_encoding;             /* Filename charset encoding */
        __le16  s_encoding_flags;       /* Filename charset encoding flags */
        __le32  s_reserved[95];         /* Padding to the end of the block */
@@ -1574,6 +1575,32 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
                 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
 }
 
+/*
+ * Error number codes for s_{first,last}_error_errno
+ *
+ * Linux errno numbers are architecture specific, so we need to translate
+ * them into something which is architecture independent.   We don't define
+ * codes for all errno's; just the ones which are most likely to be the cause
+ * of an ext4_error() call.
+ */
+#define EXT4_ERR_UNKNOWN        1
+#define EXT4_ERR_EIO            2
+#define EXT4_ERR_ENOMEM                 3
+#define EXT4_ERR_EFSBADCRC      4
+#define EXT4_ERR_EFSCORRUPTED   5
+#define EXT4_ERR_ENOSPC                 6
+#define EXT4_ERR_ENOKEY                 7
+#define EXT4_ERR_EROFS          8
+#define EXT4_ERR_EFBIG          9
+#define EXT4_ERR_EEXIST                10
+#define EXT4_ERR_ERANGE                11
+#define EXT4_ERR_EOVERFLOW     12
+#define EXT4_ERR_EBUSY         13
+#define EXT4_ERR_ENOTDIR       14
+#define EXT4_ERR_ENOTEMPTY     15
+#define EXT4_ERR_ESHUTDOWN     16
+#define EXT4_ERR_EFAULT                17
+
 /*
  * Inode dynamic state flags
  */
@@ -2688,6 +2715,7 @@ extern const char *ext4_decode_error(struct super_block *sb, int errno,
 extern void ext4_mark_group_bitmap_corrupted(struct super_block *sb,
                                             ext4_group_t block_group,
                                             unsigned int flags);
+extern void ext4_set_errno(struct super_block *sb, int err);
 
 extern __printf(4, 5)
 void __ext4_error(struct super_block *, const char *, unsigned int,