Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *   Copyright (C) International Business Machines Corp., 2000-2003
0004  */
0005 #ifndef _H_JFS_FILSYS
0006 #define _H_JFS_FILSYS
0007 
0008 /*
0009  *  jfs_filsys.h
0010  *
0011  * file system (implementation-dependent) constants
0012  *
0013  * refer to <limits.h> for system wide implementation-dependent constants
0014  */
0015 
0016 /*
0017  *   file system option (superblock flag)
0018  */
0019 
0020 /* directory option */
0021 #define JFS_UNICODE 0x00000001  /* unicode name */
0022 
0023 /* mount time flags for error handling */
0024 #define JFS_ERR_REMOUNT_RO 0x00000002   /* remount read-only */
0025 #define JFS_ERR_CONTINUE   0x00000004   /* continue */
0026 #define JFS_ERR_PANIC      0x00000008   /* panic */
0027 
0028 /* Quota support */
0029 #define JFS_USRQUOTA    0x00000010
0030 #define JFS_GRPQUOTA    0x00000020
0031 
0032 /* mount time flag to disable journaling to disk */
0033 #define JFS_NOINTEGRITY 0x00000040
0034 
0035 /* mount time flag to enable TRIM to ssd disks */
0036 #define JFS_DISCARD     0x00000080
0037 
0038 /* commit option */
0039 #define JFS_COMMIT  0x00000f00  /* commit option mask */
0040 #define JFS_GROUPCOMMIT 0x00000100  /* group (of 1) commit */
0041 #define JFS_LAZYCOMMIT  0x00000200  /* lazy commit */
0042 #define JFS_TMPFS   0x00000400  /* temporary file system -
0043                      * do not log/commit:
0044                      * Never implemented
0045                      */
0046 
0047 /* log logical volume option */
0048 #define JFS_INLINELOG   0x00000800  /* inline log within file system */
0049 #define JFS_INLINEMOVE  0x00001000  /* inline log being moved */
0050 
0051 /* Secondary aggregate inode table */
0052 #define JFS_BAD_SAIT    0x00010000  /* current secondary ait is bad */
0053 
0054 /* sparse regular file support */
0055 #define JFS_SPARSE  0x00020000  /* sparse regular file */
0056 
0057 /* DASD Limits      F226941 */
0058 #define JFS_DASD_ENABLED 0x00040000 /* DASD limits enabled */
0059 #define JFS_DASD_PRIME  0x00080000  /* Prime DASD usage on boot */
0060 
0061 /* big endian flag */
0062 #define JFS_SWAP_BYTES  0x00100000  /* running on big endian computer */
0063 
0064 /* Directory index */
0065 #define JFS_DIR_INDEX   0x00200000  /* Persistent index for */
0066 
0067 /* platform options */
0068 #define JFS_LINUX   0x10000000  /* Linux support */
0069 #define JFS_DFS     0x20000000  /* DCE DFS LFS support */
0070 /*  Never implemented */
0071 
0072 #define JFS_OS2     0x40000000  /* OS/2 support */
0073 /*  case-insensitive name/directory support */
0074 
0075 #define JFS_AIX     0x80000000  /* AIX support */
0076 
0077 /*
0078  *  buffer cache configuration
0079  */
0080 /* page size */
0081 #ifdef PSIZE
0082 #undef PSIZE
0083 #endif
0084 #define PSIZE       4096    /* page size (in byte) */
0085 #define L2PSIZE     12  /* log2(PSIZE) */
0086 #define POFFSET     4095    /* offset within page */
0087 
0088 /* buffer page size */
0089 #define BPSIZE  PSIZE
0090 
0091 /*
0092  *  fs fundamental size
0093  *
0094  * PSIZE >= file system block size >= PBSIZE >= DISIZE
0095  */
0096 #define PBSIZE      512 /* physical block size (in byte) */
0097 #define L2PBSIZE    9   /* log2(PBSIZE) */
0098 
0099 #define DISIZE      512 /* on-disk inode size (in byte) */
0100 #define L2DISIZE    9   /* log2(DISIZE) */
0101 
0102 #define IDATASIZE   256 /* inode inline data size */
0103 #define IXATTRSIZE  128 /* inode inline extended attribute size */
0104 
0105 #define XTPAGE_SIZE 4096
0106 #define log2_PAGESIZE   12
0107 
0108 #define IAG_SIZE    4096
0109 #define IAG_EXTENT_SIZE 4096
0110 #define INOSPERIAG  4096    /* number of disk inodes per iag */
0111 #define L2INOSPERIAG    12  /* l2 number of disk inodes per iag */
0112 #define INOSPEREXT  32  /* number of disk inode per extent */
0113 #define L2INOSPEREXT    5   /* l2 number of disk inode per extent */
0114 #define IXSIZE      (DISIZE * INOSPEREXT)   /* inode extent size */
0115 #define INOSPERPAGE 8   /* number of disk inodes per 4K page */
0116 #define L2INOSPERPAGE   3   /* log2(INOSPERPAGE) */
0117 
0118 #define IAGFREELIST_LWM 64
0119 
0120 #define INODE_EXTENT_SIZE   IXSIZE  /* inode extent size */
0121 #define NUM_INODE_PER_EXTENT    INOSPEREXT
0122 #define NUM_INODE_PER_IAG   INOSPERIAG
0123 
0124 #define MINBLOCKSIZE        512
0125 #define MAXBLOCKSIZE        4096
0126 #define MAXFILESIZE     ((s64)1 << 52)
0127 
0128 #define JFS_LINK_MAX        0xffffffff
0129 
0130 /* Minimum number of bytes supported for a JFS partition */
0131 #define MINJFS          (0x1000000)
0132 #define MINJFSTEXT      "16"
0133 
0134 /*
0135  * file system block size -> physical block size
0136  */
0137 #define LBOFFSET(x) ((x) & (PBSIZE - 1))
0138 #define LBNUMBER(x) ((x) >> L2PBSIZE)
0139 #define LBLK2PBLK(sb,b) ((b) << (sb->s_blocksize_bits - L2PBSIZE))
0140 #define PBLK2LBLK(sb,b) ((b) >> (sb->s_blocksize_bits - L2PBSIZE))
0141 /* size in byte -> last page number */
0142 #define SIZE2PN(size)   ( ((s64)((size) - 1)) >> (L2PSIZE) )
0143 /* size in byte -> last file system block number */
0144 #define SIZE2BN(size, l2bsize) ( ((s64)((size) - 1)) >> (l2bsize) )
0145 
0146 /*
0147  * fixed physical block address (physical block size = 512 byte)
0148  *
0149  * NOTE: since we can't guarantee a physical block size of 512 bytes the use of
0150  *   these macros should be removed and the byte offset macros used instead.
0151  */
0152 #define SUPER1_B    64  /* primary superblock */
0153 #define AIMAP_B     (SUPER1_B + 8)  /* 1st extent of aggregate inode map */
0154 #define AITBL_B     (AIMAP_B + 16)  /*
0155                      * 1st extent of aggregate inode table
0156                      */
0157 #define SUPER2_B    (AITBL_B + 32)  /* 2ndary superblock pbn */
0158 #define BMAP_B      (SUPER2_B + 8)  /* block allocation map */
0159 
0160 /*
0161  * SIZE_OF_SUPER defines the total amount of space reserved on disk for the
0162  * superblock.  This is not the same as the superblock structure, since all of
0163  * this space is not currently being used.
0164  */
0165 #define SIZE_OF_SUPER   PSIZE
0166 
0167 /*
0168  * SIZE_OF_AG_TABLE defines the amount of space reserved to hold the AG table
0169  */
0170 #define SIZE_OF_AG_TABLE    PSIZE
0171 
0172 /*
0173  * SIZE_OF_MAP_PAGE defines the amount of disk space reserved for each page of
0174  * the inode allocation map (to hold iag)
0175  */
0176 #define SIZE_OF_MAP_PAGE    PSIZE
0177 
0178 /*
0179  * fixed byte offset address
0180  */
0181 #define SUPER1_OFF  0x8000  /* primary superblock */
0182 #define AIMAP_OFF   (SUPER1_OFF + SIZE_OF_SUPER)
0183                     /*
0184                      * Control page of aggregate inode map
0185                      * followed by 1st extent of map
0186                      */
0187 #define AITBL_OFF   (AIMAP_OFF + (SIZE_OF_MAP_PAGE << 1))
0188                     /*
0189                      * 1st extent of aggregate inode table
0190                      */
0191 #define SUPER2_OFF  (AITBL_OFF + INODE_EXTENT_SIZE)
0192                     /*
0193                      * secondary superblock
0194                      */
0195 #define BMAP_OFF    (SUPER2_OFF + SIZE_OF_SUPER)
0196                     /*
0197                      * block allocation map
0198                      */
0199 
0200 /*
0201  * The following macro is used to indicate the number of reserved disk blocks at
0202  * the front of an aggregate, in terms of physical blocks.  This value is
0203  * currently defined to be 32K.  This turns out to be the same as the primary
0204  * superblock's address, since it directly follows the reserved blocks.
0205  */
0206 #define AGGR_RSVD_BLOCKS    SUPER1_B
0207 
0208 /*
0209  * The following macro is used to indicate the number of reserved bytes at the
0210  * front of an aggregate.  This value is currently defined to be 32K.  This
0211  * turns out to be the same as the primary superblock's byte offset, since it
0212  * directly follows the reserved blocks.
0213  */
0214 #define AGGR_RSVD_BYTES SUPER1_OFF
0215 
0216 /*
0217  * The following macro defines the byte offset for the first inode extent in
0218  * the aggregate inode table.  This allows us to find the self inode to find the
0219  * rest of the table.  Currently this value is 44K.
0220  */
0221 #define AGGR_INODE_TABLE_START  AITBL_OFF
0222 
0223 /*
0224  *  fixed reserved inode number
0225  */
0226 /* aggregate inode */
0227 #define AGGR_RESERVED_I 0   /* aggregate inode (reserved) */
0228 #define AGGREGATE_I 1   /* aggregate inode map inode */
0229 #define BMAP_I      2   /* aggregate block allocation map inode */
0230 #define LOG_I       3   /* aggregate inline log inode */
0231 #define BADBLOCK_I  4   /* aggregate bad block inode */
0232 #define FILESYSTEM_I    16  /* 1st/only fileset inode in ait:
0233                  * fileset inode map inode
0234                  */
0235 
0236 /* per fileset inode */
0237 #define FILESET_RSVD_I  0   /* fileset inode (reserved) */
0238 #define FILESET_EXT_I   1   /* fileset inode extension */
0239 #define ROOT_I      2   /* fileset root inode */
0240 #define ACL_I       3   /* fileset ACL inode */
0241 
0242 #define FILESET_OBJECT_I 4  /* the first fileset inode available for a file
0243                  * or directory or link...
0244                  */
0245 #define FIRST_FILESET_INO 16    /* the first aggregate inode which describes
0246                  * an inode.  (To fsck this is also the first
0247                  * inode in part 2 of the agg inode table.)
0248                  */
0249 
0250 /*
0251  *  directory configuration
0252  */
0253 #define JFS_NAME_MAX    255
0254 #define JFS_PATH_MAX    BPSIZE
0255 
0256 
0257 /*
0258  *  file system state (superblock state)
0259  */
0260 #define FM_CLEAN 0x00000000 /* file system is unmounted and clean */
0261 #define FM_MOUNT 0x00000001 /* file system is mounted cleanly */
0262 #define FM_DIRTY 0x00000002 /* file system was not unmounted and clean
0263                  * when mounted or
0264                  * commit failure occurred while being mounted:
0265                  * fsck() must be run to repair
0266                  */
0267 #define FM_LOGREDO 0x00000004   /* log based recovery (logredo()) failed:
0268                  * fsck() must be run to repair
0269                  */
0270 #define FM_EXTENDFS 0x00000008  /* file system extendfs() in progress */
0271 #define FM_STATE_MAX 0x0000000f /* max value of s_state */
0272 
0273 #endif              /* _H_JFS_FILSYS */