summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_imeta.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-14 11:15:06 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 19:07:47 -0800
commit78f18d84ea69d309646491dcf338edae163b5969 (patch)
treeb7fae588e4f7786f88f55038fa44524f44ff895c /fs/xfs/libxfs/xfs_imeta.h
parentf52035dafb3809439edaa2a0d4d5bdfe87869be3 (diff)
xfs: create imeta abstractions to get and set metadata inodes
Create some helper routines to get and set metadata inode numbers instead of open-coding them throughout xfs. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_imeta.h')
-rw-r--r--fs/xfs/libxfs/xfs_imeta.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_imeta.h b/fs/xfs/libxfs/xfs_imeta.h
new file mode 100644
index 000000000000..b535e19ff1a0
--- /dev/null
+++ b/fs/xfs/libxfs/xfs_imeta.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2022 Oracle. All Rights Reserved.
+ * Author: Darrick J. Wong <djwong@kernel.org>
+ */
+#ifndef __XFS_IMETA_H__
+#define __XFS_IMETA_H__
+
+/* Key for looking up metadata inodes. */
+struct xfs_imeta_path {
+ /* Temporary: integer to keep the static imeta definitions unique */
+ int bogus;
+};
+
+/* Cleanup widget for metadata inode creation and deletion. */
+struct xfs_imeta_update {
+ /* empty for now */
+};
+
+/* Lookup keys for static metadata inodes. */
+extern const struct xfs_imeta_path XFS_IMETA_RTBITMAP;
+extern const struct xfs_imeta_path XFS_IMETA_RTSUMMARY;
+extern const struct xfs_imeta_path XFS_IMETA_USRQUOTA;
+extern const struct xfs_imeta_path XFS_IMETA_GRPQUOTA;
+extern const struct xfs_imeta_path XFS_IMETA_PRJQUOTA;
+
+int xfs_imeta_lookup(struct xfs_mount *mp, const struct xfs_imeta_path *path,
+ xfs_ino_t *ino);
+
+/* Don't allocate quota for this file. */
+#define XFS_IMETA_CREATE_NOQUOTA (1 << 0)
+int xfs_imeta_create(struct xfs_trans **tpp, const struct xfs_imeta_path *path,
+ umode_t mode, unsigned int flags, struct xfs_inode **ipp,
+ struct xfs_imeta_update *upd);
+int xfs_imeta_unlink(struct xfs_trans **tpp, const struct xfs_imeta_path *path,
+ struct xfs_inode *ip, struct xfs_imeta_update *upd);
+int xfs_imeta_link(struct xfs_trans *tp, const struct xfs_imeta_path *path,
+ struct xfs_inode *ip, struct xfs_imeta_update *upd);
+void xfs_imeta_end_update(struct xfs_mount *mp, struct xfs_imeta_update *upd,
+ int error);
+int xfs_imeta_start_update(struct xfs_mount *mp,
+ const struct xfs_imeta_path *path,
+ struct xfs_imeta_update *upd);
+
+bool xfs_is_static_meta_ino(struct xfs_mount *mp, xfs_ino_t ino);
+int xfs_imeta_mount(struct xfs_mount *mp);
+
+#endif /* __XFS_IMETA_H__ */