1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 2 /* 3 * Copyright (C) International Business Mach 4 */ 5 #ifndef _H_JFS_IMAP 6 #define _H_JFS_IMAP 7 8 #include "jfs_txnmgr.h" 9 10 /* 11 * jfs_imap.h: disk inode manager 12 */ 13 14 #define EXTSPERIAG 128 /* number of d 15 #define IMAPBLKNO 0 /* lblkno of d 16 #define SMAPSZ 4 /* number of w 17 #define EXTSPERSUM 32 /* number of e 18 #define L2EXTSPERSUM 5 /* l2 number o 19 #define PGSPERIEXT 4 /* number of 4 20 #define MAXIAGS ((1<<20)-1) /* max 21 #define MAXAG 128 /* maximum num 22 23 #define AMAPSIZE 512 /* bytes in th 24 #define SMAPSIZE 16 /* bytes in th 25 26 /* convert inode number to iag number */ 27 #define INOTOIAG(ino) ((ino) >> L2INOSPERIAG 28 29 /* convert iag number to logical block number 30 #define IAGTOLBLK(iagno,l2nbperpg) (((iag 31 32 /* get the starting block number of the 4K pag 33 * that contains ino. 34 */ 35 #define INOPBLK(pxd,ino,l2nbperpg) (addre 36 ((((ino) & (INOSPEREXT-1)) >> L2INOSPE 37 38 /* 39 * inode allocation map: 40 * 41 * inode allocation map consists of 42 * . the inode map control page and 43 * . inode allocation group pages (per 4096 in 44 * which are addressed by standard JFS xtree. 45 */ 46 /* 47 * inode allocation group page (per 4096 48 */ 49 struct iag { 50 __le64 agstart; /* 8: starting 51 __le32 iagnum; /* 4: inode al 52 __le32 inofreefwd; /* 4: ag inode 53 __le32 inofreeback; /* 4: ag inode 54 __le32 extfreefwd; /* 4: ag inode 55 __le32 extfreeback; /* 4: ag inode 56 __le32 iagfree; /* 4: iag free 57 58 /* summary map: 1 bit per inode extent 59 __le32 inosmap[SMAPSZ]; /* 16: sum map 60 * note: 61 * inodes 62 * value 63 * backed 64 * value 65 * backed 66 * free t 67 */ 68 __le32 extsmap[SMAPSZ]; /* 16: sum map 69 __le32 nfreeinos; /* 4: number o 70 __le32 nfreeexts; /* 4: number o 71 /* (72) */ 72 u8 pad[1976]; /* 1976: pad t 73 /* allocation bit map: 1 bit per inode 74 __le32 wmap[EXTSPERIAG]; /* 512 75 __le32 pmap[EXTSPERIAG]; /* 512 76 pxd_t inoext[EXTSPERIAG]; /* 102 77 }; /* (4096) */ 78 79 /* 80 * per AG control information (in inode m 81 */ 82 struct iagctl_disk { 83 __le32 inofree; /* 4: free ino 84 __le32 extfree; /* 4: free ext 85 __le32 numinos; /* 4: number o 86 __le32 numfree; /* 4: number o 87 }; /* (16) */ 88 89 struct iagctl { 90 int inofree; /* free inode 91 int extfree; /* free extent 92 int numinos; /* number of b 93 int numfree; /* number of f 94 }; 95 96 /* 97 * per fileset/aggregate inode map contro 98 */ 99 struct dinomap_disk { 100 __le32 in_freeiag; /* 4: free iag 101 __le32 in_nextiag; /* 4: next fre 102 __le32 in_numinos; /* 4: num of b 103 __le32 in_numfree; /* 4: num of f 104 __le32 in_nbperiext; /* 4: num of b 105 __le32 in_l2nbperiext; /* 4: l2 of in 106 __le32 in_diskblock; /* 4: for stan 107 __le32 in_maxag; /* 4: for stan 108 u8 pad[2016]; /* 2016: pad t 109 struct iagctl_disk in_agctl[MAXAG]; /* 110 }; /* (4096) */ 111 112 struct dinomap { 113 int in_freeiag; /* free iag li 114 int in_nextiag; /* next free i 115 int in_numinos; /* num of back 116 int in_numfree; /* num of free 117 int in_nbperiext; /* num of bloc 118 int in_l2nbperiext; /* l2 of in_nb 119 int in_diskblock; /* for standal 120 int in_maxag; /* for standal 121 struct iagctl in_agctl[MAXAG]; /* AG 122 }; 123 124 /* 125 * In-core inode map control page 126 */ 127 struct inomap { 128 struct dinomap im_imap; /* 409 129 struct inode *im_ipimap; /* 4: 130 struct mutex im_freelock; /* 4: 131 struct mutex im_aglock[MAXAG]; /* 512 132 u32 *im_DBGdimap; 133 atomic_t im_numinos; /* num of back 134 atomic_t im_numfree; /* num of free 135 }; 136 137 #define im_freeiag im_imap.in_freeiag 138 #define im_nextiag im_imap.in_nextiag 139 #define im_agctl im_imap.in_agctl 140 #define im_nbperiext im_imap.in_nbperiext 141 #define im_l2nbperiext im_imap.in_l2nbperiext 142 143 /* for standalone testdriver 144 */ 145 #define im_diskblock im_imap.in_diskblock 146 #define im_maxag im_imap.in_maxag 147 148 extern int diFree(struct inode *); 149 extern int diAlloc(struct inode *, bool, struc 150 extern int diSync(struct inode *); 151 /* external references */ 152 extern int diUpdatePMap(struct inode *ipimap, 153 bool is_free, struct t 154 extern int diExtendFS(struct inode *ipimap, st 155 extern int diMount(struct inode *); 156 extern int diUnmount(struct inode *, int); 157 extern int diRead(struct inode *); 158 extern struct inode *diReadSpecial(struct supe 159 extern void diWriteSpecial(struct inode *, int 160 extern void diFreeSpecial(struct inode *); 161 extern int diWrite(tid_t tid, struct inode *); 162 #endif /* _H_JFS_IMAP 163
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.