| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 |
/* |
| 3 |
* Copyright (c) 2018-2024 Oracle. All Rights Reserved. |
| 4 |
* Author: Darrick J. Wong <[email protected]> |
| 5 |
*/ |
| 6 |
#ifndef __XFS_METAFILE_H__ |
| 7 |
#define __XFS_METAFILE_H__ |
| 8 |
|
| 9 |
const char *xfs_metafile_type_str(enum xfs_metafile_type metatype); |
| 10 |
|
| 11 |
/* All metadata files must have these flags set. */ |
| 12 |
#define XFS_METAFILE_DIFLAGS (XFS_DIFLAG_IMMUTABLE | \ |
| 13 |
XFS_DIFLAG_SYNC | \ |
| 14 |
XFS_DIFLAG_NOATIME | \ |
| 15 |
XFS_DIFLAG_NODUMP | \ |
| 16 |
XFS_DIFLAG_NODEFRAG) |
| 17 |
|
| 18 |
/* All metadata directories must have these flags set. */ |
| 19 |
#define XFS_METADIR_DIFLAGS (XFS_METAFILE_DIFLAGS | \ |
| 20 |
XFS_DIFLAG_NOSYMLINKS) |
| 21 |
|
| 22 |
void xfs_metafile_set_iflag(struct xfs_trans *tp, struct xfs_inode *ip, |
| 23 |
enum xfs_metafile_type metafile_type); |
| 24 |
void xfs_metafile_clear_iflag(struct xfs_trans *tp, struct xfs_inode *ip); |
| 25 |
|
| 26 |
/* Space reservations for metadata inodes. */ |
| 27 |
struct xfs_alloc_arg; |
| 28 |
|
| 29 |
bool xfs_metafile_resv_critical(struct xfs_mount *mp); |
| 30 |
void xfs_metafile_resv_alloc_space(struct xfs_inode *ip, |
| 31 |
struct xfs_alloc_arg *args); |
| 32 |
void xfs_metafile_resv_free_space(struct xfs_inode *ip, struct xfs_trans *tp, |
| 33 |
xfs_filblks_t len); |
| 34 |
void xfs_metafile_resv_free(struct xfs_mount *mp); |
| 35 |
int xfs_metafile_resv_init(struct xfs_mount *mp); |
| 36 |
|
| 37 |
/* Code specific to kernel/userspace; must be provided externally. */ |
| 38 |
|
| 39 |
int xfs_trans_metafile_iget(struct xfs_trans *tp, xfs_ino_t ino, |
| 40 |
enum xfs_metafile_type metafile_type, struct xfs_inode **ipp); |
| 41 |
int xfs_metafile_iget(struct xfs_mount *mp, xfs_ino_t ino, |
| 42 |
enum xfs_metafile_type metafile_type, struct xfs_inode **ipp); |
| 43 |
|
| 44 |
#endif /* __XFS_METAFILE_H__ */ |