2 * Copyright (C) International Business Machines Corp., 2000-2003
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * file system (implementation-dependent) constants
26 * refer to <limits.h> for system wide implementation-dependent constants
30 * file system option (superblock flag)
32 /* mount time flag to disable journaling to disk */
33 #define JFS_NOINTEGRITY 0x00000010
35 /* mount time flags for error handling */
36 #define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */
37 #define JFS_ERR_CONTINUE 0x00000004 /* continue */
38 #define JFS_ERR_PANIC 0x00000008 /* panic */
40 #define JFS_USRQUOTA 0x00000010
41 #define JFS_GRPQUOTA 0x00000020
43 /* platform option (conditional compilation) */
44 #define JFS_AIX 0x80000000 /* AIX support */
45 /* POSIX name/directory support */
47 #define JFS_OS2 0x40000000 /* OS/2 support */
48 /* case-insensitive name/directory support */
50 #define JFS_DFS 0x20000000 /* DCE DFS LFS support */
52 #define JFS_LINUX 0x10000000 /* Linux support */
53 /* case-sensitive name/directory support */
55 /* directory option */
56 #define JFS_UNICODE 0x00000001 /* unicode name */
59 #define JFS_COMMIT 0x00000f00 /* commit option mask */
60 #define JFS_GROUPCOMMIT 0x00000100 /* group (of 1) commit */
61 #define JFS_LAZYCOMMIT 0x00000200 /* lazy commit */
62 #define JFS_TMPFS 0x00000400 /* temporary file system -
66 /* log logical volume option */
67 #define JFS_INLINELOG 0x00000800 /* inline log within file system */
68 #define JFS_INLINEMOVE 0x00001000 /* inline log being moved */
70 /* Secondary aggregate inode table */
71 #define JFS_BAD_SAIT 0x00010000 /* current secondary ait is bad */
73 /* sparse regular file support */
74 #define JFS_SPARSE 0x00020000 /* sparse regular file */
76 /* DASD Limits F226941 */
77 #define JFS_DASD_ENABLED 0x00040000 /* DASD limits enabled */
78 #define JFS_DASD_PRIME 0x00080000 /* Prime DASD usage on boot */
81 #define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */
84 #define JFS_DIR_INDEX 0x00200000 /* Persistant index for */
85 /* directory entries */
87 #define JFS_TAGXID 0x00800000 /* xid tagging */
90 * buffer cache configuration
96 #define PSIZE 4096 /* page size (in byte) */
97 #define L2PSIZE 12 /* log2(PSIZE) */
98 #define POFFSET 4095 /* offset within page */
100 /* buffer page size */
104 * fs fundamental size
106 * PSIZE >= file system block size >= PBSIZE >= DISIZE
108 #define PBSIZE 512 /* physical block size (in byte) */
109 #define L2PBSIZE 9 /* log2(PBSIZE) */
111 #define DISIZE 512 /* on-disk inode size (in byte) */
112 #define L2DISIZE 9 /* log2(DISIZE) */
114 #define IDATASIZE 256 /* inode inline data size */
115 #define IXATTRSIZE 128 /* inode inline extended attribute size */
117 #define XTPAGE_SIZE 4096
118 #define log2_PAGESIZE 12
120 #define IAG_SIZE 4096
121 #define IAG_EXTENT_SIZE 4096
122 #define INOSPERIAG 4096 /* number of disk inodes per iag */
123 #define L2INOSPERIAG 12 /* l2 number of disk inodes per iag */
124 #define INOSPEREXT 32 /* number of disk inode per extent */
125 #define L2INOSPEREXT 5 /* l2 number of disk inode per extent */
126 #define IXSIZE (DISIZE * INOSPEREXT) /* inode extent size */
127 #define INOSPERPAGE 8 /* number of disk inodes per 4K page */
128 #define L2INOSPERPAGE 3 /* log2(INOSPERPAGE) */
130 #define IAGFREELIST_LWM 64
132 #define INODE_EXTENT_SIZE IXSIZE /* inode extent size */
133 #define NUM_INODE_PER_EXTENT INOSPEREXT
134 #define NUM_INODE_PER_IAG INOSPERIAG
136 #define MINBLOCKSIZE 512
137 #define MAXBLOCKSIZE 4096
138 #define MAXFILESIZE ((s64)1 << 52)
140 #define JFS_LINK_MAX 0xffffffff
142 /* Minimum number of bytes supported for a JFS partition */
143 #define MINJFS (0x1000000)
144 #define MINJFSTEXT "16"
147 * file system block size -> physical block size
149 #define LBOFFSET(x) ((x) & (PBSIZE - 1))
150 #define LBNUMBER(x) ((x) >> L2PBSIZE)
151 #define LBLK2PBLK(sb,b) ((b) << (sb->s_blocksize_bits - L2PBSIZE))
152 #define PBLK2LBLK(sb,b) ((b) >> (sb->s_blocksize_bits - L2PBSIZE))
153 /* size in byte -> last page number */
154 #define SIZE2PN(size) ( ((s64)((size) - 1)) >> (L2PSIZE) )
155 /* size in byte -> last file system block number */
156 #define SIZE2BN(size, l2bsize) ( ((s64)((size) - 1)) >> (l2bsize) )
159 * fixed physical block address (physical block size = 512 byte)
161 * NOTE: since we can't guarantee a physical block size of 512 bytes the use of
162 * these macros should be removed and the byte offset macros used instead.
164 #define SUPER1_B 64 /* primary superblock */
165 #define AIMAP_B (SUPER1_B + 8) /* 1st extent of aggregate inode map */
166 #define AITBL_B (AIMAP_B + 16) /*
167 * 1st extent of aggregate inode table
169 #define SUPER2_B (AITBL_B + 32) /* 2ndary superblock pbn */
170 #define BMAP_B (SUPER2_B + 8) /* block allocation map */
173 * SIZE_OF_SUPER defines the total amount of space reserved on disk for the
174 * superblock. This is not the same as the superblock structure, since all of
175 * this space is not currently being used.
177 #define SIZE_OF_SUPER PSIZE
180 * SIZE_OF_AG_TABLE defines the amount of space reserved to hold the AG table
182 #define SIZE_OF_AG_TABLE PSIZE
185 * SIZE_OF_MAP_PAGE defines the amount of disk space reserved for each page of
186 * the inode allocation map (to hold iag)
188 #define SIZE_OF_MAP_PAGE PSIZE
191 * fixed byte offset address
193 #define SUPER1_OFF 0x8000 /* primary superblock */
194 #define AIMAP_OFF (SUPER1_OFF + SIZE_OF_SUPER)
196 * Control page of aggregate inode map
197 * followed by 1st extent of map
199 #define AITBL_OFF (AIMAP_OFF + (SIZE_OF_MAP_PAGE << 1))
201 * 1st extent of aggregate inode table
203 #define SUPER2_OFF (AITBL_OFF + INODE_EXTENT_SIZE)
205 * secondary superblock
207 #define BMAP_OFF (SUPER2_OFF + SIZE_OF_SUPER)
209 * block allocation map
213 * The following macro is used to indicate the number of reserved disk blocks at
214 * the front of an aggregate, in terms of physical blocks. This value is
215 * currently defined to be 32K. This turns out to be the same as the primary
216 * superblock's address, since it directly follows the reserved blocks.
218 #define AGGR_RSVD_BLOCKS SUPER1_B
221 * The following macro is used to indicate the number of reserved bytes at the
222 * front of an aggregate. This value is currently defined to be 32K. This
223 * turns out to be the same as the primary superblock's byte offset, since it
224 * directly follows the reserved blocks.
226 #define AGGR_RSVD_BYTES SUPER1_OFF
229 * The following macro defines the byte offset for the first inode extent in
230 * the aggregate inode table. This allows us to find the self inode to find the
231 * rest of the table. Currently this value is 44K.
233 #define AGGR_INODE_TABLE_START AITBL_OFF
236 * fixed reserved inode number
238 /* aggregate inode */
239 #define AGGR_RESERVED_I 0 /* aggregate inode (reserved) */
240 #define AGGREGATE_I 1 /* aggregate inode map inode */
241 #define BMAP_I 2 /* aggregate block allocation map inode */
242 #define LOG_I 3 /* aggregate inline log inode */
243 #define BADBLOCK_I 4 /* aggregate bad block inode */
244 #define FILESYSTEM_I 16 /* 1st/only fileset inode in ait:
245 * fileset inode map inode
248 /* per fileset inode */
249 #define FILESET_RSVD_I 0 /* fileset inode (reserved) */
250 #define FILESET_EXT_I 1 /* fileset inode extension */
251 #define ROOT_I 2 /* fileset root inode */
252 #define ACL_I 3 /* fileset ACL inode */
254 #define FILESET_OBJECT_I 4 /* the first fileset inode available for a file
255 * or directory or link...
257 #define FIRST_FILESET_INO 16 /* the first aggregate inode which describes
258 * an inode. (To fsck this is also the first
259 * inode in part 2 of the agg inode table.)
263 * directory configuration
265 #define JFS_NAME_MAX 255
266 #define JFS_PATH_MAX BPSIZE
270 * file system state (superblock state)
272 #define FM_CLEAN 0x00000000 /* file system is unmounted and clean */
273 #define FM_MOUNT 0x00000001 /* file system is mounted cleanly */
274 #define FM_DIRTY 0x00000002 /* file system was not unmounted and clean
276 * commit failure occurred while being mounted:
277 * fsck() must be run to repair
279 #define FM_LOGREDO 0x00000004 /* log based recovery (logredo()) failed:
280 * fsck() must be run to repair
282 #define FM_EXTENDFS 0x00000008 /* file system extendfs() in progress */
284 #endif /* _H_JFS_FILSYS */