Commit 175ac86f authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jfs.bkbits.net/linux-2.5

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 022ecaf1 c157257b
...@@ -39,22 +39,22 @@ struct dinode { ...@@ -39,22 +39,22 @@ struct dinode {
* *
* define generic/POSIX attributes * define generic/POSIX attributes
*/ */
u32 di_inostamp; /* 4: stamp to show inode belongs to fileset */ __le32 di_inostamp; /* 4: stamp to show inode belongs to fileset */
s32 di_fileset; /* 4: fileset number */ __le32 di_fileset; /* 4: fileset number */
u32 di_number; /* 4: inode number, aka file serial number */ __le32 di_number; /* 4: inode number, aka file serial number */
u32 di_gen; /* 4: inode generation number */ __le32 di_gen; /* 4: inode generation number */
pxd_t di_ixpxd; /* 8: inode extent descriptor */ pxd_t di_ixpxd; /* 8: inode extent descriptor */
s64 di_size; /* 8: size */ __le64 di_size; /* 8: size */
s64 di_nblocks; /* 8: number of blocks allocated */ __le64 di_nblocks; /* 8: number of blocks allocated */
u32 di_nlink; /* 4: number of links to the object */ __le32 di_nlink; /* 4: number of links to the object */
u32 di_uid; /* 4: user id of owner */ __le32 di_uid; /* 4: user id of owner */
u32 di_gid; /* 4: group id of owner */ __le32 di_gid; /* 4: group id of owner */
u32 di_mode; /* 4: attribute, format and permission */ __le32 di_mode; /* 4: attribute, format and permission */
struct timestruc_t di_atime; /* 8: time last data accessed */ struct timestruc_t di_atime; /* 8: time last data accessed */
struct timestruc_t di_ctime; /* 8: time last status changed */ struct timestruc_t di_ctime; /* 8: time last status changed */
...@@ -65,9 +65,9 @@ struct dinode { ...@@ -65,9 +65,9 @@ struct dinode {
dxd_t di_ea; /* 16: ea descriptor */ dxd_t di_ea; /* 16: ea descriptor */
u32 di_next_index; /* 4: Next available dir_table index */ __le32 di_next_index; /* 4: Next available dir_table index */
s32 di_acltype; /* 4: Type of ACL */ __le32 di_acltype; /* 4: Type of ACL */
/* /*
* Extension Areas. * Extension Areas.
...@@ -103,7 +103,7 @@ struct dinode { ...@@ -103,7 +103,7 @@ struct dinode {
u8 _data[96]; /* 96: unused */ u8 _data[96]; /* 96: unused */
struct { struct {
void *_imap; /* 4: unused */ void *_imap; /* 4: unused */
u32 _gengen; /* 4: generator */ __le32 _gengen; /* 4: generator */
} _imap; } _imap;
} _u1; /* 96: */ } _u1; /* 96: */
#define di_gengen u._file._u1._imap._gengen #define di_gengen u._file._u1._imap._gengen
...@@ -114,7 +114,7 @@ struct dinode { ...@@ -114,7 +114,7 @@ struct dinode {
u8 unused[16]; /* 16: */ u8 unused[16]; /* 16: */
dxd_t _dxd; /* 16: */ dxd_t _dxd; /* 16: */
union { union {
u32 _rdev; /* 4: */ __le32 _rdev; /* 4: */
u8 _fastsymlink[128]; u8 _fastsymlink[128];
} _u; } _u;
u8 _inlineea[128]; u8 _inlineea[128];
......
...@@ -194,7 +194,7 @@ static s8 budtab[256] = { ...@@ -194,7 +194,7 @@ static s8 budtab[256] = {
int dbMount(struct inode *ipbmap) int dbMount(struct inode *ipbmap)
{ {
struct bmap *bmp; struct bmap *bmp;
struct dbmap *dbmp_le; struct dbmap_disk *dbmp_le;
struct metapage *mp; struct metapage *mp;
int i; int i;
...@@ -216,7 +216,7 @@ int dbMount(struct inode *ipbmap) ...@@ -216,7 +216,7 @@ int dbMount(struct inode *ipbmap)
} }
/* copy the on-disk bmap descriptor to its in-memory version. */ /* copy the on-disk bmap descriptor to its in-memory version. */
dbmp_le = (struct dbmap *) mp->data; dbmp_le = (struct dbmap_disk *) mp->data;
bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize); bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
...@@ -301,7 +301,7 @@ int dbUnmount(struct inode *ipbmap, int mounterror) ...@@ -301,7 +301,7 @@ int dbUnmount(struct inode *ipbmap, int mounterror)
*/ */
int dbSync(struct inode *ipbmap) int dbSync(struct inode *ipbmap)
{ {
struct dbmap *dbmp_le; struct dbmap_disk *dbmp_le;
struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap;
struct metapage *mp; struct metapage *mp;
int i; int i;
...@@ -318,7 +318,7 @@ int dbSync(struct inode *ipbmap) ...@@ -318,7 +318,7 @@ int dbSync(struct inode *ipbmap)
return -EIO; return -EIO;
} }
/* copy the in-memory version of the bmap to the on-disk version */ /* copy the in-memory version of the bmap to the on-disk version */
dbmp_le = (struct dbmap *) mp->data; dbmp_le = (struct dbmap_disk *) mp->data;
dbmp_le->dn_mapsize = cpu_to_le64(bmp->db_mapsize); dbmp_le->dn_mapsize = cpu_to_le64(bmp->db_mapsize);
dbmp_le->dn_nfree = cpu_to_le64(bmp->db_nfree); dbmp_le->dn_nfree = cpu_to_le64(bmp->db_nfree);
dbmp_le->dn_l2nbperpage = cpu_to_le32(bmp->db_l2nbperpage); dbmp_le->dn_l2nbperpage = cpu_to_le32(bmp->db_l2nbperpage);
...@@ -3782,7 +3782,7 @@ static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks) ...@@ -3782,7 +3782,7 @@ static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
/* set the rest of the words in the page to allocated (ONES) */ /* set the rest of the words in the page to allocated (ONES) */
for (i = w; i < LPERDMAP; i++) for (i = w; i < LPERDMAP; i++)
dp->pmap[i] = dp->wmap[i] = ONES; dp->pmap[i] = dp->wmap[i] = cpu_to_le32(ONES);
/* /*
* init tree * init tree
......
...@@ -145,10 +145,10 @@ static __inline signed char TREEMAX(signed char *cp) ...@@ -145,10 +145,10 @@ static __inline signed char TREEMAX(signed char *cp)
* dmaptree must be consistent with dmapctl. * dmaptree must be consistent with dmapctl.
*/ */
struct dmaptree { struct dmaptree {
s32 nleafs; /* 4: number of tree leafs */ __le32 nleafs; /* 4: number of tree leafs */
s32 l2nleafs; /* 4: l2 number of tree leafs */ __le32 l2nleafs; /* 4: l2 number of tree leafs */
s32 leafidx; /* 4: index of first tree leaf */ __le32 leafidx; /* 4: index of first tree leaf */
s32 height; /* 4: height of the tree */ __le32 height; /* 4: height of the tree */
s8 budmin; /* 1: min l2 tree leaf value to combine */ s8 budmin; /* 1: min l2 tree leaf value to combine */
s8 stree[TREESIZE]; /* TREESIZE: tree */ s8 stree[TREESIZE]; /* TREESIZE: tree */
u8 pad[2]; /* 2: pad to word boundary */ u8 pad[2]; /* 2: pad to word boundary */
...@@ -158,13 +158,13 @@ struct dmaptree { ...@@ -158,13 +158,13 @@ struct dmaptree {
* dmap page per 8K blocks bitmap * dmap page per 8K blocks bitmap
*/ */
struct dmap { struct dmap {
s32 nblocks; /* 4: num blks covered by this dmap */ __le32 nblocks; /* 4: num blks covered by this dmap */
s32 nfree; /* 4: num of free blks in this dmap */ __le32 nfree; /* 4: num of free blks in this dmap */
s64 start; /* 8: starting blkno for this dmap */ __le64 start; /* 8: starting blkno for this dmap */
struct dmaptree tree; /* 360: dmap tree */ struct dmaptree tree; /* 360: dmap tree */
u8 pad[1672]; /* 1672: pad to 2048 bytes */ u8 pad[1672]; /* 1672: pad to 2048 bytes */
u32 wmap[LPERDMAP]; /* 1024: bits of the working map */ __le32 wmap[LPERDMAP]; /* 1024: bits of the working map */
u32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */ __le32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */
}; /* - 4096 - */ }; /* - 4096 - */
/* /*
...@@ -173,10 +173,10 @@ struct dmap { ...@@ -173,10 +173,10 @@ struct dmap {
* dmapctl must be consistent with dmaptree. * dmapctl must be consistent with dmaptree.
*/ */
struct dmapctl { struct dmapctl {
s32 nleafs; /* 4: number of tree leafs */ __le32 nleafs; /* 4: number of tree leafs */
s32 l2nleafs; /* 4: l2 number of tree leafs */ __le32 l2nleafs; /* 4: l2 number of tree leafs */
s32 leafidx; /* 4: index of the first tree leaf */ __le32 leafidx; /* 4: index of the first tree leaf */
s32 height; /* 4: height of tree */ __le32 height; /* 4: height of tree */
s8 budmin; /* 1: minimum l2 tree leaf value */ s8 budmin; /* 1: minimum l2 tree leaf value */
s8 stree[CTLTREESIZE]; /* CTLTREESIZE: dmapctl tree */ s8 stree[CTLTREESIZE]; /* CTLTREESIZE: dmapctl tree */
u8 pad[2714]; /* 2714: pad to 4096 */ u8 pad[2714]; /* 2714: pad to 4096 */
...@@ -201,25 +201,42 @@ typedef union dmtree { ...@@ -201,25 +201,42 @@ typedef union dmtree {
/* /*
* on-disk aggregate disk allocation map descriptor. * on-disk aggregate disk allocation map descriptor.
*/ */
struct dbmap { struct dbmap_disk {
s64 dn_mapsize; /* 8: number of blocks in aggregate */ __le64 dn_mapsize; /* 8: number of blocks in aggregate */
s64 dn_nfree; /* 8: num free blks in aggregate map */ __le64 dn_nfree; /* 8: num free blks in aggregate map */
s32 dn_l2nbperpage; /* 4: number of blks per page */ __le32 dn_l2nbperpage; /* 4: number of blks per page */
s32 dn_numag; /* 4: total number of ags */ __le32 dn_numag; /* 4: total number of ags */
s32 dn_maxlevel; /* 4: number of active ags */ __le32 dn_maxlevel; /* 4: number of active ags */
s32 dn_maxag; /* 4: max active alloc group number */ __le32 dn_maxag; /* 4: max active alloc group number */
s32 dn_agpref; /* 4: preferred alloc group (hint) */ __le32 dn_agpref; /* 4: preferred alloc group (hint) */
s32 dn_aglevel; /* 4: dmapctl level holding the AG */ __le32 dn_aglevel; /* 4: dmapctl level holding the AG */
s32 dn_agheigth; /* 4: height in dmapctl of the AG */ __le32 dn_agheigth; /* 4: height in dmapctl of the AG */
s32 dn_agwidth; /* 4: width in dmapctl of the AG */ __le32 dn_agwidth; /* 4: width in dmapctl of the AG */
s32 dn_agstart; /* 4: start tree index at AG height */ __le32 dn_agstart; /* 4: start tree index at AG height */
s32 dn_agl2size; /* 4: l2 num of blks per alloc group */ __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */
s64 dn_agfree[MAXAG]; /* 8*MAXAG: per AG free count */ __le64 dn_agfree[MAXAG];/* 8*MAXAG: per AG free count */
s64 dn_agsize; /* 8: num of blks per alloc group */ __le64 dn_agsize; /* 8: num of blks per alloc group */
s8 dn_maxfreebud; /* 1: max free buddy system */ s8 dn_maxfreebud; /* 1: max free buddy system */
u8 pad[3007]; /* 3007: pad to 4096 */ u8 pad[3007]; /* 3007: pad to 4096 */
}; /* - 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. * in-memory aggregate disk allocation map descriptor.
*/ */
......
...@@ -852,7 +852,7 @@ int dtInsert(tid_t tid, struct inode *ip, ...@@ -852,7 +852,7 @@ int dtInsert(tid_t tid, struct inode *ip,
n = NDTLEAF_LEGACY(name->namlen); n = NDTLEAF_LEGACY(name->namlen);
data.leaf.ip = NULL; /* signifies legacy directory format */ data.leaf.ip = NULL; /* signifies legacy directory format */
} }
data.leaf.ino = cpu_to_le32(*fsn); data.leaf.ino = *fsn;
/* /*
* leaf page does not have enough room for new entry: * leaf page does not have enough room for new entry:
...@@ -3570,7 +3570,8 @@ static int dtCompare(struct component_name * key, /* search key */ ...@@ -3570,7 +3570,8 @@ static int dtCompare(struct component_name * key, /* search key */
dtpage_t * p, /* directory page */ dtpage_t * p, /* directory page */
int si) int si)
{ /* entry slot index */ { /* entry slot index */
wchar_t *kname, *name; wchar_t *kname;
__le16 *name;
int klen, namlen, len, rc; int klen, namlen, len, rc;
struct idtentry *ih; struct idtentry *ih;
struct dtslot *t; struct dtslot *t;
...@@ -3646,7 +3647,8 @@ static int ciCompare(struct component_name * key, /* search key */ ...@@ -3646,7 +3647,8 @@ static int ciCompare(struct component_name * key, /* search key */
int si, /* entry slot index */ int si, /* entry slot index */
int flag) int flag)
{ {
wchar_t *kname, *name, x; wchar_t *kname, x;
__le16 *name;
int klen, namlen, len, rc; int klen, namlen, len, rc;
struct ldtentry *lh; struct ldtentry *lh;
struct idtentry *ih; struct idtentry *ih;
...@@ -3824,7 +3826,8 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */ ...@@ -3824,7 +3826,8 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
struct idtentry *ih; struct idtentry *ih;
struct dtslot *t; struct dtslot *t;
int namlen, len; int namlen, len;
wchar_t *name, *kname; wchar_t *kname;
__le16 *name;
/* get entry */ /* get entry */
stbl = DT_GETSTBL(p); stbl = DT_GETSTBL(p);
...@@ -3852,7 +3855,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */ ...@@ -3852,7 +3855,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
/* /*
* move head/only segment * move head/only segment
*/ */
UniStrncpy_le(kname, name, len); UniStrncpy_from_le(kname, name, len);
/* /*
* move additional segment(s) * move additional segment(s)
...@@ -3863,7 +3866,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */ ...@@ -3863,7 +3866,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
kname += len; kname += len;
namlen -= len; namlen -= len;
len = min(namlen, DTSLOTDATALEN); len = min(namlen, DTSLOTDATALEN);
UniStrncpy_le(kname, t->name, len); UniStrncpy_from_le(kname, t->name, len);
si = t->next; si = t->next;
} }
...@@ -3885,7 +3888,8 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key, ...@@ -3885,7 +3888,8 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
struct ldtentry *lh = NULL; struct ldtentry *lh = NULL;
struct idtentry *ih = NULL; struct idtentry *ih = NULL;
int hsi, fsi, klen, len, nextindex; int hsi, fsi, klen, len, nextindex;
wchar_t *kname, *name; wchar_t *kname;
__le16 *name;
s8 *stbl; s8 *stbl;
pxd_t *xd; pxd_t *xd;
struct dt_lock *dtlck = *dtlock; struct dt_lock *dtlck = *dtlock;
...@@ -3914,7 +3918,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key, ...@@ -3914,7 +3918,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
if (p->header.flag & BT_LEAF) { if (p->header.flag & BT_LEAF) {
lh = (struct ldtentry *) h; lh = (struct ldtentry *) h;
lh->next = h->next; lh->next = h->next;
lh->inumber = data->leaf.ino; /* little-endian */ lh->inumber = cpu_to_le32(data->leaf.ino);
lh->namlen = klen; lh->namlen = klen;
name = lh->name; name = lh->name;
if (data->leaf.ip) { if (data->leaf.ip) {
...@@ -3936,7 +3940,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key, ...@@ -3936,7 +3940,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
len = min(klen, DTIHDRDATALEN); len = min(klen, DTIHDRDATALEN);
} }
UniStrncpy_le(name, kname, len); UniStrncpy_to_le(name, kname, len);
n = 1; n = 1;
xsi = hsi; xsi = hsi;
...@@ -3971,7 +3975,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key, ...@@ -3971,7 +3975,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
kname += len; kname += len;
len = min(klen, DTSLOTDATALEN); len = min(klen, DTSLOTDATALEN);
UniStrncpy_le(t->name, kname, len); UniStrncpy_to_le(t->name, kname, len);
n++; n++;
xsi = fsi; xsi = fsi;
...@@ -4174,7 +4178,7 @@ static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp, ...@@ -4174,7 +4178,7 @@ static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
d++; d++;
len = min(snamlen, DTSLOTDATALEN); len = min(snamlen, DTSLOTDATALEN);
UniStrncpy(d->name, s->name, len); UniStrncpy_le(d->name, s->name, len);
ns++; ns++;
nd++; nd++;
......
...@@ -47,7 +47,7 @@ typedef union { ...@@ -47,7 +47,7 @@ typedef union {
struct dtslot { struct dtslot {
s8 next; /* 1: */ s8 next; /* 1: */
s8 cnt; /* 1: */ s8 cnt; /* 1: */
wchar_t name[15]; /* 30: */ __le16 name[15]; /* 30: */
}; /* (32) */ }; /* (32) */
...@@ -67,7 +67,7 @@ struct idtentry { ...@@ -67,7 +67,7 @@ struct idtentry {
s8 next; /* 1: */ s8 next; /* 1: */
u8 namlen; /* 1: */ u8 namlen; /* 1: */
wchar_t name[11]; /* 22: 2-byte aligned */ __le16 name[11]; /* 22: 2-byte aligned */
}; /* (32) */ }; /* (32) */
#define DTIHDRSIZE 10 #define DTIHDRSIZE 10
...@@ -83,11 +83,11 @@ struct idtentry { ...@@ -83,11 +83,11 @@ struct idtentry {
* For legacy filesystems, name contains 13 wchars -- no index field * For legacy filesystems, name contains 13 wchars -- no index field
*/ */
struct ldtentry { struct ldtentry {
u32 inumber; /* 4: 4-byte aligned */ __le32 inumber; /* 4: 4-byte aligned */
s8 next; /* 1: */ s8 next; /* 1: */
u8 namlen; /* 1: */ u8 namlen; /* 1: */
wchar_t name[11]; /* 22: 2-byte aligned */ __le16 name[11]; /* 22: 2-byte aligned */
u32 index; /* 4: index into dir_table */ __le32 index; /* 4: index into dir_table */
}; /* (32) */ }; /* (32) */
#define DTLHDRSIZE 6 #define DTLHDRSIZE 6
...@@ -113,7 +113,7 @@ struct dir_table_slot { ...@@ -113,7 +113,7 @@ struct dir_table_slot {
u8 flag; /* 1: 0 if free */ u8 flag; /* 1: 0 if free */
u8 slot; /* 1: slot within leaf page of entry */ u8 slot; /* 1: slot within leaf page of entry */
u8 addr1; /* 1: upper 8 bits of leaf page address */ u8 addr1; /* 1: upper 8 bits of leaf page address */
u32 addr2; /* 4: lower 32 bits of leaf page address -OR- __le32 addr2; /* 4: lower 32 bits of leaf page address -OR-
index of next entry when this entry was deleted */ index of next entry when this entry was deleted */
}; /* (8) */ }; /* (8) */
...@@ -151,7 +151,7 @@ typedef union { ...@@ -151,7 +151,7 @@ typedef union {
s8 freecnt; /* 1: free count */ s8 freecnt; /* 1: free count */
s8 freelist; /* 1: freelist header */ s8 freelist; /* 1: freelist header */
u32 idotdot; /* 4: parent inode number */ __le32 idotdot; /* 4: parent inode number */
s8 stbl[8]; /* 8: sorted entry index table */ s8 stbl[8]; /* 8: sorted entry index table */
} header; /* (32) */ } header; /* (32) */
...@@ -192,8 +192,8 @@ typedef union { ...@@ -192,8 +192,8 @@ typedef union {
*/ */
typedef union { typedef union {
struct { struct {
s64 next; /* 8: next sibling */ __le64 next; /* 8: next sibling */
s64 prev; /* 8: previous sibling */ __le64 prev; /* 8: previous sibling */
u8 flag; /* 1: */ u8 flag; /* 1: */
u8 nextindex; /* 1: next entry index in stbl */ u8 nextindex; /* 1: next entry index in stbl */
......
...@@ -131,7 +131,7 @@ int diMount(struct inode *ipimap) ...@@ -131,7 +131,7 @@ int diMount(struct inode *ipimap)
struct inomap *imap; struct inomap *imap;
struct metapage *mp; struct metapage *mp;
int index; int index;
struct dinomap *dinom_le; struct dinomap_disk *dinom_le;
/* /*
* allocate/initialize the in-memory inode map control structure * allocate/initialize the in-memory inode map control structure
...@@ -154,7 +154,7 @@ int diMount(struct inode *ipimap) ...@@ -154,7 +154,7 @@ int diMount(struct inode *ipimap)
} }
/* copy the on-disk version to the in-memory version. */ /* copy the on-disk version to the in-memory version. */
dinom_le = (struct dinomap *) mp->data; dinom_le = (struct dinomap_disk *) mp->data;
imap->im_freeiag = le32_to_cpu(dinom_le->in_freeiag); imap->im_freeiag = le32_to_cpu(dinom_le->in_freeiag);
imap->im_nextiag = le32_to_cpu(dinom_le->in_nextiag); imap->im_nextiag = le32_to_cpu(dinom_le->in_nextiag);
atomic_set(&imap->im_numinos, le32_to_cpu(dinom_le->in_numinos)); atomic_set(&imap->im_numinos, le32_to_cpu(dinom_le->in_numinos));
...@@ -242,7 +242,7 @@ int diUnmount(struct inode *ipimap, int mounterror) ...@@ -242,7 +242,7 @@ int diUnmount(struct inode *ipimap, int mounterror)
*/ */
int diSync(struct inode *ipimap) int diSync(struct inode *ipimap)
{ {
struct dinomap *dinom_le; struct dinomap_disk *dinom_le;
struct inomap *imp = JFS_IP(ipimap)->i_imap; struct inomap *imp = JFS_IP(ipimap)->i_imap;
struct metapage *mp; struct metapage *mp;
int index; int index;
...@@ -260,7 +260,7 @@ int diSync(struct inode *ipimap) ...@@ -260,7 +260,7 @@ int diSync(struct inode *ipimap)
} }
/* copy the in-memory version to the on-disk version */ /* copy the in-memory version to the on-disk version */
dinom_le = (struct dinomap *) mp->data; dinom_le = (struct dinomap_disk *) mp->data;
dinom_le->in_freeiag = cpu_to_le32(imp->im_freeiag); dinom_le->in_freeiag = cpu_to_le32(imp->im_freeiag);
dinom_le->in_nextiag = cpu_to_le32(imp->im_nextiag); dinom_le->in_nextiag = cpu_to_le32(imp->im_nextiag);
dinom_le->in_numinos = cpu_to_le32(atomic_read(&imp->im_numinos)); dinom_le->in_numinos = cpu_to_le32(atomic_read(&imp->im_numinos));
...@@ -1027,7 +1027,7 @@ int diFree(struct inode *ip) ...@@ -1027,7 +1027,7 @@ int diFree(struct inode *ip)
*/ */
iagp->inofreefwd = iagp->inofreefwd =
cpu_to_le32(imap->im_agctl[agno].inofree); cpu_to_le32(imap->im_agctl[agno].inofree);
iagp->inofreeback = -1; iagp->inofreeback = cpu_to_le32(-1);
imap->im_agctl[agno].inofree = iagno; imap->im_agctl[agno].inofree = iagno;
} }
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
...@@ -1037,7 +1037,7 @@ int diFree(struct inode *ip) ...@@ -1037,7 +1037,7 @@ int diFree(struct inode *ip)
* inodes (i.e., the inode being freed is the first free * inodes (i.e., the inode being freed is the first free
* inode of extent), * inode of extent),
*/ */
if (iagp->wmap[extno] == ONES) { if (iagp->wmap[extno] == cpu_to_le32(ONES)) {
sword = extno >> L2EXTSPERSUM; sword = extno >> L2EXTSPERSUM;
bitno = extno & (EXTSPERSUM - 1); bitno = extno & (EXTSPERSUM - 1);
iagp->inosmap[sword] &= iagp->inosmap[sword] &=
...@@ -1185,7 +1185,7 @@ int diFree(struct inode *ip) ...@@ -1185,7 +1185,7 @@ int diFree(struct inode *ip)
iagp->extfreefwd = iagp->extfreefwd =
cpu_to_le32(imap->im_agctl[agno].extfree); cpu_to_le32(imap->im_agctl[agno].extfree);
iagp->extfreeback = -1; iagp->extfreeback = cpu_to_le32(-1);
imap->im_agctl[agno].extfree = iagno; imap->im_agctl[agno].extfree = iagno;
} else { } else {
/* remove the iag from the ag extent list if all extents /* remove the iag from the ag extent list if all extents
...@@ -1201,7 +1201,7 @@ int diFree(struct inode *ip) ...@@ -1201,7 +1201,7 @@ int diFree(struct inode *ip)
imap->im_agctl[agno].extfree = imap->im_agctl[agno].extfree =
le32_to_cpu(iagp->extfreefwd); le32_to_cpu(iagp->extfreefwd);
iagp->extfreefwd = iagp->extfreeback = -1; iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1);
IAGFREE_LOCK(imap); IAGFREE_LOCK(imap);
iagp->iagfree = cpu_to_le32(imap->im_freeiag); iagp->iagfree = cpu_to_le32(imap->im_freeiag);
...@@ -1223,7 +1223,7 @@ int diFree(struct inode *ip) ...@@ -1223,7 +1223,7 @@ int diFree(struct inode *ip)
imap->im_agctl[agno].inofree = imap->im_agctl[agno].inofree =
le32_to_cpu(iagp->inofreefwd); le32_to_cpu(iagp->inofreefwd);
iagp->inofreefwd = iagp->inofreeback = -1; iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1);
} }
/* update the inode extent address and working map /* update the inode extent address and working map
...@@ -2131,7 +2131,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) ...@@ -2131,7 +2131,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
* allocated. if so, update the free inode summary * allocated. if so, update the free inode summary
* map to reflect this. * map to reflect this.
*/ */
if (iagp->wmap[extno] == ONES) { if (iagp->wmap[extno] == cpu_to_le32(ONES)) {
sword = extno >> L2EXTSPERSUM; sword = extno >> L2EXTSPERSUM;
bitno = extno & (EXTSPERSUM - 1); bitno = extno & (EXTSPERSUM - 1);
iagp->inosmap[sword] |= cpu_to_le32(HIGHORDER >> bitno); iagp->inosmap[sword] |= cpu_to_le32(HIGHORDER >> bitno);
...@@ -2153,7 +2153,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) ...@@ -2153,7 +2153,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
imap->im_agctl[agno].inofree = imap->im_agctl[agno].inofree =
le32_to_cpu(iagp->inofreefwd); le32_to_cpu(iagp->inofreefwd);
} }
iagp->inofreefwd = iagp->inofreeback = -1; iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1);
} }
/* update the free inode count at the iag, ag, inode /* update the free inode count at the iag, ag, inode
...@@ -2362,7 +2362,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) ...@@ -2362,7 +2362,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
imap->im_agctl[agno].extfree = imap->im_agctl[agno].extfree =
le32_to_cpu(iagp->extfreefwd); le32_to_cpu(iagp->extfreefwd);
iagp->extfreefwd = iagp->extfreeback = -1; iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1);
} else { } else {
/* if the iag has all free extents (newly allocated iag), /* if the iag has all free extents (newly allocated iag),
* add the iag to the ag free extent list. * add the iag to the ag free extent list.
...@@ -2372,7 +2372,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) ...@@ -2372,7 +2372,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
aiagp->extfreeback = cpu_to_le32(iagno); aiagp->extfreeback = cpu_to_le32(iagno);
iagp->extfreefwd = cpu_to_le32(fwd); iagp->extfreefwd = cpu_to_le32(fwd);
iagp->extfreeback = -1; iagp->extfreeback = cpu_to_le32(-1);
imap->im_agctl[agno].extfree = iagno; imap->im_agctl[agno].extfree = iagno;
} }
} }
...@@ -2386,7 +2386,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) ...@@ -2386,7 +2386,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
iagp->inofreefwd = iagp->inofreefwd =
cpu_to_le32(imap->im_agctl[agno].inofree); cpu_to_le32(imap->im_agctl[agno].inofree);
iagp->inofreeback = -1; iagp->inofreeback = cpu_to_le32(-1);
imap->im_agctl[agno].inofree = iagno; imap->im_agctl[agno].inofree = iagno;
} }
...@@ -2592,9 +2592,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2592,9 +2592,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* init the iag */ /* init the iag */
memset(iagp, 0, sizeof(struct iag)); memset(iagp, 0, sizeof(struct iag));
iagp->iagnum = cpu_to_le32(iagno); iagp->iagnum = cpu_to_le32(iagno);
iagp->inofreefwd = iagp->inofreeback = -1; iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1);
iagp->extfreefwd = iagp->extfreeback = -1; iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1);
iagp->iagfree = -1; iagp->iagfree = cpu_to_le32(-1);
iagp->nfreeinos = 0; iagp->nfreeinos = 0;
iagp->nfreeexts = cpu_to_le32(EXTSPERIAG); iagp->nfreeexts = cpu_to_le32(EXTSPERIAG);
...@@ -2602,7 +2602,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2602,7 +2602,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
* summary map initialization handled by bzero). * summary map initialization handled by bzero).
*/ */
for (i = 0; i < SMAPSZ; i++) for (i = 0; i < SMAPSZ; i++)
iagp->inosmap[i] = ONES; iagp->inosmap[i] = cpu_to_le32(ONES);
flush_metapage(mp); flush_metapage(mp);
...@@ -2676,7 +2676,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2676,7 +2676,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* remove the iag from the iag free list */ /* remove the iag from the iag free list */
imap->im_freeiag = le32_to_cpu(iagp->iagfree); imap->im_freeiag = le32_to_cpu(iagp->iagfree);
iagp->iagfree = -1; iagp->iagfree = cpu_to_le32(-1);
/* set the return iag number and buffer pointer */ /* set the return iag number and buffer pointer */
*iagnop = iagno; *iagnop = iagno;
...@@ -2924,8 +2924,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) ...@@ -2924,8 +2924,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* init per AG control information im_agctl[] */ /* init per AG control information im_agctl[] */
for (i = 0; i < MAXAG; i++) { for (i = 0; i < MAXAG; i++) {
imap->im_agctl[i].inofree = -1; /* free inode list */ imap->im_agctl[i].inofree = -1;
imap->im_agctl[i].extfree = -1; /* free extent list */ imap->im_agctl[i].extfree = -1;
imap->im_agctl[i].numinos = 0; /* number of backed inodes */ imap->im_agctl[i].numinos = 0; /* number of backed inodes */
imap->im_agctl[i].numfree = 0; /* number of free backed inodes */ imap->im_agctl[i].numfree = 0; /* number of free backed inodes */
} }
...@@ -2970,18 +2970,18 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) ...@@ -2970,18 +2970,18 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* if any backed free inodes, insert at AG free inode list */ /* if any backed free inodes, insert at AG free inode list */
if ((int) le32_to_cpu(iagp->nfreeinos) > 0) { if ((int) le32_to_cpu(iagp->nfreeinos) > 0) {
if ((head = imap->im_agctl[n].inofree) == -1) if ((head = imap->im_agctl[n].inofree) == -1) {
iagp->inofreefwd = iagp->inofreeback = -1; iagp->inofreefwd = cpu_to_le32(-1);
else { iagp->inofreeback = cpu_to_le32(-1);
} else {
if ((rc = diIAGRead(imap, head, &hbp))) { if ((rc = diIAGRead(imap, head, &hbp))) {
rcx = rc; rcx = rc;
goto nextiag; goto nextiag;
} }
hiagp = (struct iag *) hbp->data; hiagp = (struct iag *) hbp->data;
hiagp->inofreeback = hiagp->inofreeback = iagp->iagnum;
le32_to_cpu(iagp->iagnum);
iagp->inofreefwd = cpu_to_le32(head); iagp->inofreefwd = cpu_to_le32(head);
iagp->inofreeback = -1; iagp->inofreeback = cpu_to_le32(-1);
write_metapage(hbp); write_metapage(hbp);
} }
...@@ -2996,9 +2996,10 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) ...@@ -2996,9 +2996,10 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* if any free extents, insert at AG free extent list */ /* if any free extents, insert at AG free extent list */
if (le32_to_cpu(iagp->nfreeexts) > 0) { if (le32_to_cpu(iagp->nfreeexts) > 0) {
if ((head = imap->im_agctl[n].extfree) == -1) if ((head = imap->im_agctl[n].extfree) == -1) {
iagp->extfreefwd = iagp->extfreeback = -1; iagp->extfreefwd = cpu_to_le32(-1);
else { iagp->extfreeback = cpu_to_le32(-1);
} else {
if ((rc = diIAGRead(imap, head, &hbp))) { if ((rc = diIAGRead(imap, head, &hbp))) {
rcx = rc; rcx = rc;
goto nextiag; goto nextiag;
...@@ -3006,7 +3007,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) ...@@ -3006,7 +3007,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
hiagp = (struct iag *) hbp->data; hiagp = (struct iag *) hbp->data;
hiagp->extfreeback = iagp->iagnum; hiagp->extfreeback = iagp->iagnum;
iagp->extfreefwd = cpu_to_le32(head); iagp->extfreefwd = cpu_to_le32(head);
iagp->extfreeback = -1; iagp->extfreeback = cpu_to_le32(-1);
write_metapage(hbp); write_metapage(hbp);
} }
...@@ -3053,7 +3054,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, ...@@ -3053,7 +3054,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
if (readSuper(sb, &bh)) if (readSuper(sb, &bh))
return; return;
j_sb = (struct jfs_superblock *)bh->b_data; j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_flag |= JFS_BAD_SAIT; j_sb->s_flag |= cpu_to_le32(JFS_BAD_SAIT);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
......
...@@ -60,16 +60,16 @@ ...@@ -60,16 +60,16 @@
* inode allocation group page (per 4096 inodes of an AG) * inode allocation group page (per 4096 inodes of an AG)
*/ */
struct iag { struct iag {
s64 agstart; /* 8: starting block of ag */ __le64 agstart; /* 8: starting block of ag */
s32 iagnum; /* 4: inode allocation group number */ __le32 iagnum; /* 4: inode allocation group number */
s32 inofreefwd; /* 4: ag inode free list forward */ __le32 inofreefwd; /* 4: ag inode free list forward */
s32 inofreeback; /* 4: ag inode free list back */ __le32 inofreeback; /* 4: ag inode free list back */
s32 extfreefwd; /* 4: ag inode extent free list forward */ __le32 extfreefwd; /* 4: ag inode extent free list forward */
s32 extfreeback; /* 4: ag inode extent free list back */ __le32 extfreeback; /* 4: ag inode extent free list back */
s32 iagfree; /* 4: iag free list */ __le32 iagfree; /* 4: iag free list */
/* summary map: 1 bit per inode extent */ /* summary map: 1 bit per inode extent */
s32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes; __le32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes;
* note: this indicates free and backed * note: this indicates free and backed
* inodes, if the extent is not backed the * inodes, if the extent is not backed the
* value will be 1. if the extent is * value will be 1. if the extent is
...@@ -78,43 +78,61 @@ struct iag { ...@@ -78,43 +78,61 @@ struct iag {
* backed but at least one of the inodes is * backed but at least one of the inodes is
* free the value will be 0. * free the value will be 0.
*/ */
s32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */ __le32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */
s32 nfreeinos; /* 4: number of free inodes */ __le32 nfreeinos; /* 4: number of free inodes */
s32 nfreeexts; /* 4: number of free extents */ __le32 nfreeexts; /* 4: number of free extents */
/* (72) */ /* (72) */
u8 pad[1976]; /* 1976: pad to 2048 bytes */ u8 pad[1976]; /* 1976: pad to 2048 bytes */
/* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */ /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */
u32 wmap[EXTSPERIAG]; /* 512: working allocation map */ __le32 wmap[EXTSPERIAG]; /* 512: working allocation map */
u32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */ __le32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */
pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */ pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */
}; /* (4096) */ }; /* (4096) */
/* /*
* per AG control information (in inode map control page) * per AG control information (in inode map control page)
*/ */
struct iagctl { struct iagctl_disk {
s32 inofree; /* 4: free inode list anchor */ __le32 inofree; /* 4: free inode list anchor */
s32 extfree; /* 4: free extent list anchor */ __le32 extfree; /* 4: free extent list anchor */
s32 numinos; /* 4: number of backed inodes */ __le32 numinos; /* 4: number of backed inodes */
s32 numfree; /* 4: number of free inodes */ __le32 numfree; /* 4: number of free inodes */
}; /* (16) */ }; /* (16) */
struct iagctl {
int inofree; /* free inode list anchor */
int extfree; /* free extent list anchor */
int numinos; /* number of backed inodes */
int numfree; /* number of free inodes */
};
/* /*
* per fileset/aggregate inode map control page * per fileset/aggregate inode map control page
*/ */
struct dinomap { struct dinomap_disk {
s32 in_freeiag; /* 4: free iag list anchor */ __le32 in_freeiag; /* 4: free iag list anchor */
s32 in_nextiag; /* 4: next free iag number */ __le32 in_nextiag; /* 4: next free iag number */
s32 in_numinos; /* 4: num of backed inodes */ __le32 in_numinos; /* 4: num of backed inodes */
s32 in_numfree; /* 4: num of free backed inodes */ __le32 in_numfree; /* 4: num of free backed inodes */
s32 in_nbperiext; /* 4: num of blocks per inode extent */ __le32 in_nbperiext; /* 4: num of blocks per inode extent */
s32 in_l2nbperiext; /* 4: l2 of in_nbperiext */ __le32 in_l2nbperiext; /* 4: l2 of in_nbperiext */
s32 in_diskblock; /* 4: for standalone test driver */ __le32 in_diskblock; /* 4: for standalone test driver */
s32 in_maxag; /* 4: for standalone test driver */ __le32 in_maxag; /* 4: for standalone test driver */
u8 pad[2016]; /* 2016: pad to 2048 */ u8 pad[2016]; /* 2016: pad to 2048 */
struct iagctl in_agctl[MAXAG]; /* 2048: AG control information */ struct iagctl_disk in_agctl[MAXAG]; /* 2048: AG control information */
}; /* (4096) */ }; /* (4096) */
struct dinomap {
int in_freeiag; /* free iag list anchor */
int in_nextiag; /* next free iag number */
int in_numinos; /* num of backed inodes */
int in_numfree; /* num of free backed inodes */
int in_nbperiext; /* num of blocks per inode extent */
int in_l2nbperiext; /* l2 of in_nbperiext */
int in_diskblock; /* for standalone test driver */
int in_maxag; /* for standalone test driver */
struct iagctl in_agctl[MAXAG]; /* AG control information */
};
/* /*
* In-core inode map control page * In-core inode map control page
......
...@@ -161,9 +161,9 @@ do { \ ...@@ -161,9 +161,9 @@ do { \
/* /*
* Global list of active external journals * Global list of active external journals
*/ */
LIST_HEAD(jfs_external_logs); static LIST_HEAD(jfs_external_logs);
struct jfs_log *dummy_log = NULL; static struct jfs_log *dummy_log = NULL;
DECLARE_MUTEX(jfs_log_sem); static DECLARE_MUTEX(jfs_log_sem);
/* /*
* external references * external references
...@@ -205,7 +205,7 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait); ...@@ -205,7 +205,7 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait);
* statistics * statistics
*/ */
#ifdef CONFIG_JFS_STATISTICS #ifdef CONFIG_JFS_STATISTICS
struct lmStat { static struct lmStat {
uint commit; /* # of commit */ uint commit; /* # of commit */
uint pagedone; /* # of page written */ uint pagedone; /* # of page written */
uint submitted; /* # of pages submitted */ uint submitted; /* # of pages submitted */
...@@ -1435,6 +1435,8 @@ int lmLogInit(struct jfs_log * log) ...@@ -1435,6 +1435,8 @@ int lmLogInit(struct jfs_log * log)
* unwind on error * unwind on error
*/ */
errout30: /* release log page */ errout30: /* release log page */
log->wqueue = NULL;
bp->l_wqnext = NULL;
lbmFree(bp); lbmFree(bp);
errout20: /* release log superblock */ errout20: /* release log superblock */
......
...@@ -62,17 +62,17 @@ ...@@ -62,17 +62,17 @@
#define MAX_ACTIVE 128 /* Max active file systems sharing log */ #define MAX_ACTIVE 128 /* Max active file systems sharing log */
struct logsuper { struct logsuper {
u32 magic; /* 4: log lv identifier */ __le32 magic; /* 4: log lv identifier */
s32 version; /* 4: version number */ __le32 version; /* 4: version number */
s32 serial; /* 4: log open/mount counter */ __le32 serial; /* 4: log open/mount counter */
s32 size; /* 4: size in number of LOGPSIZE blocks */ __le32 size; /* 4: size in number of LOGPSIZE blocks */
s32 bsize; /* 4: logical block size in byte */ __le32 bsize; /* 4: logical block size in byte */
s32 l2bsize; /* 4: log2 of bsize */ __le32 l2bsize; /* 4: log2 of bsize */
u32 flag; /* 4: option */ __le32 flag; /* 4: option */
u32 state; /* 4: state - see below */ __le32 state; /* 4: state - see below */
s32 end; /* 4: addr of last log record set by logredo */ __le32 end; /* 4: addr of last log record set by logredo */
char uuid[16]; /* 16: 128-bit journal uuid */ char uuid[16]; /* 16: 128-bit journal uuid */
char label[16]; /* 16: journal label */ char label[16]; /* 16: journal label */
struct { struct {
...@@ -121,17 +121,17 @@ struct logsuper { ...@@ -121,17 +121,17 @@ struct logsuper {
*/ */
struct logpage { struct logpage {
struct { /* header */ struct { /* header */
s32 page; /* 4: log sequence page number */ __le32 page; /* 4: log sequence page number */
s16 rsrvd; /* 2: */ __le16 rsrvd; /* 2: */
s16 eor; /* 2: end-of-log offset of lasrt record write */ __le16 eor; /* 2: end-of-log offset of lasrt record write */
} h; } h;
s32 data[LOGPSIZE / 4 - 4]; /* log record area */ __le32 data[LOGPSIZE / 4 - 4]; /* log record area */
struct { /* trailer */ struct { /* trailer */
s32 page; /* 4: normally the same as h.page */ __le32 page; /* 4: normally the same as h.page */
s16 rsrvd; /* 2: */ __le16 rsrvd; /* 2: */
s16 eor; /* 2: normally the same as h.eor */ __le16 eor; /* 2: normally the same as h.eor */
} t; } t;
}; };
...@@ -202,11 +202,11 @@ struct lrd { ...@@ -202,11 +202,11 @@ struct lrd {
/* /*
* type independent area * type independent area
*/ */
s32 logtid; /* 4: log transaction identifier */ __le32 logtid; /* 4: log transaction identifier */
s32 backchain; /* 4: ptr to prev record of same transaction */ __le32 backchain; /* 4: ptr to prev record of same transaction */
u16 type; /* 2: record type */ __le16 type; /* 2: record type */
s16 length; /* 2: length of data in record (in byte) */ __le16 length; /* 2: length of data in record (in byte) */
u32 aggregate; /* 4: file system lv/aggregate */ __le32 aggregate; /* 4: file system lv/aggregate */
/* (16) */ /* (16) */
/* /*
...@@ -228,10 +228,10 @@ struct lrd { ...@@ -228,10 +228,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format; * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/ */
struct { struct {
u32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
u32 inode; /* 4: inode number */ __le32 inode; /* 4: inode number */
u16 type; /* 2: REDOPAGE record type */ __le16 type; /* 2: REDOPAGE record type */
s16 l2linesize; /* 2: log2 of line size */ __le16 l2linesize; /* 2: log2 of line size */
pxd_t pxd; /* 8: on-disk page pxd */ pxd_t pxd; /* 8: on-disk page pxd */
} redopage; /* (20) */ } redopage; /* (20) */
...@@ -244,10 +244,10 @@ struct lrd { ...@@ -244,10 +244,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format; * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/ */
struct { struct {
s32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
u32 inode; /* 4: inode number */ __le32 inode; /* 4: inode number */
u16 type; /* 2: NOREDOPAGE record type */ __le16 type; /* 2: NOREDOPAGE record type */
s16 rsrvd; /* 2: reserved */ __le16 rsrvd; /* 2: reserved */
pxd_t pxd; /* 8: on-disk page pxd */ pxd_t pxd; /* 8: on-disk page pxd */
} noredopage; /* (20) */ } noredopage; /* (20) */
...@@ -260,10 +260,10 @@ struct lrd { ...@@ -260,10 +260,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format; * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/ */
struct { struct {
u32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
u32 inode; /* 4: inode number */ __le32 inode; /* 4: inode number */
u16 type; /* 2: UPDATEMAP record type */ __le16 type; /* 2: UPDATEMAP record type */
s16 nxd; /* 2: number of extents */ __le16 nxd; /* 2: number of extents */
pxd_t pxd; /* 8: pxd */ pxd_t pxd; /* 8: pxd */
} updatemap; /* (20) */ } updatemap; /* (20) */
...@@ -279,9 +279,9 @@ struct lrd { ...@@ -279,9 +279,9 @@ struct lrd {
* *
*/ */
struct { struct {
s32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
s32 iagnum; /* 4: IAG number */ __le32 iagnum; /* 4: IAG number */
s32 inoext_idx; /* 4: inode extent index */ __le32 inoext_idx; /* 4: inode extent index */
pxd_t pxd; /* 8: on-disk page pxd */ pxd_t pxd; /* 8: on-disk page pxd */
} noredoinoext; /* (20) */ } noredoinoext; /* (20) */
...@@ -291,7 +291,7 @@ struct lrd { ...@@ -291,7 +291,7 @@ struct lrd {
* replay log upto syncpt address specified; * replay log upto syncpt address specified;
*/ */
struct { struct {
s32 sync; /* 4: syncpt address (0 = here) */ __le32 sync; /* 4: syncpt address (0 = here) */
} syncpt; } syncpt;
/* /*
...@@ -307,8 +307,8 @@ struct lrd { ...@@ -307,8 +307,8 @@ struct lrd {
* N.B.: nextents should be length of data/sizeof(xad_t) * N.B.: nextents should be length of data/sizeof(xad_t)
*/ */
struct { struct {
s32 type; /* 4: FREEXTENT record type */ __le32 type; /* 4: FREEXTENT record type */
s32 nextent; /* 4: number of extents */ __le32 nextent; /* 4: number of extents */
/* data: PXD or XAD list */ /* data: PXD or XAD list */
} freextent; } freextent;
...@@ -327,8 +327,8 @@ struct lrd { ...@@ -327,8 +327,8 @@ struct lrd {
* replay of the * replay of the
*/ */
struct { struct {
s32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
u32 inode; /* 4: inode number */ __le32 inode; /* 4: inode number */
} noredofile; } noredofile;
/* /*
...@@ -337,9 +337,9 @@ struct lrd { ...@@ -337,9 +337,9 @@ struct lrd {
* metadata type dependent * metadata type dependent
*/ */
struct { struct {
s32 fileset; /* 4: fileset number */ __le32 fileset; /* 4: fileset number */
u32 inode; /* 4: inode number */ __le32 inode; /* 4: inode number */
s32 type; /* 4: NEWPAGE record type */ __le32 type; /* 4: NEWPAGE record type */
pxd_t pxd; /* 8: on-disk page pxd */ pxd_t pxd; /* 8: on-disk page pxd */
} newpage; } newpage;
...@@ -357,8 +357,8 @@ struct lrd { ...@@ -357,8 +357,8 @@ struct lrd {
* line vector descriptor * line vector descriptor
*/ */
struct lvd { struct lvd {
s16 offset; __le16 offset;
s16 length; __le16 length;
}; };
...@@ -372,7 +372,7 @@ struct jfs_log { ...@@ -372,7 +372,7 @@ struct jfs_log {
*/ */
struct list_head journal_list; /* Global list */ struct list_head journal_list; /* Global list */
struct block_device *bdev; /* 4: log lv pointer */ struct block_device *bdev; /* 4: log lv pointer */
s32 serial; /* 4: log mount serial number */ int serial; /* 4: log mount serial number */
s64 base; /* @8: log extent address (inline log ) */ s64 base; /* @8: log extent address (inline log ) */
int size; /* 4: log size in log page (in page) */ int size; /* 4: log size in log page (in page) */
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED; static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED;
#ifdef CONFIG_JFS_STATISTICS #ifdef CONFIG_JFS_STATISTICS
struct { static struct {
uint pagealloc; /* # of page allocations */ uint pagealloc; /* # of page allocations */
uint pagefree; /* # of page frees */ uint pagefree; /* # of page frees */
uint lockwait; /* # of sleeping lock_metapage() calls */ uint lockwait; /* # of sleeping lock_metapage() calls */
...@@ -108,9 +108,9 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) ...@@ -108,9 +108,9 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
} }
} }
static inline struct metapage *alloc_metapage(int no_wait) static inline struct metapage *alloc_metapage(int gfp_mask)
{ {
return mempool_alloc(metapage_mempool, no_wait ? GFP_ATOMIC : GFP_NOFS); return mempool_alloc(metapage_mempool, gfp_mask);
} }
static inline void free_metapage(struct metapage *mp) static inline void free_metapage(struct metapage *mp)
...@@ -289,7 +289,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, ...@@ -289,7 +289,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
*/ */
mp = NULL; mp = NULL;
if (JFS_IP(inode)->fileset == AGGREGATE_I) { if (JFS_IP(inode)->fileset == AGGREGATE_I) {
mp = mempool_alloc(metapage_mempool, GFP_ATOMIC); mp = alloc_metapage(GFP_ATOMIC);
if (!mp) { if (!mp) {
/* /*
* mempool is supposed to protect us from * mempool is supposed to protect us from
...@@ -306,7 +306,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, ...@@ -306,7 +306,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
struct metapage *mp2; struct metapage *mp2;
spin_unlock(&meta_lock); spin_unlock(&meta_lock);
mp = mempool_alloc(metapage_mempool, GFP_NOFS); mp = alloc_metapage(GFP_NOFS);
spin_lock(&meta_lock); spin_lock(&meta_lock);
/* we dropped the meta_lock, we need to search the /* we dropped the meta_lock, we need to search the
......
...@@ -324,7 +324,7 @@ static int chkSuper(struct super_block *sb) ...@@ -324,7 +324,7 @@ static int chkSuper(struct super_block *sb)
*/ */
/* validate fs signature */ /* validate fs signature */
if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) || if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) ||
j_sb->s_version > cpu_to_le32(JFS_VERSION)) { le32_to_cpu(j_sb->s_version) > JFS_VERSION) {
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
......
...@@ -35,29 +35,29 @@ ...@@ -35,29 +35,29 @@
*/ */
struct jfs_superblock { struct jfs_superblock {
char s_magic[4]; /* 4: magic number */ char s_magic[4]; /* 4: magic number */
u32 s_version; /* 4: version number */ __le32 s_version; /* 4: version number */
s64 s_size; /* 8: aggregate size in hardware/LVM blocks; __le64 s_size; /* 8: aggregate size in hardware/LVM blocks;
* VFS: number of blocks * VFS: number of blocks
*/ */
s32 s_bsize; /* 4: aggregate block size in bytes; __le32 s_bsize; /* 4: aggregate block size in bytes;
* VFS: fragment size * VFS: fragment size
*/ */
s16 s_l2bsize; /* 2: log2 of s_bsize */ __le16 s_l2bsize; /* 2: log2 of s_bsize */
s16 s_l2bfactor; /* 2: log2(s_bsize/hardware block size) */ __le16 s_l2bfactor; /* 2: log2(s_bsize/hardware block size) */
s32 s_pbsize; /* 4: hardware/LVM block size in bytes */ __le32 s_pbsize; /* 4: hardware/LVM block size in bytes */
s16 s_l2pbsize; /* 2: log2 of s_pbsize */ __le16 s_l2pbsize; /* 2: log2 of s_pbsize */
s16 pad; /* 2: padding necessary for alignment */ __le16 pad; /* 2: padding necessary for alignment */
u32 s_agsize; /* 4: allocation group size in aggr. blocks */ __le32 s_agsize; /* 4: allocation group size in aggr. blocks */
u32 s_flag; /* 4: aggregate attributes: __le32 s_flag; /* 4: aggregate attributes:
* see jfs_filsys.h * see jfs_filsys.h
*/ */
u32 s_state; /* 4: mount/unmount/recovery state: __le32 s_state; /* 4: mount/unmount/recovery state:
* see jfs_filsys.h * see jfs_filsys.h
*/ */
s32 s_compress; /* 4: > 0 if data compression */ __le32 s_compress; /* 4: > 0 if data compression */
pxd_t s_ait2; /* 8: first extent of secondary pxd_t s_ait2; /* 8: first extent of secondary
* aggregate inode table * aggregate inode table
...@@ -66,15 +66,15 @@ struct jfs_superblock { ...@@ -66,15 +66,15 @@ struct jfs_superblock {
pxd_t s_aim2; /* 8: first extent of secondary pxd_t s_aim2; /* 8: first extent of secondary
* aggregate inode map * aggregate inode map
*/ */
u32 s_logdev; /* 4: device address of log */ __le32 s_logdev; /* 4: device address of log */
s32 s_logserial; /* 4: log serial number at aggregate mount */ __le32 s_logserial; /* 4: log serial number at aggregate mount */
pxd_t s_logpxd; /* 8: inline log extent */ pxd_t s_logpxd; /* 8: inline log extent */
pxd_t s_fsckpxd; /* 8: inline fsck work space extent */ pxd_t s_fsckpxd; /* 8: inline fsck work space extent */
struct timestruc_t s_time; /* 8: time last updated */ struct timestruc_t s_time; /* 8: time last updated */
s32 s_fsckloglen; /* 4: Number of filesystem blocks reserved for __le32 s_fsckloglen; /* 4: Number of filesystem blocks reserved for
* the fsck service log. * the fsck service log.
* N.B. These blocks are divided among the * N.B. These blocks are divided among the
* versions kept. This is not a per * versions kept. This is not a per
...@@ -95,7 +95,7 @@ struct jfs_superblock { ...@@ -95,7 +95,7 @@ struct jfs_superblock {
*/ */
/* extendfs() parameter under s_state & FM_EXTENDFS */ /* extendfs() parameter under s_state & FM_EXTENDFS */
s64 s_xsize; /* 8: extendfs s_size */ __le64 s_xsize; /* 8: extendfs s_size */
pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */ pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */
pxd_t s_xlogpxd; /* 8: extendfs logpxd */ pxd_t s_xlogpxd; /* 8: extendfs logpxd */
/* - 128 byte boundary - */ /* - 128 byte boundary - */
......
...@@ -80,7 +80,7 @@ static struct { ...@@ -80,7 +80,7 @@ static struct {
int jfs_tlocks_low; /* Indicates low number of available tlocks */ int jfs_tlocks_low; /* Indicates low number of available tlocks */
#ifdef CONFIG_JFS_STATISTICS #ifdef CONFIG_JFS_STATISTICS
struct { static struct {
uint txBegin; uint txBegin;
uint txBegin_barrier; uint txBegin_barrier;
uint txBegin_lockslow; uint txBegin_lockslow;
...@@ -152,7 +152,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event) ...@@ -152,7 +152,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
/* /*
* statistics * statistics
*/ */
struct { static struct {
tid_t maxtid; /* 4: biggest tid ever used */ tid_t maxtid; /* 4: biggest tid ever used */
lid_t maxlid; /* 4: biggest lid ever used */ lid_t maxlid; /* 4: biggest lid ever used */
int ntid; /* 4: # of transactions performed */ int ntid; /* 4: # of transactions performed */
......
...@@ -45,8 +45,8 @@ typedef u16 lid_t; ...@@ -45,8 +45,8 @@ typedef u16 lid_t;
* Almost identical to Linux's timespec, but not quite * Almost identical to Linux's timespec, but not quite
*/ */
struct timestruc_t { struct timestruc_t {
u32 tv_sec; __le32 tv_sec;
u32 tv_nsec; __le32 tv_nsec;
}; };
/* /*
...@@ -96,7 +96,7 @@ struct lxdlist { ...@@ -96,7 +96,7 @@ struct lxdlist {
typedef struct { typedef struct {
unsigned len:24; unsigned len:24;
unsigned addr1:8; unsigned addr1:8;
u32 addr2; __le32 addr2;
} pxd_t; } pxd_t;
/* xd_t field construction */ /* xd_t field construction */
...@@ -127,11 +127,11 @@ struct pxdlist { ...@@ -127,11 +127,11 @@ struct pxdlist {
*/ */
typedef struct { typedef struct {
unsigned flag:8; /* 1: flags */ unsigned flag:8; /* 1: flags */
unsigned rsrvd:24; /* 3: */ unsigned rsrvd:24;
u32 size; /* 4: size in byte */ __le32 size; /* 4: size in byte */
unsigned len:24; /* 3: length in unit of fsblksize */ unsigned len:24; /* 3: length in unit of fsblksize */
unsigned addr1:8; /* 1: address in unit of fsblksize */ unsigned addr1:8; /* 1: address in unit of fsblksize */
u32 addr2; /* 4: address in unit of fsblksize */ __le32 addr2; /* 4: address in unit of fsblksize */
} dxd_t; /* - 16 - */ } dxd_t; /* - 16 - */
/* dxd_t flags */ /* dxd_t flags */
...@@ -168,10 +168,10 @@ struct dasd { ...@@ -168,10 +168,10 @@ struct dasd {
u8 delta; /* Alert Threshold delta (in percent) */ u8 delta; /* Alert Threshold delta (in percent) */
u8 rsrvd1; u8 rsrvd1;
u8 limit_hi; /* DASD limit (in logical blocks) */ u8 limit_hi; /* DASD limit (in logical blocks) */
u32 limit_lo; /* DASD limit (in logical blocks) */ __le32 limit_lo; /* DASD limit (in logical blocks) */
u8 rsrvd2[3]; u8 rsrvd2[3];
u8 used_hi; /* DASD usage (in logical blocks) */ u8 used_hi; /* DASD usage (in logical blocks) */
u32 used_lo; /* DASD usage (in logical blocks) */ __le32 used_lo; /* DASD usage (in logical blocks) */
}; };
#define DASDLIMIT(dasdp) \ #define DASDLIMIT(dasdp) \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* FUNCTION: Convert little-endian unicode string to character string * FUNCTION: Convert little-endian unicode string to character string
* *
*/ */
int jfs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ int jfs_strfromUCS_le(char *to, const __le16 * from,
int len, struct nls_table *codepage) int len, struct nls_table *codepage)
{ {
int i; int i;
......
...@@ -31,7 +31,7 @@ typedef struct { ...@@ -31,7 +31,7 @@ typedef struct {
extern signed char UniUpperTable[512]; extern signed char UniUpperTable[512];
extern UNICASERANGE UniUpperRange[]; extern UNICASERANGE UniUpperRange[];
extern int get_UCSname(struct component_name *, struct dentry *); extern int get_UCSname(struct component_name *, struct dentry *);
extern int jfs_strfromUCS_le(char *, const wchar_t *, int, struct nls_table *); extern int jfs_strfromUCS_le(char *, const __le16 *, int, struct nls_table *);
#define free_UCSname(COMP) kfree((COMP)->name) #define free_UCSname(COMP) kfree((COMP)->name)
...@@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) ...@@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
/* /*
* UniStrncpy: Copy length limited string with pad * UniStrncpy: Copy length limited string with pad
*/ */
static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, static inline __le16 *UniStrncpy_le(__le16 * ucs1, const __le16 * ucs2,
size_t n) size_t n)
{ {
wchar_t *anchor = ucs1; __le16 *anchor = ucs1;
while (n-- && *ucs2) /* Copy the strings */ while (n-- && *ucs2) /* Copy the strings */
*ucs1++ = *ucs2++; *ucs1++ = *ucs2++;
...@@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, ...@@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2,
/* /*
* UniStrncmp_le: Compare length limited string - native to little-endian * UniStrncmp_le: Compare length limited string - native to little-endian
*/ */
static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, static inline int UniStrncmp_le(const wchar_t * ucs1, const __le16 * ucs2,
size_t n) size_t n)
{ {
if (!n) if (!n)
...@@ -81,9 +81,26 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, ...@@ -81,9 +81,26 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2,
} }
/* /*
* UniStrncpy_le: Copy length limited string with pad to little-endian * UniStrncpy_to_le: Copy length limited string with pad to little-endian
*/ */
static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, static inline __le16 *UniStrncpy_to_le(__le16 * ucs1, const wchar_t * ucs2,
size_t n)
{
__le16 *anchor = ucs1;
while (n-- && *ucs2) /* Copy the strings */
*ucs1++ = cpu_to_le16(*ucs2++);
n++;
while (n--) /* Pad with nulls */
*ucs1++ = 0;
return anchor;
}
/*
* UniStrncpy_from_le: Copy length limited string with pad from little-endian
*/
static inline wchar_t *UniStrncpy_from_le(wchar_t * ucs1, const __le16 * ucs2,
size_t n) size_t n)
{ {
wchar_t *anchor = ucs1; wchar_t *anchor = ucs1;
...@@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, ...@@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2,
return anchor; return anchor;
} }
/* /*
* UniToupper: Convert a unicode character to upper case * UniToupper: Convert a unicode character to upper case
*/ */
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
struct jfs_ea { struct jfs_ea {
u8 flag; /* Unused? */ u8 flag; /* Unused? */
u8 namelen; /* Length of name */ u8 namelen; /* Length of name */
u16 valuelen; /* Length of value */ __le16 valuelen; /* Length of value */
char name[0]; /* Attribute name (includes null-terminator) */ char name[0]; /* Attribute name (includes null-terminator) */
}; /* Value immediately follows name */ }; /* Value immediately follows name */
struct jfs_ea_list { struct jfs_ea_list {
u32 size; /* overall size */ __le32 size; /* overall size */
struct jfs_ea ea[0]; /* Variable length list */ struct jfs_ea ea[0]; /* Variable length list */
}; };
......
...@@ -958,7 +958,7 @@ xtSplitUp(tid_t tid, ...@@ -958,7 +958,7 @@ xtSplitUp(tid_t tid,
/* is inode xtree root extension/inline EA area free ? */ /* is inode xtree root extension/inline EA area free ? */
if ((sp->header.flag & BT_ROOT) && (!S_ISDIR(ip->i_mode)) && if ((sp->header.flag & BT_ROOT) && (!S_ISDIR(ip->i_mode)) &&
(sp->header.maxentry < cpu_to_le16(XTROOTMAXSLOT)) && (le16_to_cpu(sp->header.maxentry) < XTROOTMAXSLOT) &&
(JFS_IP(ip)->mode2 & INLINEEA)) { (JFS_IP(ip)->mode2 & INLINEEA)) {
sp->header.maxentry = cpu_to_le16(XTROOTMAXSLOT); sp->header.maxentry = cpu_to_le16(XTROOTMAXSLOT);
JFS_IP(ip)->mode2 &= ~INLINEEA; JFS_IP(ip)->mode2 &= ~INLINEEA;
...@@ -1622,7 +1622,6 @@ int xtExtend(tid_t tid, /* transaction id */ ...@@ -1622,7 +1622,6 @@ int xtExtend(tid_t tid, /* transaction id */
s64 xaddr; s64 xaddr;
struct tlock *tlck; struct tlock *tlck;
struct xtlock *xtlck = NULL; struct xtlock *xtlck = NULL;
int rootsplit = 0;
jfs_info("xtExtend: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen); jfs_info("xtExtend: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen);
...@@ -1678,8 +1677,6 @@ int xtExtend(tid_t tid, /* transaction id */ ...@@ -1678,8 +1677,6 @@ int xtExtend(tid_t tid, /* transaction id */
* The xtSplitUp() will insert the entry and unpin the leaf page. * The xtSplitUp() will insert the entry and unpin the leaf page.
*/ */
if (nextindex == le16_to_cpu(p->header.maxentry)) { if (nextindex == le16_to_cpu(p->header.maxentry)) {
rootsplit = p->header.flag & BT_ROOT;
/* xtSpliUp() unpins leaf pages */ /* xtSpliUp() unpins leaf pages */
split.mp = mp; split.mp = mp;
split.index = index + 1; split.index = index + 1;
...@@ -1691,16 +1688,21 @@ int xtExtend(tid_t tid, /* transaction id */ ...@@ -1691,16 +1688,21 @@ int xtExtend(tid_t tid, /* transaction id */
if ((rc = xtSplitUp(tid, ip, &split, &btstack))) if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
return rc; return rc;
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* /*
* if leaf root has been split, original root has been * if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now * copied to new child page, i.e., original entry now
* resides on the new child page; * resides on the new child page;
*/ */
if (rootsplit) { if (p->header.flag & BT_INTERNAL) {
ASSERT(p->header.nextindex == ASSERT(p->header.nextindex ==
cpu_to_le16(XTENTRYSTART + 1)); cpu_to_le16(XTENTRYSTART + 1));
xad = &p->xad[XTENTRYSTART]; xad = &p->xad[XTENTRYSTART];
bn = addressXAD(xad); bn = addressXAD(xad);
XT_PUTPAGE(mp);
/* get new child page */ /* get new child page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
...@@ -1712,11 +1714,6 @@ int xtExtend(tid_t tid, /* transaction id */ ...@@ -1712,11 +1714,6 @@ int xtExtend(tid_t tid, /* transaction id */
tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
xtlck = (struct xtlock *) & tlck->lock; xtlck = (struct xtlock *) & tlck->lock;
} }
} else {
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
} }
} }
/* /*
...@@ -1790,7 +1787,6 @@ int xtTailgate(tid_t tid, /* transaction id */ ...@@ -1790,7 +1787,6 @@ int xtTailgate(tid_t tid, /* transaction id */
struct xtlock *xtlck = 0; struct xtlock *xtlck = 0;
struct tlock *mtlck; struct tlock *mtlck;
struct maplock *pxdlock; struct maplock *pxdlock;
int rootsplit = 0;
/* /*
printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n", printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
...@@ -1848,8 +1844,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", ...@@ -1848,8 +1844,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
* The xtSplitUp() will insert the entry and unpin the leaf page. * The xtSplitUp() will insert the entry and unpin the leaf page.
*/ */
if (nextindex == le16_to_cpu(p->header.maxentry)) { if (nextindex == le16_to_cpu(p->header.maxentry)) {
rootsplit = p->header.flag & BT_ROOT;
/* xtSpliUp() unpins leaf pages */ /* xtSpliUp() unpins leaf pages */
split.mp = mp; split.mp = mp;
split.index = index + 1; split.index = index + 1;
...@@ -1861,16 +1855,21 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", ...@@ -1861,16 +1855,21 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
if ((rc = xtSplitUp(tid, ip, &split, &btstack))) if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
return rc; return rc;
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* /*
* if leaf root has been split, original root has been * if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now * copied to new child page, i.e., original entry now
* resides on the new child page; * resides on the new child page;
*/ */
if (rootsplit) { if (p->header.flag & BT_INTERNAL) {
ASSERT(p->header.nextindex == ASSERT(p->header.nextindex ==
cpu_to_le16(XTENTRYSTART + 1)); cpu_to_le16(XTENTRYSTART + 1));
xad = &p->xad[XTENTRYSTART]; xad = &p->xad[XTENTRYSTART];
bn = addressXAD(xad); bn = addressXAD(xad);
XT_PUTPAGE(mp);
/* get new child page */ /* get new child page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
...@@ -1882,11 +1881,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", ...@@ -1882,11 +1881,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
xtlck = (struct xtlock *) & tlck->lock; xtlck = (struct xtlock *) & tlck->lock;
} }
} else {
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
} }
} }
/* /*
...@@ -1976,7 +1970,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) ...@@ -1976,7 +1970,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
s64 nxaddr, xaddr; s64 nxaddr, xaddr;
struct tlock *tlck; struct tlock *tlck;
struct xtlock *xtlck = NULL; struct xtlock *xtlck = NULL;
int rootsplit = 0, newpage = 0; int newpage = 0;
/* there must exist extent to be tailgated */ /* there must exist extent to be tailgated */
nxoff = offsetXAD(nxad); nxoff = offsetXAD(nxad);
...@@ -2183,7 +2177,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) ...@@ -2183,7 +2177,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
/* insert nXAD:recorded */ /* insert nXAD:recorded */
if (nextindex == le16_to_cpu(p->header.maxentry)) { if (nextindex == le16_to_cpu(p->header.maxentry)) {
rootsplit = p->header.flag & BT_ROOT;
/* xtSpliUp() unpins leaf pages */ /* xtSpliUp() unpins leaf pages */
split.mp = mp; split.mp = mp;
...@@ -2196,16 +2189,21 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) ...@@ -2196,16 +2189,21 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
if ((rc = xtSplitUp(tid, ip, &split, &btstack))) if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
return rc; return rc;
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* /*
* if leaf root has been split, original root has been * if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now * copied to new child page, i.e., original entry now
* resides on the new child page; * resides on the new child page;
*/ */
if (rootsplit) { if (p->header.flag & BT_INTERNAL) {
ASSERT(p->header.nextindex == ASSERT(p->header.nextindex ==
cpu_to_le16(XTENTRYSTART + 1)); cpu_to_le16(XTENTRYSTART + 1));
xad = &p->xad[XTENTRYSTART]; xad = &p->xad[XTENTRYSTART];
bn = addressXAD(xad); bn = addressXAD(xad);
XT_PUTPAGE(mp);
/* get new child page */ /* get new child page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
...@@ -2218,11 +2216,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) ...@@ -2218,11 +2216,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
xtlck = (struct xtlock *) & tlck->lock; xtlck = (struct xtlock *) & tlck->lock;
} }
} else { } else {
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* is nXAD on new page ? */ /* is nXAD on new page ? */
if (newindex > if (newindex >
(le16_to_cpu(p->header.maxentry) >> 1)) { (le16_to_cpu(p->header.maxentry) >> 1)) {
...@@ -2336,8 +2329,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) ...@@ -2336,8 +2329,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
xlen = xlen - nxlen; xlen = xlen - nxlen;
xaddr = xaddr + nxlen; xaddr = xaddr + nxlen;
if (nextindex == le16_to_cpu(p->header.maxentry)) { if (nextindex == le16_to_cpu(p->header.maxentry)) {
rootsplit = p->header.flag & BT_ROOT;
/* /*
printf("xtUpdate.updateLeft.split p:0x%p\n", p); printf("xtUpdate.updateLeft.split p:0x%p\n", p);
*/ */
...@@ -2352,16 +2343,22 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p); ...@@ -2352,16 +2343,22 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
if ((rc = xtSplitUp(tid, ip, &split, &btstack))) if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
return rc; return rc;
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* /*
* if leaf root has been split, original root has been * if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now * copied to new child page, i.e., original entry now
* resides on the new child page; * resides on the new child page;
*/ */
if (rootsplit) { if (p->header.flag & BT_INTERNAL) {
ASSERT(p->header.nextindex == ASSERT(p->header.nextindex ==
cpu_to_le16(XTENTRYSTART + 1)); cpu_to_le16(XTENTRYSTART + 1));
xad = &p->xad[XTENTRYSTART]; xad = &p->xad[XTENTRYSTART];
bn = addressXAD(xad); bn = addressXAD(xad);
XT_PUTPAGE(mp);
/* get new child page */ /* get new child page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
...@@ -2373,11 +2370,6 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p); ...@@ -2373,11 +2370,6 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
xtlck = (struct xtlock *) & tlck->lock; xtlck = (struct xtlock *) & tlck->lock;
} }
} else {
/* get back old page */
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
} }
} else { } else {
/* if insert into middle, shift right remaining entries */ /* if insert into middle, shift right remaining entries */
......
...@@ -32,10 +32,10 @@ typedef struct xad { ...@@ -32,10 +32,10 @@ typedef struct xad {
unsigned flag:8; /* 1: flag */ unsigned flag:8; /* 1: flag */
unsigned rsvrd:16; /* 2: reserved */ unsigned rsvrd:16; /* 2: reserved */
unsigned off1:8; /* 1: offset in unit of fsblksize */ unsigned off1:8; /* 1: offset in unit of fsblksize */
u32 off2; /* 4: offset in unit of fsblksize */ __le32 off2; /* 4: offset in unit of fsblksize */
unsigned len:24; /* 3: length in unit of fsblksize */ unsigned len:24; /* 3: length in unit of fsblksize */
unsigned addr1:8; /* 1: address in unit of fsblksize */ unsigned addr1:8; /* 1: address in unit of fsblksize */
u32 addr2; /* 4: address in unit of fsblksize */ __le32 addr2; /* 4: address in unit of fsblksize */
} xad_t; /* (16) */ } xad_t; /* (16) */
#define MAXXLEN ((1 << 24) - 1) #define MAXXLEN ((1 << 24) - 1)
...@@ -90,14 +90,14 @@ struct xadlist { ...@@ -90,14 +90,14 @@ struct xadlist {
*/ */
typedef union { typedef union {
struct xtheader { struct xtheader {
s64 next; /* 8: */ __le64 next; /* 8: */
s64 prev; /* 8: */ __le64 prev; /* 8: */
u8 flag; /* 1: */ u8 flag; /* 1: */
u8 rsrvd1; /* 1: */ u8 rsrvd1; /* 1: */
s16 nextindex; /* 2: next index = number of entries */ __le16 nextindex; /* 2: next index = number of entries */
s16 maxentry; /* 2: max number of entries */ __le16 maxentry; /* 2: max number of entries */
s16 rsrvd2; /* 2: */ __le16 rsrvd2; /* 2: */
pxd_t self; /* 8: self */ pxd_t self; /* 8: self */
} header; /* (32) */ } header; /* (32) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment