Blame view
fs/xfs/xfs_dinode.h
8.17 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
7b7187698 [XFS] Update lice... |
2 3 |
* Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. * All Rights Reserved. |
1da177e4c Linux-2.6.12-rc2 |
4 |
* |
7b7187698 [XFS] Update lice... |
5 6 |
* This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as |
1da177e4c Linux-2.6.12-rc2 |
7 8 |
* published by the Free Software Foundation. * |
7b7187698 [XFS] Update lice... |
9 10 11 12 |
* This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. |
1da177e4c Linux-2.6.12-rc2 |
13 |
* |
7b7187698 [XFS] Update lice... |
14 15 16 |
* You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1da177e4c Linux-2.6.12-rc2 |
17 18 19 |
*/ #ifndef __XFS_DINODE_H__ #define __XFS_DINODE_H__ |
51ce16d51 [XFS] kill XFS_DI... |
20 21 |
#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ #define XFS_DINODE_GOOD_VERSION(v) (((v) == 1 || (v) == 2)) |
1da177e4c Linux-2.6.12-rc2 |
22 |
|
1da177e4c Linux-2.6.12-rc2 |
23 |
typedef struct xfs_timestamp { |
347d1c019 [XFS] dinode endi... |
24 25 |
__be32 t_sec; /* timestamp seconds */ __be32 t_nsec; /* timestamp nanoseconds */ |
1da177e4c Linux-2.6.12-rc2 |
26 27 28 |
} xfs_timestamp_t; /* |
81591fe2d [XFS] kill xfs_di... |
29 30 31 32 33 34 35 36 37 38 39 40 |
* On-disk inode structure. * * This is just the header or "dinode core", the inode is expanded to fill a * variable size the leftover area split into a data and an attribute fork. * The format of the data and attribute fork depends on the format of the * inode as indicated by di_format and di_aformat. To access the data and * attribute use the XFS_DFORK_PTR, XFS_DFORK_DPTR, and XFS_DFORK_PTR macros * below. * * There is a very similar struct icdinode in xfs_inode which matches the * layout of the first 96 bytes of this structure, but is kept in native * format instead of big endian. |
1da177e4c Linux-2.6.12-rc2 |
41 |
*/ |
81591fe2d [XFS] kill xfs_di... |
42 |
typedef struct xfs_dinode { |
347d1c019 [XFS] dinode endi... |
43 44 45 46 47 48 49 50 |
__be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */ __be16 di_mode; /* mode and type of file */ __u8 di_version; /* inode version */ __u8 di_format; /* format of di_c data */ __be16 di_onlink; /* old number of links to file */ __be32 di_uid; /* owner's user id */ __be32 di_gid; /* owner's group id */ __be32 di_nlink; /* number of links to file */ |
6743099ce xfs: Extend proje... |
51 52 53 |
__be16 di_projid_lo; /* lower part of owner's project id */ __be16 di_projid_hi; /* higher part owner's project id */ __u8 di_pad[6]; /* unused, zeroed space */ |
347d1c019 [XFS] dinode endi... |
54 |
__be16 di_flushiter; /* incremented on flush */ |
1da177e4c Linux-2.6.12-rc2 |
55 56 57 |
xfs_timestamp_t di_atime; /* time last accessed */ xfs_timestamp_t di_mtime; /* time last modified */ xfs_timestamp_t di_ctime; /* time created/inode modified */ |
347d1c019 [XFS] dinode endi... |
58 59 60 61 62 63 64 65 66 67 68 |
__be64 di_size; /* number of bytes in file */ __be64 di_nblocks; /* # of direct & btree blocks used */ __be32 di_extsize; /* basic/minimum extent size for file */ __be32 di_nextents; /* number of extents in data fork */ __be16 di_anextents; /* number of extents in attribute fork*/ __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */ __s8 di_aformat; /* format of attr fork's data */ __be32 di_dmevmask; /* DMIG event mask */ __be16 di_dmstate; /* DMIG state info */ __be16 di_flags; /* random flags, XFS_DIFLAG_... */ __be32 di_gen; /* generation number */ |
1da177e4c Linux-2.6.12-rc2 |
69 |
|
81591fe2d [XFS] kill xfs_di... |
70 71 72 |
/* di_next_unlinked is the only non-core field in the old dinode */ __be32 di_next_unlinked;/* agi unlinked list ptr */ } __attribute__((packed)) xfs_dinode_t; |
1da177e4c Linux-2.6.12-rc2 |
73 |
|
81591fe2d [XFS] kill xfs_di... |
74 |
#define DI_MAX_FLUSH 0xffff |
1da177e4c Linux-2.6.12-rc2 |
75 76 77 78 79 80 81 82 83 84 |
/* * The 32 bit link count in the inode theoretically maxes out at UINT_MAX. * Since the pathconf interface is signed, we use 2^31 - 1 instead. * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX. */ #define XFS_MAXLINK ((1U << 31) - 1U) #define XFS_MAXLINK_1 65535U /* |
1da177e4c Linux-2.6.12-rc2 |
85 86 |
* Values for di_format */ |
81591fe2d [XFS] kill xfs_di... |
87 88 89 90 91 92 |
typedef enum xfs_dinode_fmt { XFS_DINODE_FMT_DEV, /* xfs_dev_t */ XFS_DINODE_FMT_LOCAL, /* bulk data */ XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */ XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */ XFS_DINODE_FMT_UUID /* uuid_t */ |
1da177e4c Linux-2.6.12-rc2 |
93 94 95 96 97 98 99 100 101 102 103 104 105 |
} xfs_dinode_fmt_t; /* * Inode minimum and maximum sizes. */ #define XFS_DINODE_MIN_LOG 8 #define XFS_DINODE_MAX_LOG 11 #define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG) #define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG) /* * Inode size for given fs. */ |
6447c3620 xfs: remove m_litino |
106 107 |
#define XFS_LITINO(mp) \ ((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode))) |
1da177e4c Linux-2.6.12-rc2 |
108 |
#define XFS_BROOT_SIZE_ADJ \ |
7cc95a821 [XFS] Always use ... |
109 |
(XFS_BTREE_LBLOCK_LEN - sizeof(xfs_bmdr_block_t)) |
1da177e4c Linux-2.6.12-rc2 |
110 111 |
/* |
1da177e4c Linux-2.6.12-rc2 |
112 113 |
* Inode data & attribute fork sizes, per inode. */ |
81591fe2d [XFS] kill xfs_di... |
114 115 |
#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) |
1da177e4c Linux-2.6.12-rc2 |
116 |
|
a844f4510 [XFS] Remove xfs_... |
117 |
#define XFS_DFORK_DSIZE(dip,mp) \ |
45ba598e5 [XFS] Remove CFOR... |
118 119 120 |
(XFS_DFORK_Q(dip) ? \ XFS_DFORK_BOFF(dip) : \ XFS_LITINO(mp)) |
a844f4510 [XFS] Remove xfs_... |
121 |
#define XFS_DFORK_ASIZE(dip,mp) \ |
45ba598e5 [XFS] Remove CFOR... |
122 123 124 125 |
(XFS_DFORK_Q(dip) ? \ XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \ 0) #define XFS_DFORK_SIZE(dip,mp,w) \ |
1da177e4c Linux-2.6.12-rc2 |
126 |
((w) == XFS_DATA_FORK ? \ |
45ba598e5 [XFS] Remove CFOR... |
127 128 |
XFS_DFORK_DSIZE(dip, mp) : \ XFS_DFORK_ASIZE(dip, mp)) |
1da177e4c Linux-2.6.12-rc2 |
129 |
|
81591fe2d [XFS] kill xfs_di... |
130 131 132 133 134 |
/* * Return pointers to the data or attribute forks. */ #define XFS_DFORK_DPTR(dip) \ ((char *)(dip) + sizeof(struct xfs_dinode)) |
45ba598e5 [XFS] Remove CFOR... |
135 |
#define XFS_DFORK_APTR(dip) \ |
81591fe2d [XFS] kill xfs_di... |
136 |
(XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip)) |
45ba598e5 [XFS] Remove CFOR... |
137 138 |
#define XFS_DFORK_PTR(dip,w) \ ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) |
81591fe2d [XFS] kill xfs_di... |
139 |
|
45ba598e5 [XFS] Remove CFOR... |
140 |
#define XFS_DFORK_FORMAT(dip,w) \ |
1da177e4c Linux-2.6.12-rc2 |
141 |
((w) == XFS_DATA_FORK ? \ |
81591fe2d [XFS] kill xfs_di... |
142 143 |
(dip)->di_format : \ (dip)->di_aformat) |
45ba598e5 [XFS] Remove CFOR... |
144 |
#define XFS_DFORK_NEXTENTS(dip,w) \ |
1da177e4c Linux-2.6.12-rc2 |
145 |
((w) == XFS_DATA_FORK ? \ |
81591fe2d [XFS] kill xfs_di... |
146 147 |
be32_to_cpu((dip)->di_nextents) : \ be16_to_cpu((dip)->di_anextents)) |
1da177e4c Linux-2.6.12-rc2 |
148 |
|
629260444 xfs: Remove the m... |
149 |
#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr)) |
1da177e4c Linux-2.6.12-rc2 |
150 151 |
/* |
81591fe2d [XFS] kill xfs_di... |
152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
* For block and character special files the 32bit dev_t is stored at the * beginning of the data fork. */ static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip) { return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip)); } static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) { *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev); } /* |
1da177e4c Linux-2.6.12-rc2 |
166 167 168 169 170 171 172 173 174 175 176 177 178 |
* Values for di_flags * There should be a one-to-one correspondence between these flags and the * XFS_XFLAG_s. */ #define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */ #define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ #define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */ #define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */ #define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */ #define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */ #define XFS_DIFLAG_NOATIME_BIT 6 /* do not update atime */ #define XFS_DIFLAG_NODUMP_BIT 7 /* do not dump */ #define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */ |
dd9f438e3 [XFS] Implement t... |
179 180 181 182 |
#define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */ #define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */ #define XFS_DIFLAG_EXTSIZE_BIT 11 /* inode extent size allocator hint */ #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */ |
d3446eac3 [XFS] Add degfram... |
183 |
#define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */ |
2a82b8be8 [XFS] Concurrent ... |
184 |
#define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */ |
1da177e4c Linux-2.6.12-rc2 |
185 186 187 188 189 190 191 192 193 194 195 |
#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT) #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT) #define XFS_DIFLAG_IMMUTABLE (1 << XFS_DIFLAG_IMMUTABLE_BIT) #define XFS_DIFLAG_APPEND (1 << XFS_DIFLAG_APPEND_BIT) #define XFS_DIFLAG_SYNC (1 << XFS_DIFLAG_SYNC_BIT) #define XFS_DIFLAG_NOATIME (1 << XFS_DIFLAG_NOATIME_BIT) #define XFS_DIFLAG_NODUMP (1 << XFS_DIFLAG_NODUMP_BIT) #define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT) #define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT) #define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT) |
dd9f438e3 [XFS] Implement t... |
196 197 |
#define XFS_DIFLAG_EXTSIZE (1 << XFS_DIFLAG_EXTSIZE_BIT) #define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT) |
d3446eac3 [XFS] Add degfram... |
198 |
#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT) |
2a82b8be8 [XFS] Concurrent ... |
199 |
#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT) |
1da177e4c Linux-2.6.12-rc2 |
200 |
|
71ddabb94 [XFS] optimize XF... |
201 202 203 204 205 |
#ifdef CONFIG_XFS_RT #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) #else #define XFS_IS_REALTIME_INODE(ip) (0) #endif |
1da177e4c Linux-2.6.12-rc2 |
206 207 208 209 |
#define XFS_DIFLAG_ANY \ (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \ XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \ XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \ |
dd9f438e3 [XFS] Implement t... |
210 |
XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \ |
2a82b8be8 [XFS] Concurrent ... |
211 |
XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM) |
1da177e4c Linux-2.6.12-rc2 |
212 213 |
#endif /* __XFS_DINODE_H__ */ |