X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fjfs_dmap.h;h=45ea454c74bd03f615fac463793ace154d9a7b1f;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=9599b9ff109d0cebffb010e1519adb44ca2d982b;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h index 9599b9ff1..45ea454c7 100644 --- a/fs/jfs/jfs_dmap.h +++ b/fs/jfs/jfs_dmap.h @@ -1,18 +1,18 @@ /* - * Copyright (c) International Business Machines Corp., 2000-2002 + * Copyright (C) International Business Machines Corp., 2000-2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _H_JFS_DMAP @@ -27,7 +27,7 @@ #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 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 */ @@ -57,7 +57,7 @@ #define MAXMAPSIZE MAXL2SIZE /* maximum aggregate map size */ -/* +/* * determine the maximum free string for four (lower level) nodes * of the tree. */ @@ -122,7 +122,7 @@ static __inline signed char TREEMAX(signed char *cp) #define BLKTOCTL(b,s,l) \ (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s))) -/* +/* * convert aggregate map size to the zero origin dmapctl level of the * top dmapctl. */ @@ -145,10 +145,10 @@ static __inline signed char TREEMAX(signed char *cp) * dmaptree must be consistent with dmapctl. */ struct dmaptree { - s32 nleafs; /* 4: number of tree leafs */ - s32 l2nleafs; /* 4: l2 number of tree leafs */ - s32 leafidx; /* 4: index of first tree leaf */ - s32 height; /* 4: height of the tree */ + __le32 nleafs; /* 4: number of tree leafs */ + __le32 l2nleafs; /* 4: l2 number of tree leafs */ + __le32 leafidx; /* 4: index of first tree leaf */ + __le32 height; /* 4: height of the tree */ s8 budmin; /* 1: min l2 tree leaf value to combine */ s8 stree[TREESIZE]; /* TREESIZE: tree */ u8 pad[2]; /* 2: pad to word boundary */ @@ -158,13 +158,13 @@ struct dmaptree { * dmap page per 8K blocks bitmap */ struct dmap { - s32 nblocks; /* 4: num blks covered by this dmap */ - s32 nfree; /* 4: num of free blks in this dmap */ - s64 start; /* 8: starting blkno for this dmap */ + __le32 nblocks; /* 4: num blks covered by this dmap */ + __le32 nfree; /* 4: num of free blks in this dmap */ + __le64 start; /* 8: starting blkno for this dmap */ struct dmaptree tree; /* 360: dmap tree */ u8 pad[1672]; /* 1672: pad to 2048 bytes */ - u32 wmap[LPERDMAP]; /* 1024: bits of the working map */ - u32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */ + __le32 wmap[LPERDMAP]; /* 1024: bits of the working map */ + __le32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */ }; /* - 4096 - */ /* @@ -173,10 +173,10 @@ struct dmap { * dmapctl must be consistent with dmaptree. */ struct dmapctl { - s32 nleafs; /* 4: number of tree leafs */ - s32 l2nleafs; /* 4: l2 number of tree leafs */ - s32 leafidx; /* 4: index of the first tree leaf */ - s32 height; /* 4: height of tree */ + __le32 nleafs; /* 4: number of tree leafs */ + __le32 l2nleafs; /* 4: l2 number of tree leafs */ + __le32 leafidx; /* 4: index of the first tree leaf */ + __le32 height; /* 4: height of tree */ s8 budmin; /* 1: minimum l2 tree leaf value */ s8 stree[CTLTREESIZE]; /* CTLTREESIZE: dmapctl tree */ u8 pad[2714]; /* 2714: pad to 4096 */ @@ -192,41 +192,58 @@ typedef union dmtree { /* macros for accessing fields within dmtree */ #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 dmt_l2nleafs t1.l2nleafs +#define dmt_leafidx t1.leafidx +#define dmt_height t1.height +#define dmt_budmin t1.budmin +#define dmt_stree t1.stree -/* +/* * on-disk aggregate disk allocation map descriptor. */ -struct dbmap { - s64 dn_mapsize; /* 8: number of blocks in aggregate */ - s64 dn_nfree; /* 8: num free blks in aggregate map */ - s32 dn_l2nbperpage; /* 4: number of blks per page */ - s32 dn_numag; /* 4: total number of ags */ - s32 dn_maxlevel; /* 4: number of active ags */ - s32 dn_maxag; /* 4: max active alloc group number */ - s32 dn_agpref; /* 4: preferred alloc group (hint) */ - s32 dn_aglevel; /* 4: dmapctl level holding the AG */ - s32 dn_agheigth; /* 4: height in dmapctl of the AG */ - s32 dn_agwidth; /* 4: width in dmapctl of the AG */ - s32 dn_agstart; /* 4: start tree index at AG height */ - s32 dn_agl2size; /* 4: l2 num of blks per alloc group */ - s64 dn_agfree[MAXAG]; /* 8*MAXAG: per AG free count */ - s64 dn_agsize; /* 8: num of blks per alloc group */ +struct dbmap_disk { + __le64 dn_mapsize; /* 8: number of blocks in aggregate */ + __le64 dn_nfree; /* 8: num free blks in aggregate map */ + __le32 dn_l2nbperpage; /* 4: number of blks per page */ + __le32 dn_numag; /* 4: total number of ags */ + __le32 dn_maxlevel; /* 4: number of active ags */ + __le32 dn_maxag; /* 4: max active alloc group number */ + __le32 dn_agpref; /* 4: preferred alloc group (hint) */ + __le32 dn_aglevel; /* 4: dmapctl level holding the AG */ + __le32 dn_agheigth; /* 4: height in dmapctl of the AG */ + __le32 dn_agwidth; /* 4: width in dmapctl of the AG */ + __le32 dn_agstart; /* 4: start tree index at AG height */ + __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */ + __le64 dn_agfree[MAXAG];/* 8*MAXAG: per AG free count */ + __le64 dn_agsize; /* 8: num of blks per alloc group */ s8 dn_maxfreebud; /* 1: max free buddy system */ u8 pad[3007]; /* 3007: pad to 4096 */ }; /* - 4096 - */ -/* +struct dbmap { + s64 dn_mapsize; /* number of blocks in aggregate */ + s64 dn_nfree; /* num free blks in aggregate map */ + int dn_l2nbperpage; /* number of blks per page */ + int dn_numag; /* total number of ags */ + int dn_maxlevel; /* number of active ags */ + int dn_maxag; /* max active alloc group number */ + int dn_agpref; /* preferred alloc group (hint) */ + int dn_aglevel; /* dmapctl level holding the AG */ + int dn_agheigth; /* height in dmapctl of the AG */ + int dn_agwidth; /* width in dmapctl of the AG */ + int dn_agstart; /* start tree index at AG height */ + int dn_agl2size; /* l2 num of blks per alloc group */ + s64 dn_agfree[MAXAG]; /* per AG free count */ + s64 dn_agsize; /* num of blks per alloc group */ + signed char dn_maxfreebud; /* max free buddy system */ +}; /* - 4096 - */ +/* * in-memory aggregate disk allocation map descriptor. */ struct bmap { - struct dbmap db_bmap; /* on-disk aggregate map descriptor */ + struct dbmap db_bmap; /* on-disk aggregate map descriptor */ struct inode *db_ipbmap; /* ptr to aggregate map incore inode */ - struct semaphore db_bmaplock; /* aggregate map lock */ + struct mutex db_bmaplock; /* aggregate map lock */ atomic_t db_active[MAXAG]; /* count of active, open files in AG */ u32 *db_DBmap; };