/* If no states were printed, reset the buffer */ if (!states_printed)
curr = buf;
*curr++ = 0;
} #endif
/* * Generally the error codes correspond to their respective errors, but there * are a few special cases. * * EUCLEAN: Any sort of corruption that we encounter. The tree-checker for * instance will return EUCLEAN if any of the blocks are corrupted in * a way that is problematic. We want to reserve EUCLEAN for these * sort of corruptions. * * EROFS: If we check BTRFS_FS_STATE_ERROR and fail out with a return error, we * need to use EROFS for this case. We will have no idea of the * original failure, that will have been reported at the time we tripped * over the error. Each subsequent error that doesn't have any context * of the original error should use EROFS when handling BTRFS_FS_STATE_ERROR.
*/ constchar * __attribute_const__ btrfs_decode_error(int error)
{ char *errstr = "unknown";
switch (error) { case -ENOENT: /* -2 */
errstr = "No such entry"; break; case -EIO: /* -5 */
errstr = "IO failure"; break; case -ENOMEM: /* -12*/
errstr = "Out of memory"; break; case -EEXIST: /* -17 */
errstr = "Object already exists"; break; case -ENOSPC: /* -28 */
errstr = "No space left"; break; 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;
}
/* * Decodes expected errors from the caller and invokes the appropriate error * response.
*/
__cold void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, constchar *function, unsignedint line, int error, constchar *fmt, ...)
{ struct super_block *sb = fs_info->sb; #ifdef CONFIG_PRINTK char statestr[STATE_STRING_BUF_LEN]; constchar *errstr; #endif
/* * Today we only save the error info to memory. Long term we'll also * send it down to the disk.
*/
WRITE_ONCE(fs_info->fs_error, error);
/* Don't go through full error handling during mount. */ if (!(sb->s_flags & SB_BORN)) return;
if (sb_rdonly(sb)) return;
btrfs_discard_stop(fs_info);
/* Handle error by forcing the filesystem readonly. */
btrfs_set_sb_rdonly(sb);
btrfs_info(fs_info, "forced readonly"); /* * Note that a running device replace operation is not canceled here * although there is no way to update the progress. It would add the * risk of a deadlock, therefore the canceling is omitted. The only * penalty is that some I/O remains active until the procedure * completes. The next time when the filesystem is mounted writable * again, the device replace operation continues.
*/
}
/* * Use one ratelimit state per log level so that a flood of less important * messages doesn't cause more important ones to be dropped.
*/ staticstruct ratelimit_state printk_limits[] = {
RATELIMIT_STATE_INIT(printk_limits[0], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[1], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[2], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[3], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[4], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[5], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[6], DEFAULT_RATELIMIT_INTERVAL, 100),
RATELIMIT_STATE_INIT(printk_limits[7], DEFAULT_RATELIMIT_INTERVAL, 100),
};
/* Do not ratelimit if CONFIG_BTRFS_DEBUG is enabled. */ if (IS_ENABLED(CONFIG_BTRFS_DEBUG) || __ratelimit(ratelimit)) { if (fs_info) { char statestr[STATE_STRING_BUF_LEN];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.