Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) International Business Machines Corp., 2000-2003 |
| 3 | * |
| 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 |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 6 | * the Free Software Foundation; either version 2 of the License, or |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * (at your option) any later version. |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 15 | * along with this program; if not, write to the Free Software |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | #ifndef _H_JFS_FILSYS |
| 19 | #define _H_JFS_FILSYS |
| 20 | |
| 21 | /* |
| 22 | * jfs_filsys.h |
| 23 | * |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 24 | * file system (implementation-dependent) constants |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | * |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 26 | * refer to <limits.h> for system wide implementation-dependent constants |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | */ |
| 28 | |
| 29 | /* |
| 30 | * file system option (superblock flag) |
| 31 | */ |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 32 | |
| 33 | /* directory option */ |
| 34 | #define JFS_UNICODE 0x00000001 /* unicode name */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | /* mount time flags for error handling */ |
Dave Kleikamp | f720e3b | 2007-06-06 15:28:35 -0500 | [diff] [blame] | 37 | #define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */ |
| 38 | #define JFS_ERR_CONTINUE 0x00000004 /* continue */ |
| 39 | #define JFS_ERR_PANIC 0x00000008 /* panic */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 41 | /* Quota support */ |
Mark Bellon | 8fc2751 | 2005-09-06 15:16:54 -0700 | [diff] [blame] | 42 | #define JFS_USRQUOTA 0x00000010 |
| 43 | #define JFS_GRPQUOTA 0x00000020 |
| 44 | |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 45 | /* mount time flag to disable journaling to disk */ |
| 46 | #define JFS_NOINTEGRITY 0x00000040 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | /* commit option */ |
| 49 | #define JFS_COMMIT 0x00000f00 /* commit option mask */ |
| 50 | #define JFS_GROUPCOMMIT 0x00000100 /* group (of 1) commit */ |
| 51 | #define JFS_LAZYCOMMIT 0x00000200 /* lazy commit */ |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 52 | #define JFS_TMPFS 0x00000400 /* temporary file system - |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | * do not log/commit: |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 54 | * Never implemented |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | */ |
| 56 | |
| 57 | /* log logical volume option */ |
| 58 | #define JFS_INLINELOG 0x00000800 /* inline log within file system */ |
| 59 | #define JFS_INLINEMOVE 0x00001000 /* inline log being moved */ |
| 60 | |
| 61 | /* Secondary aggregate inode table */ |
| 62 | #define JFS_BAD_SAIT 0x00010000 /* current secondary ait is bad */ |
| 63 | |
| 64 | /* sparse regular file support */ |
| 65 | #define JFS_SPARSE 0x00020000 /* sparse regular file */ |
| 66 | |
| 67 | /* DASD Limits F226941 */ |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 68 | #define JFS_DASD_ENABLED 0x00040000 /* DASD limits enabled */ |
| 69 | #define JFS_DASD_PRIME 0x00080000 /* Prime DASD usage on boot */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
| 71 | /* big endian flag */ |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 72 | #define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
| 74 | /* Directory index */ |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 75 | #define JFS_DIR_INDEX 0x00200000 /* Persistent index for */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | |
Dave Kleikamp | 36b12fb | 2006-12-06 17:48:32 -0600 | [diff] [blame] | 77 | /* platform options */ |
| 78 | #define JFS_LINUX 0x10000000 /* Linux support */ |
| 79 | #define JFS_DFS 0x20000000 /* DCE DFS LFS support */ |
| 80 | /* Never implemented */ |
| 81 | |
| 82 | #define JFS_OS2 0x40000000 /* OS/2 support */ |
| 83 | /* case-insensitive name/directory support */ |
| 84 | |
| 85 | #define JFS_AIX 0x80000000 /* AIX support */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * buffer cache configuration |
| 89 | */ |
| 90 | /* page size */ |
| 91 | #ifdef PSIZE |
| 92 | #undef PSIZE |
| 93 | #endif |
| 94 | #define PSIZE 4096 /* page size (in byte) */ |
| 95 | #define L2PSIZE 12 /* log2(PSIZE) */ |
| 96 | #define POFFSET 4095 /* offset within page */ |
| 97 | |
| 98 | /* buffer page size */ |
| 99 | #define BPSIZE PSIZE |
| 100 | |
| 101 | /* |
| 102 | * fs fundamental size |
| 103 | * |
| 104 | * PSIZE >= file system block size >= PBSIZE >= DISIZE |
| 105 | */ |
| 106 | #define PBSIZE 512 /* physical block size (in byte) */ |
| 107 | #define L2PBSIZE 9 /* log2(PBSIZE) */ |
| 108 | |
| 109 | #define DISIZE 512 /* on-disk inode size (in byte) */ |
| 110 | #define L2DISIZE 9 /* log2(DISIZE) */ |
| 111 | |
| 112 | #define IDATASIZE 256 /* inode inline data size */ |
| 113 | #define IXATTRSIZE 128 /* inode inline extended attribute size */ |
| 114 | |
Dave Kleikamp | f720e3b | 2007-06-06 15:28:35 -0500 | [diff] [blame] | 115 | #define XTPAGE_SIZE 4096 |
| 116 | #define log2_PAGESIZE 12 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
Dave Kleikamp | f720e3b | 2007-06-06 15:28:35 -0500 | [diff] [blame] | 118 | #define IAG_SIZE 4096 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | #define IAG_EXTENT_SIZE 4096 |
| 120 | #define INOSPERIAG 4096 /* number of disk inodes per iag */ |
| 121 | #define L2INOSPERIAG 12 /* l2 number of disk inodes per iag */ |
| 122 | #define INOSPEREXT 32 /* number of disk inode per extent */ |
| 123 | #define L2INOSPEREXT 5 /* l2 number of disk inode per extent */ |
| 124 | #define IXSIZE (DISIZE * INOSPEREXT) /* inode extent size */ |
| 125 | #define INOSPERPAGE 8 /* number of disk inodes per 4K page */ |
| 126 | #define L2INOSPERPAGE 3 /* log2(INOSPERPAGE) */ |
| 127 | |
| 128 | #define IAGFREELIST_LWM 64 |
| 129 | |
| 130 | #define INODE_EXTENT_SIZE IXSIZE /* inode extent size */ |
| 131 | #define NUM_INODE_PER_EXTENT INOSPEREXT |
| 132 | #define NUM_INODE_PER_IAG INOSPERIAG |
| 133 | |
| 134 | #define MINBLOCKSIZE 512 |
| 135 | #define MAXBLOCKSIZE 4096 |
| 136 | #define MAXFILESIZE ((s64)1 << 52) |
| 137 | |
| 138 | #define JFS_LINK_MAX 0xffffffff |
| 139 | |
| 140 | /* Minimum number of bytes supported for a JFS partition */ |
| 141 | #define MINJFS (0x1000000) |
| 142 | #define MINJFSTEXT "16" |
| 143 | |
| 144 | /* |
| 145 | * file system block size -> physical block size |
| 146 | */ |
| 147 | #define LBOFFSET(x) ((x) & (PBSIZE - 1)) |
| 148 | #define LBNUMBER(x) ((x) >> L2PBSIZE) |
| 149 | #define LBLK2PBLK(sb,b) ((b) << (sb->s_blocksize_bits - L2PBSIZE)) |
| 150 | #define PBLK2LBLK(sb,b) ((b) >> (sb->s_blocksize_bits - L2PBSIZE)) |
| 151 | /* size in byte -> last page number */ |
| 152 | #define SIZE2PN(size) ( ((s64)((size) - 1)) >> (L2PSIZE) ) |
| 153 | /* size in byte -> last file system block number */ |
| 154 | #define SIZE2BN(size, l2bsize) ( ((s64)((size) - 1)) >> (l2bsize) ) |
| 155 | |
| 156 | /* |
| 157 | * fixed physical block address (physical block size = 512 byte) |
| 158 | * |
| 159 | * NOTE: since we can't guarantee a physical block size of 512 bytes the use of |
| 160 | * these macros should be removed and the byte offset macros used instead. |
| 161 | */ |
| 162 | #define SUPER1_B 64 /* primary superblock */ |
| 163 | #define AIMAP_B (SUPER1_B + 8) /* 1st extent of aggregate inode map */ |
| 164 | #define AITBL_B (AIMAP_B + 16) /* |
| 165 | * 1st extent of aggregate inode table |
| 166 | */ |
| 167 | #define SUPER2_B (AITBL_B + 32) /* 2ndary superblock pbn */ |
| 168 | #define BMAP_B (SUPER2_B + 8) /* block allocation map */ |
| 169 | |
| 170 | /* |
| 171 | * SIZE_OF_SUPER defines the total amount of space reserved on disk for the |
| 172 | * superblock. This is not the same as the superblock structure, since all of |
| 173 | * this space is not currently being used. |
| 174 | */ |
| 175 | #define SIZE_OF_SUPER PSIZE |
| 176 | |
| 177 | /* |
| 178 | * SIZE_OF_AG_TABLE defines the amount of space reserved to hold the AG table |
| 179 | */ |
| 180 | #define SIZE_OF_AG_TABLE PSIZE |
| 181 | |
| 182 | /* |
| 183 | * SIZE_OF_MAP_PAGE defines the amount of disk space reserved for each page of |
| 184 | * the inode allocation map (to hold iag) |
| 185 | */ |
| 186 | #define SIZE_OF_MAP_PAGE PSIZE |
| 187 | |
| 188 | /* |
| 189 | * fixed byte offset address |
| 190 | */ |
| 191 | #define SUPER1_OFF 0x8000 /* primary superblock */ |
| 192 | #define AIMAP_OFF (SUPER1_OFF + SIZE_OF_SUPER) |
| 193 | /* |
| 194 | * Control page of aggregate inode map |
| 195 | * followed by 1st extent of map |
| 196 | */ |
| 197 | #define AITBL_OFF (AIMAP_OFF + (SIZE_OF_MAP_PAGE << 1)) |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 198 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | * 1st extent of aggregate inode table |
| 200 | */ |
| 201 | #define SUPER2_OFF (AITBL_OFF + INODE_EXTENT_SIZE) |
| 202 | /* |
| 203 | * secondary superblock |
| 204 | */ |
| 205 | #define BMAP_OFF (SUPER2_OFF + SIZE_OF_SUPER) |
| 206 | /* |
| 207 | * block allocation map |
| 208 | */ |
| 209 | |
| 210 | /* |
| 211 | * The following macro is used to indicate the number of reserved disk blocks at |
| 212 | * the front of an aggregate, in terms of physical blocks. This value is |
| 213 | * currently defined to be 32K. This turns out to be the same as the primary |
| 214 | * superblock's address, since it directly follows the reserved blocks. |
| 215 | */ |
| 216 | #define AGGR_RSVD_BLOCKS SUPER1_B |
| 217 | |
| 218 | /* |
| 219 | * The following macro is used to indicate the number of reserved bytes at the |
| 220 | * front of an aggregate. This value is currently defined to be 32K. This |
| 221 | * turns out to be the same as the primary superblock's byte offset, since it |
| 222 | * directly follows the reserved blocks. |
| 223 | */ |
| 224 | #define AGGR_RSVD_BYTES SUPER1_OFF |
| 225 | |
| 226 | /* |
| 227 | * The following macro defines the byte offset for the first inode extent in |
| 228 | * the aggregate inode table. This allows us to find the self inode to find the |
| 229 | * rest of the table. Currently this value is 44K. |
| 230 | */ |
| 231 | #define AGGR_INODE_TABLE_START AITBL_OFF |
| 232 | |
| 233 | /* |
| 234 | * fixed reserved inode number |
| 235 | */ |
| 236 | /* aggregate inode */ |
| 237 | #define AGGR_RESERVED_I 0 /* aggregate inode (reserved) */ |
| 238 | #define AGGREGATE_I 1 /* aggregate inode map inode */ |
| 239 | #define BMAP_I 2 /* aggregate block allocation map inode */ |
| 240 | #define LOG_I 3 /* aggregate inline log inode */ |
| 241 | #define BADBLOCK_I 4 /* aggregate bad block inode */ |
| 242 | #define FILESYSTEM_I 16 /* 1st/only fileset inode in ait: |
| 243 | * fileset inode map inode |
| 244 | */ |
| 245 | |
| 246 | /* per fileset inode */ |
| 247 | #define FILESET_RSVD_I 0 /* fileset inode (reserved) */ |
| 248 | #define FILESET_EXT_I 1 /* fileset inode extension */ |
| 249 | #define ROOT_I 2 /* fileset root inode */ |
| 250 | #define ACL_I 3 /* fileset ACL inode */ |
| 251 | |
| 252 | #define FILESET_OBJECT_I 4 /* the first fileset inode available for a file |
| 253 | * or directory or link... |
| 254 | */ |
| 255 | #define FIRST_FILESET_INO 16 /* the first aggregate inode which describes |
| 256 | * an inode. (To fsck this is also the first |
| 257 | * inode in part 2 of the agg inode table.) |
| 258 | */ |
| 259 | |
| 260 | /* |
| 261 | * directory configuration |
| 262 | */ |
| 263 | #define JFS_NAME_MAX 255 |
| 264 | #define JFS_PATH_MAX BPSIZE |
| 265 | |
| 266 | |
| 267 | /* |
| 268 | * file system state (superblock state) |
| 269 | */ |
| 270 | #define FM_CLEAN 0x00000000 /* file system is unmounted and clean */ |
| 271 | #define FM_MOUNT 0x00000001 /* file system is mounted cleanly */ |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 272 | #define FM_DIRTY 0x00000002 /* file system was not unmounted and clean |
| 273 | * when mounted or |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | * commit failure occurred while being mounted: |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 275 | * fsck() must be run to repair |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | */ |
| 277 | #define FM_LOGREDO 0x00000004 /* log based recovery (logredo()) failed: |
Dave Kleikamp | 63f83c9 | 2006-10-02 09:55:27 -0500 | [diff] [blame] | 278 | * fsck() must be run to repair |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | */ |
| 280 | #define FM_EXTENDFS 0x00000008 /* file system extendfs() in progress */ |
| 281 | |
| 282 | #endif /* _H_JFS_FILSYS */ |