]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/xfs_mount.h
xfs: rmap btree add more reserved blocks
[thirdparty/xfsprogs-dev.git] / include / xfs_mount.h
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef __XFS_MOUNT_H__
20 #define __XFS_MOUNT_H__
21
22 struct xfs_inode;
23 struct xfs_buftarg;
24 struct xfs_dir_ops;
25 struct xfs_da_geometry;
26
27 /*
28 * Define a user-level mount structure with all we need
29 * in order to make use of the numerous XFS_* macros.
30 */
31 typedef struct xfs_mount {
32 xfs_sb_t m_sb; /* copy of fs superblock */
33 #define m_icount m_sb.sb_icount
34 #define m_ifree m_sb.sb_ifree
35 #define m_fdblocks m_sb.sb_fdblocks
36 char *m_fsname; /* filesystem name */
37 int m_bsize; /* fs logical block size */
38 xfs_agnumber_t m_agfrotor; /* last ag where space found */
39 xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */
40 xfs_agnumber_t m_maxagi; /* highest inode alloc group */
41 uint m_rsumlevels; /* rt summary levels */
42 uint m_rsumsize; /* size of rt summary, bytes */
43 struct xfs_inode *m_rbmip; /* pointer to bitmap inode */
44 struct xfs_inode *m_rsumip; /* pointer to summary inode */
45 struct xfs_buftarg *m_ddev_targp;
46 struct xfs_buftarg *m_logdev_targp;
47 struct xfs_buftarg *m_rtdev_targp;
48 #define m_dev m_ddev_targp
49 #define m_logdev m_logdev_targp
50 #define m_rtdev m_rtdev_targp
51 __uint8_t m_dircook_elog; /* log d-cookie entry bits */
52 __uint8_t m_blkbit_log; /* blocklog + NBBY */
53 __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
54 __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */
55 __uint8_t m_agno_log; /* log #ag's */
56 __uint8_t m_agino_log; /* #bits for agino in inum */
57 uint m_inode_cluster_size;/* min inode buf size */
58 uint m_blockmask; /* sb_blocksize-1 */
59 uint m_blockwsize; /* sb_blocksize in words */
60 uint m_blockwmask; /* blockwsize-1 */
61 uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
62 uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
63 uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
64 uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
65 uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
66 uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
67 uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
68 uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
69 uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
70 xfs_extlen_t m_ag_prealloc_blocks; /* reserved ag blocks */
71 struct radix_tree_root m_perag_tree;
72 uint m_flags; /* global mount flags */
73 uint m_qflags; /* quota status flags */
74 uint m_attroffset; /* inode attribute offset */
75 int m_ialloc_inos; /* inodes in inode allocation */
76 int m_ialloc_blks; /* blocks in inode allocation */
77 int m_ialloc_min_blks; /* min blocks in sparse inode
78 * allocation */
79 int m_litino; /* size of inode union area */
80 int m_inoalign_mask;/* mask sb_inoalignmt if used */
81 struct xfs_trans_resv m_resv; /* precomputed res values */
82 __uint64_t m_maxicount; /* maximum inode count */
83 int m_dalign; /* stripe unit */
84 int m_swidth; /* stripe width */
85 int m_sinoalign; /* stripe unit inode alignmnt */
86 const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */
87
88 struct xfs_da_geometry *m_dir_geo; /* directory block geometry */
89 struct xfs_da_geometry *m_attr_geo; /* attribute block geometry */
90 const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */
91 const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */
92 #define M_DIROPS(mp) ((mp)->m_dir_inode_ops)
93
94 /*
95 * anonymous struct to allow xfs_dquot_buf.c to compile.
96 * Pointer is always null in userspace, so code does not use it at all
97 */
98 struct {
99 int qi_dqperchunk;
100 } *m_quotainfo;
101
102 /*
103 * xlog is defined in libxlog and thus is not intialized by libxfs. This
104 * allows an application to initialize and store a reference to the log
105 * if warranted.
106 */
107 struct xlog *m_log;
108 } xfs_mount_t;
109
110 /*
111 * Per-ag incore structure, copies of information in agf and agi,
112 * to improve the performance of allocation group selection.
113 */
114 typedef struct xfs_perag {
115 struct xfs_mount *pag_mount; /* owner filesystem */
116 xfs_agnumber_t pag_agno; /* AG this structure belongs to */
117 atomic_t pag_ref; /* perag reference count */
118 char pagf_init; /* this agf's entry is initialized */
119 char pagi_init; /* this agi's entry is initialized */
120 char pagf_metadata; /* the agf is preferred to be metadata */
121 char pagi_inodeok; /* The agi is ok for inodes */
122 __uint8_t pagf_levels[XFS_BTNUM_AGF];
123 /* # of levels in bno & cnt btree */
124 __uint32_t pagf_flcount; /* count of blocks in freelist */
125 xfs_extlen_t pagf_freeblks; /* total free blocks */
126 xfs_extlen_t pagf_longest; /* longest free space */
127 __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
128 xfs_agino_t pagi_freecount; /* number of free inodes */
129 xfs_agino_t pagi_count; /* number of allocated inodes */
130
131 /*
132 * Inode allocation search lookup optimisation.
133 * If the pagino matches, the search for new inodes
134 * doesn't need to search the near ones again straight away
135 */
136 xfs_agino_t pagl_pagino;
137 xfs_agino_t pagl_leftrec;
138 xfs_agino_t pagl_rightrec;
139 int pagb_count; /* pagb slots in use */
140 } xfs_perag_t;
141
142 #define LIBXFS_MOUNT_DEBUGGER 0x0001
143 #define LIBXFS_MOUNT_32BITINODES 0x0002
144 #define LIBXFS_MOUNT_32BITINOOPT 0x0004
145 #define LIBXFS_MOUNT_COMPAT_ATTR 0x0008
146 #define LIBXFS_MOUNT_ATTR2 0x0010
147 #define LIBXFS_MOUNT_WANT_CORRUPTED 0x0020
148
149 #define LIBXFS_BHASHSIZE(sbp) (1<<10)
150
151 extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *,
152 dev_t, dev_t, dev_t, int);
153 extern void libxfs_umount (xfs_mount_t *);
154 extern void libxfs_rtmount_destroy (xfs_mount_t *);
155
156 #endif /* __XFS_MOUNT_H__ */