diff options
| author | Darrick J. Wong <djwong@kernel.org> | 2024-11-20 16:20:26 -0800 |
|---|---|---|
| committer | Darrick J. Wong <djwong@kernel.org> | 2024-12-23 13:06:05 -0800 |
| commit | 219ee99d3673ded7abbc13ddd4d7847e92661e2c (patch) | |
| tree | fa66d582771540a316e9b5ee5536367ca5b8a6fb /fs/xfs/libxfs/xfs_metafile.c | |
| parent | 5e0679d1c62f25f97b4f93121efe236fc4e768d2 (diff) | |
xfs: pretty print metadata file types in error messages
Create a helper function to turn a metadata file type code into a
printable string, and use this to complain about lockdep problems with
rtgroup inodes. We'll use this more in the next patch.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_metafile.c')
| -rw-r--r-- | fs/xfs/libxfs/xfs_metafile.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_metafile.c b/fs/xfs/libxfs/xfs_metafile.c index e151663cc9ef..2f5f554a36d4 100644 --- a/fs/xfs/libxfs/xfs_metafile.c +++ b/fs/xfs/libxfs/xfs_metafile.c @@ -22,6 +22,24 @@ #include "xfs_error.h" #include "xfs_alloc.h" +static const struct { + enum xfs_metafile_type mtype; + const char *name; +} xfs_metafile_type_strs[] = { XFS_METAFILE_TYPE_STR }; + +const char * +xfs_metafile_type_str(enum xfs_metafile_type metatype) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(xfs_metafile_type_strs); i++) { + if (xfs_metafile_type_strs[i].mtype == metatype) + return xfs_metafile_type_strs[i].name; + } + + return NULL; +} + /* Set up an inode to be recognized as a metadata directory inode. */ void xfs_metafile_set_iflag( |
