diff options
Diffstat (limited to 'fs/xfs/xfs_inum.h')
-rw-r--r-- | fs/xfs/xfs_inum.h | 104 |
1 files changed, 13 insertions, 91 deletions
diff --git a/fs/xfs/xfs_inum.h b/fs/xfs/xfs_inum.h index a3af2d5a6eb7..8f70a12d56bc 100644 --- a/fs/xfs/xfs_inum.h +++ b/fs/xfs/xfs_inum.h | |||
@@ -58,109 +58,31 @@ typedef __uint32_t xfs_intino_t; | |||
58 | 58 | ||
59 | struct xfs_mount; | 59 | struct xfs_mount; |
60 | 60 | ||
61 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK) | 61 | #define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1) |
62 | __uint32_t xfs_ino_mask(int k); | 62 | #define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog |
63 | #define XFS_INO_MASK(k) xfs_ino_mask(k) | 63 | #define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog |
64 | #else | 64 | #define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log |
65 | #define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1)) | 65 | #define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log |
66 | #endif | 66 | #define XFS_INO_BITS(mp) \ |
67 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS) | 67 | XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp) |
68 | int xfs_ino_offset_bits(struct xfs_mount *mp); | 68 | #define XFS_INO_TO_AGNO(mp,i) \ |
69 | #define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp) | ||
70 | #else | ||
71 | #define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog) | ||
72 | #endif | ||
73 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS) | ||
74 | int xfs_ino_agbno_bits(struct xfs_mount *mp); | ||
75 | #define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp) | ||
76 | #else | ||
77 | #define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog) | ||
78 | #endif | ||
79 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS) | ||
80 | int xfs_ino_agino_bits(struct xfs_mount *mp); | ||
81 | #define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp) | ||
82 | #else | ||
83 | #define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log) | ||
84 | #endif | ||
85 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS) | ||
86 | int xfs_ino_agno_bits(struct xfs_mount *mp); | ||
87 | #define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp) | ||
88 | #else | ||
89 | #define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log) | ||
90 | #endif | ||
91 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS) | ||
92 | int xfs_ino_bits(struct xfs_mount *mp); | ||
93 | #define XFS_INO_BITS(mp) xfs_ino_bits(mp) | ||
94 | #else | ||
95 | #define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)) | ||
96 | #endif | ||
97 | |||
98 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO) | ||
99 | xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i); | ||
100 | #define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i) | ||
101 | #else | ||
102 | #define XFS_INO_TO_AGNO(mp,i) \ | ||
103 | ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) | 69 | ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) |
104 | #endif | 70 | #define XFS_INO_TO_AGINO(mp,i) \ |
105 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO) | ||
106 | xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i); | ||
107 | #define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i) | ||
108 | #else | ||
109 | #define XFS_INO_TO_AGINO(mp,i) \ | ||
110 | ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) | 71 | ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) |
111 | #endif | 72 | #define XFS_INO_TO_AGBNO(mp,i) \ |
112 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO) | ||
113 | xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i); | ||
114 | #define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i) | ||
115 | #else | ||
116 | #define XFS_INO_TO_AGBNO(mp,i) \ | ||
117 | (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ | 73 | (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ |
118 | XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp))) | 74 | XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp))) |
119 | #endif | 75 | #define XFS_INO_TO_OFFSET(mp,i) \ |
120 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET) | ||
121 | int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i); | ||
122 | #define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i) | ||
123 | #else | ||
124 | #define XFS_INO_TO_OFFSET(mp,i) \ | ||
125 | ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) | 76 | ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) |
126 | #endif | 77 | #define XFS_INO_TO_FSB(mp,i) \ |
127 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB) | ||
128 | xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i); | ||
129 | #define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i) | ||
130 | #else | ||
131 | #define XFS_INO_TO_FSB(mp,i) \ | ||
132 | XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) | 78 | XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) |
133 | #endif | ||
134 | |||
135 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO) | ||
136 | xfs_ino_t | ||
137 | xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i); | ||
138 | #define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i) | ||
139 | #else | ||
140 | #define XFS_AGINO_TO_INO(mp,a,i) \ | 79 | #define XFS_AGINO_TO_INO(mp,a,i) \ |
141 | (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) | 80 | (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) |
142 | #endif | ||
143 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO) | ||
144 | xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i); | ||
145 | #define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i) | ||
146 | #else | ||
147 | #define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) | 81 | #define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) |
148 | #endif | ||
149 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET) | ||
150 | int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i); | ||
151 | #define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i) | ||
152 | #else | ||
153 | #define XFS_AGINO_TO_OFFSET(mp,i) \ | 82 | #define XFS_AGINO_TO_OFFSET(mp,i) \ |
154 | ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) | 83 | ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) |
155 | #endif | ||
156 | |||
157 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO) | ||
158 | xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o); | ||
159 | #define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o) | ||
160 | #else | ||
161 | #define XFS_OFFBNO_TO_AGINO(mp,b,o) \ | 84 | #define XFS_OFFBNO_TO_AGINO(mp,b,o) \ |
162 | ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) | 85 | ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) |
163 | #endif | ||
164 | 86 | ||
165 | #if XFS_BIG_INUMS | 87 | #if XFS_BIG_INUMS |
166 | #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) | 88 | #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) |