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