drm/panel-edp: Add STA 116QHD024002
[drm/drm-misc.git] / fs / xfs / libxfs / xfs_metafile.c
blobadeb25d1a444cab246aee792a1cac1809407af52
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (c) 2018-2024 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
5 */
6 #include "xfs.h"
7 #include "xfs_fs.h"
8 #include "xfs_shared.h"
9 #include "xfs_format.h"
10 #include "xfs_log_format.h"
11 #include "xfs_trans_resv.h"
12 #include "xfs_bit.h"
13 #include "xfs_sb.h"
14 #include "xfs_mount.h"
15 #include "xfs_defer.h"
16 #include "xfs_trans.h"
17 #include "xfs_metafile.h"
18 #include "xfs_trace.h"
19 #include "xfs_inode.h"
21 /* Set up an inode to be recognized as a metadata directory inode. */
22 void
23 xfs_metafile_set_iflag(
24 struct xfs_trans *tp,
25 struct xfs_inode *ip,
26 enum xfs_metafile_type metafile_type)
28 VFS_I(ip)->i_mode &= ~0777;
29 VFS_I(ip)->i_uid = GLOBAL_ROOT_UID;
30 VFS_I(ip)->i_gid = GLOBAL_ROOT_GID;
31 if (S_ISDIR(VFS_I(ip)->i_mode))
32 ip->i_diflags |= XFS_METADIR_DIFLAGS;
33 else
34 ip->i_diflags |= XFS_METAFILE_DIFLAGS;
35 ip->i_diflags2 &= ~XFS_DIFLAG2_DAX;
36 ip->i_diflags2 |= XFS_DIFLAG2_METADATA;
37 ip->i_metatype = metafile_type;
38 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
41 /* Clear the metadata directory inode flag. */
42 void
43 xfs_metafile_clear_iflag(
44 struct xfs_trans *tp,
45 struct xfs_inode *ip)
47 ASSERT(xfs_is_metadir_inode(ip));
48 ASSERT(VFS_I(ip)->i_nlink == 0);
50 ip->i_diflags2 &= ~XFS_DIFLAG2_METADATA;
51 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);