Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
jfs_dmap.h File Reference
#include "jfs_txnmgr.h"

Go to the source code of this file.

Data Structures

struct  dmaptree
 
struct  dmap
 
struct  dmapctl
 
union  dmtree
 
struct  dbmap_disk
 
struct  dbmap
 
struct  bmap
 

Macros

#define BMAPVERSION   1 /* version number */
 
#define TREESIZE   (256+64+16+4+1) /* size of a dmap tree */
 
#define LEAFIND   (64+16+4+1) /* index of 1st leaf of a dmap tree */
 
#define LPERDMAP   256 /* num leaves per dmap tree */
 
#define L2LPERDMAP   8 /* l2 number of leaves per dmap tree */
 
#define DBWORD   32 /* # of blks covered by a map word */
 
#define L2DBWORD   5 /* l2 # of blks covered by a mword */
 
#define BUDMIN   L2DBWORD /* max free string in a map word */
 
#define BPERDMAP   (LPERDMAP * DBWORD) /* num of blks per dmap */
 
#define L2BPERDMAP   13 /* l2 num of blks per dmap */
 
#define CTLTREESIZE   (1024+256+64+16+4+1) /* size of a dmapctl tree */
 
#define CTLLEAFIND   (256+64+16+4+1) /* idx of 1st leaf of a dmapctl tree */
 
#define LPERCTL   1024 /* num of leaves per dmapctl tree */
 
#define L2LPERCTL   10 /* l2 num of leaves per dmapctl tree */
 
#define ROOT   0 /* index of the root of a tree */
 
#define NOFREE   ((s8) -1) /* no blocks free */
 
#define MAXAG   128 /* max number of allocation groups */
 
#define L2MAXAG   7 /* l2 max num of AG */
 
#define L2MINAGSZ   25 /* l2 of minimum AG size in bytes */
 
#define BMAPBLKNO   0 /* lblkno of bmap within the map */
 
#define L2MAXL0SIZE   (L2BPERDMAP + 1 * L2LPERCTL)
 
#define L2MAXL1SIZE   (L2BPERDMAP + 2 * L2LPERCTL)
 
#define L2MAXL2SIZE   (L2BPERDMAP + 3 * L2LPERCTL)
 
#define MAXL0SIZE   ((s64)1 << L2MAXL0SIZE)
 
#define MAXL1SIZE   ((s64)1 << L2MAXL1SIZE)
 
#define MAXL2SIZE   ((s64)1 << L2MAXL2SIZE)
 
#define MAXMAPSIZE   MAXL2SIZE /* maximum aggregate map size */
 
#define BLKTODMAP(b, s)   ((((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) << (s))
 
#define BLKTOL0(b, s)   (((((b) >> 23) << 10) + ((b) >> 23) + ((b) >> 33) + 2 + 1) << (s))
 
#define BLKTOL1(b, s)   (((((b) >> 33) << 20) + (((b) >> 33) << 10) + ((b) >> 33) + 1 + 1) << (s))
 
#define BLKTOCTL(b, s, l)   (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s)))
 
#define BMAPSZTOLEV(size)   (((size) <= MAXL0SIZE) ? 0 : ((size) <= MAXL1SIZE) ? 1 : 2)
 
#define BLKTOAG(b, sbi)   ((b) >> ((sbi)->bmap->db_agl2size))
 
#define AGTOBLK(a, ip)   ((s64)(a) << (JFS_SBI((ip)->i_sb)->bmap->db_agl2size))
 
#define dmt_nleafs   t1.nleafs
 
#define dmt_l2nleafs   t1.l2nleafs
 
#define dmt_leafidx   t1.leafidx
 
#define dmt_height   t1.height
 
#define dmt_budmin   t1.budmin
 
#define dmt_stree   t1.stree
 
#define db_mapsize   db_bmap.dn_mapsize
 
#define db_nfree   db_bmap.dn_nfree
 
#define db_agfree   db_bmap.dn_agfree
 
#define db_agsize   db_bmap.dn_agsize
 
#define db_agl2size   db_bmap.dn_agl2size
 
#define db_agwidth   db_bmap.dn_agwidth
 
#define db_agheight   db_bmap.dn_agheight
 
#define db_agstart   db_bmap.dn_agstart
 
#define db_numag   db_bmap.dn_numag
 
#define db_maxlevel   db_bmap.dn_maxlevel
 
#define db_aglevel   db_bmap.dn_aglevel
 
#define db_agpref   db_bmap.dn_agpref
 
#define db_maxag   db_bmap.dn_maxag
 
#define db_maxfreebud   db_bmap.dn_maxfreebud
 
#define db_l2nbperpage   db_bmap.dn_l2nbperpage
 
#define BLKSTOL2(d)   (blkstol2(d))
 
#define NLSTOL2BSZ(n)   (31 - cntlz((n)) + BUDMIN)
 
#define LITOL2BSZ(n, m, b)   ((((n) == 0) ? (m) : cnttz((n))) + (b))
 
#define BLKTOCTLLEAF(b, m)   (((b) & (((s64)1 << ((m) + L2LPERCTL)) - 1)) >> (m))
 
#define BUDSIZE(s, m)   (1 << ((s) - (m)))
 

Typedefs

typedef union dmtree dmtree_t
 

Functions

int dbMount (struct inode *ipbmap)
 
int dbUnmount (struct inode *ipbmap, int mounterror)
 
int dbFree (struct inode *ipbmap, s64 blkno, s64 nblocks)
 
int dbUpdatePMap (struct inode *ipbmap, int free, s64 blkno, s64 nblocks, struct tblock *tblk)
 
int dbNextAG (struct inode *ipbmap)
 
int dbAlloc (struct inode *ipbmap, s64 hint, s64 nblocks, s64 *results)
 
int dbReAlloc (struct inode *ipbmap, s64 blkno, s64 nblocks, s64 addnblocks, s64 *results)
 
int dbSync (struct inode *ipbmap)
 
int dbAllocBottomUp (struct inode *ip, s64 blkno, s64 nblocks)
 
int dbExtendFS (struct inode *ipbmap, s64 blkno, s64 nblocks)
 
void dbFinalizeBmap (struct inode *ipbmap)
 
s64 dbMapFileSizeToMapSize (struct inode *ipbmap)
 
s64 dbDiscardAG (struct inode *ip, int agno, s64 minlen)
 

Macro Definition Documentation

#define AGTOBLK (   a,
  ip 
)    ((s64)(a) << (JFS_SBI((ip)->i_sb)->bmap->db_agl2size))

Definition at line 139 of file jfs_dmap.h.

#define BLKSTOL2 (   d)    (blkstol2(d))

Definition at line 275 of file jfs_dmap.h.

#define BLKTOAG (   b,
  sbi 
)    ((b) >> ((sbi)->bmap->db_agl2size))

Definition at line 134 of file jfs_dmap.h.

#define BLKTOCTL (   b,
  s,
  l 
)    (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s)))

Definition at line 122 of file jfs_dmap.h.

#define BLKTOCTLLEAF (   b,
  m 
)    (((b) & (((s64)1 << ((m) + L2LPERCTL)) - 1)) >> (m))

Definition at line 284 of file jfs_dmap.h.

#define BLKTODMAP (   b,
  s 
)    ((((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) << (s))

Definition at line 85 of file jfs_dmap.h.

#define BLKTOL0 (   b,
  s 
)    (((((b) >> 23) << 10) + ((b) >> 23) + ((b) >> 33) + 2 + 1) << (s))

Definition at line 100 of file jfs_dmap.h.

#define BLKTOL1 (   b,
  s 
)    (((((b) >> 33) << 20) + (((b) >> 33) << 10) + ((b) >> 33) + 1 + 1) << (s))

Definition at line 115 of file jfs_dmap.h.

#define BMAPBLKNO   0 /* lblkno of bmap within the map */

Definition at line 42 of file jfs_dmap.h.

#define BMAPSZTOLEV (   size)    (((size) <= MAXL0SIZE) ? 0 : ((size) <= MAXL1SIZE) ? 1 : 2)

Definition at line 129 of file jfs_dmap.h.

#define BMAPVERSION   1 /* version number */

Definition at line 23 of file jfs_dmap.h.

#define BPERDMAP   (LPERDMAP * DBWORD) /* num of blks per dmap */

Definition at line 31 of file jfs_dmap.h.

#define BUDMIN   L2DBWORD /* max free string in a map word */

Definition at line 30 of file jfs_dmap.h.

#define BUDSIZE (   s,
  m 
)    (1 << ((s) - (m)))

Definition at line 288 of file jfs_dmap.h.

#define CTLLEAFIND   (256+64+16+4+1) /* idx of 1st leaf of a dmapctl tree */

Definition at line 34 of file jfs_dmap.h.

#define CTLTREESIZE   (1024+256+64+16+4+1) /* size of a dmapctl tree */

Definition at line 33 of file jfs_dmap.h.

#define db_agfree   db_bmap.dn_agfree

Definition at line 254 of file jfs_dmap.h.

#define db_agheight   db_bmap.dn_agheight

Definition at line 258 of file jfs_dmap.h.

#define db_agl2size   db_bmap.dn_agl2size

Definition at line 256 of file jfs_dmap.h.

#define db_aglevel   db_bmap.dn_aglevel

Definition at line 262 of file jfs_dmap.h.

#define db_agpref   db_bmap.dn_agpref

Definition at line 263 of file jfs_dmap.h.

#define db_agsize   db_bmap.dn_agsize

Definition at line 255 of file jfs_dmap.h.

#define db_agstart   db_bmap.dn_agstart

Definition at line 259 of file jfs_dmap.h.

#define db_agwidth   db_bmap.dn_agwidth

Definition at line 257 of file jfs_dmap.h.

#define db_l2nbperpage   db_bmap.dn_l2nbperpage

Definition at line 266 of file jfs_dmap.h.

#define db_mapsize   db_bmap.dn_mapsize

Definition at line 252 of file jfs_dmap.h.

#define db_maxag   db_bmap.dn_maxag

Definition at line 264 of file jfs_dmap.h.

#define db_maxfreebud   db_bmap.dn_maxfreebud

Definition at line 265 of file jfs_dmap.h.

#define db_maxlevel   db_bmap.dn_maxlevel

Definition at line 261 of file jfs_dmap.h.

#define db_nfree   db_bmap.dn_nfree

Definition at line 253 of file jfs_dmap.h.

#define db_numag   db_bmap.dn_numag

Definition at line 260 of file jfs_dmap.h.

#define DBWORD   32 /* # of blks covered by a map word */

Definition at line 28 of file jfs_dmap.h.

#define dmt_budmin   t1.budmin

Definition at line 198 of file jfs_dmap.h.

#define dmt_height   t1.height

Definition at line 197 of file jfs_dmap.h.

#define dmt_l2nleafs   t1.l2nleafs

Definition at line 195 of file jfs_dmap.h.

#define dmt_leafidx   t1.leafidx

Definition at line 196 of file jfs_dmap.h.

#define dmt_nleafs   t1.nleafs

Definition at line 194 of file jfs_dmap.h.

#define dmt_stree   t1.stree

Definition at line 199 of file jfs_dmap.h.

#define L2BPERDMAP   13 /* l2 num of blks per dmap */

Definition at line 32 of file jfs_dmap.h.

#define L2DBWORD   5 /* l2 # of blks covered by a mword */

Definition at line 29 of file jfs_dmap.h.

#define L2LPERCTL   10 /* l2 num of leaves per dmapctl tree */

Definition at line 36 of file jfs_dmap.h.

#define L2LPERDMAP   8 /* l2 number of leaves per dmap tree */

Definition at line 27 of file jfs_dmap.h.

#define L2MAXAG   7 /* l2 max num of AG */

Definition at line 40 of file jfs_dmap.h.

#define L2MAXL0SIZE   (L2BPERDMAP + 1 * L2LPERCTL)

Definition at line 47 of file jfs_dmap.h.

#define L2MAXL1SIZE   (L2BPERDMAP + 2 * L2LPERCTL)

Definition at line 48 of file jfs_dmap.h.

#define L2MAXL2SIZE   (L2BPERDMAP + 3 * L2LPERCTL)

Definition at line 49 of file jfs_dmap.h.

#define L2MINAGSZ   25 /* l2 of minimum AG size in bytes */

Definition at line 41 of file jfs_dmap.h.

#define LEAFIND   (64+16+4+1) /* index of 1st leaf of a dmap tree */

Definition at line 25 of file jfs_dmap.h.

#define LITOL2BSZ (   n,
  m,
  b 
)    ((((n) == 0) ? (m) : cnttz((n))) + (b))

Definition at line 281 of file jfs_dmap.h.

#define LPERCTL   1024 /* num of leaves per dmapctl tree */

Definition at line 35 of file jfs_dmap.h.

#define LPERDMAP   256 /* num leaves per dmap tree */

Definition at line 26 of file jfs_dmap.h.

#define MAXAG   128 /* max number of allocation groups */

Definition at line 39 of file jfs_dmap.h.

#define MAXL0SIZE   ((s64)1 << L2MAXL0SIZE)

Definition at line 54 of file jfs_dmap.h.

#define MAXL1SIZE   ((s64)1 << L2MAXL1SIZE)

Definition at line 55 of file jfs_dmap.h.

#define MAXL2SIZE   ((s64)1 << L2MAXL2SIZE)

Definition at line 56 of file jfs_dmap.h.

#define MAXMAPSIZE   MAXL2SIZE /* maximum aggregate map size */

Definition at line 58 of file jfs_dmap.h.

#define NLSTOL2BSZ (   n)    (31 - cntlz((n)) + BUDMIN)

Definition at line 278 of file jfs_dmap.h.

#define NOFREE   ((s8) -1) /* no blocks free */

Definition at line 38 of file jfs_dmap.h.

#define ROOT   0 /* index of the root of a tree */

Definition at line 37 of file jfs_dmap.h.

#define TREESIZE   (256+64+16+4+1) /* size of a dmap tree */

Definition at line 24 of file jfs_dmap.h.

Typedef Documentation

typedef union dmtree dmtree_t

Function Documentation

int dbAlloc ( struct inode ipbmap,
s64  hint,
s64  nblocks,
s64 results 
)

Definition at line 702 of file jfs_dmap.c.

int dbAllocBottomUp ( struct inode ip,
s64  blkno,
s64  nblocks 
)

Definition at line 3222 of file jfs_dmap.c.

s64 dbDiscardAG ( struct inode ip,
int  agno,
s64  minlen 
)

Definition at line 1628 of file jfs_dmap.c.

int dbExtendFS ( struct inode ipbmap,
s64  blkno,
s64  nblocks 
)

Definition at line 3398 of file jfs_dmap.c.

void dbFinalizeBmap ( struct inode ipbmap)

Definition at line 3671 of file jfs_dmap.c.

int dbFree ( struct inode ipbmap,
s64  blkno,
s64  nblocks 
)

TRIM the blocks, when mounted with discard option

Definition at line 331 of file jfs_dmap.c.

s64 dbMapFileSizeToMapSize ( struct inode ipbmap)

Definition at line 4067 of file jfs_dmap.c.

int dbMount ( struct inode ipbmap)

Definition at line 165 of file jfs_dmap.c.

int dbNextAG ( struct inode ipbmap)

Definition at line 605 of file jfs_dmap.c.

int dbReAlloc ( struct inode ipbmap,
s64  blkno,
s64  nblocks,
s64  addnblocks,
s64 results 
)

Definition at line 980 of file jfs_dmap.c.

int dbSync ( struct inode ipbmap)

Definition at line 263 of file jfs_dmap.c.

int dbUnmount ( struct inode ipbmap,
int  mounterror 
)

Definition at line 242 of file jfs_dmap.c.

int dbUpdatePMap ( struct inode ipbmap,
int  free,
s64  blkno,
s64  nblocks,
struct tblock tblk 
)

Definition at line 425 of file jfs_dmap.c.