Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 4d8e74ad4585672489da6145b3328d415f50db82 75 lines 1.8 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright (c) 2025 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <djwong@kernel.org> 5 */ 6#ifndef _LINUX_FSERROR_H__ 7#define _LINUX_FSERROR_H__ 8 9void fserror_mount(struct super_block *sb); 10void fserror_unmount(struct super_block *sb); 11 12enum fserror_type { 13 /* pagecache I/O failed */ 14 FSERR_BUFFERED_READ, 15 FSERR_BUFFERED_WRITE, 16 17 /* direct I/O failed */ 18 FSERR_DIRECTIO_READ, 19 FSERR_DIRECTIO_WRITE, 20 21 /* out of band media error reported */ 22 FSERR_DATA_LOST, 23 24 /* filesystem metadata */ 25 FSERR_METADATA, 26}; 27 28struct fserror_event { 29 struct work_struct work; 30 struct super_block *sb; 31 struct inode *inode; 32 loff_t pos; 33 u64 len; 34 enum fserror_type type; 35 36 /* negative error number */ 37 int error; 38}; 39 40void fserror_report(struct super_block *sb, struct inode *inode, 41 enum fserror_type type, loff_t pos, u64 len, int error, 42 gfp_t gfp); 43 44static inline void fserror_report_io(struct inode *inode, 45 enum fserror_type type, loff_t pos, 46 u64 len, int error, gfp_t gfp) 47{ 48 fserror_report(inode->i_sb, inode, type, pos, len, error, gfp); 49} 50 51static inline void fserror_report_data_lost(struct inode *inode, loff_t pos, 52 u64 len, gfp_t gfp) 53{ 54 fserror_report(inode->i_sb, inode, FSERR_DATA_LOST, pos, len, -EIO, 55 gfp); 56} 57 58static inline void fserror_report_file_metadata(struct inode *inode, int error, 59 gfp_t gfp) 60{ 61 fserror_report(inode->i_sb, inode, FSERR_METADATA, 0, 0, error, gfp); 62} 63 64static inline void fserror_report_metadata(struct super_block *sb, int error, 65 gfp_t gfp) 66{ 67 fserror_report(sb, NULL, FSERR_METADATA, 0, 0, error, gfp); 68} 69 70static inline void fserror_report_shutdown(struct super_block *sb, gfp_t gfp) 71{ 72 fserror_report(sb, NULL, FSERR_METADATA, 0, 0, -ESHUTDOWN, gfp); 73} 74 75#endif /* _LINUX_FSERROR_H__ */