X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fjfs_imap.c;h=0c1cde98c6ade01c784baee11b1f5b0fd53bf51a;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=084ec263361370b20eb0914d7e85f35c2aa675ee;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 084ec2633..0c1cde98c 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c @@ -132,7 +132,7 @@ int diMount(struct inode *ipimap) struct inomap *imap; struct metapage *mp; int index; - struct dinomap *dinom_le; + struct dinomap_disk *dinom_le; /* * allocate/initialize the in-memory inode map control structure @@ -155,7 +155,7 @@ int diMount(struct inode *ipimap) } /* 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_nextiag = le32_to_cpu(dinom_le->in_nextiag); atomic_set(&imap->im_numinos, le32_to_cpu(dinom_le->in_numinos)); @@ -243,7 +243,7 @@ int diUnmount(struct inode *ipimap, int mounterror) */ int diSync(struct inode *ipimap) { - struct dinomap *dinom_le; + struct dinomap_disk *dinom_le; struct inomap *imp = JFS_IP(ipimap)->i_imap; struct metapage *mp; int index; @@ -261,7 +261,7 @@ int diSync(struct inode *ipimap) } /* 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_nextiag = cpu_to_le32(imp->im_nextiag); dinom_le->in_numinos = cpu_to_le32(atomic_read(&imp->im_numinos)); @@ -1028,7 +1028,7 @@ int diFree(struct inode *ip) */ iagp->inofreefwd = cpu_to_le32(imap->im_agctl[agno].inofree); - iagp->inofreeback = -1; + iagp->inofreeback = cpu_to_le32(-1); imap->im_agctl[agno].inofree = iagno; } IREAD_UNLOCK(ipimap); @@ -1038,7 +1038,7 @@ int diFree(struct inode *ip) * inodes (i.e., the inode being freed is the first free * inode of extent), */ - if (iagp->wmap[extno] == ONES) { + if (iagp->wmap[extno] == cpu_to_le32(ONES)) { sword = extno >> L2EXTSPERSUM; bitno = extno & (EXTSPERSUM - 1); iagp->inosmap[sword] &= @@ -1186,7 +1186,7 @@ int diFree(struct inode *ip) iagp->extfreefwd = cpu_to_le32(imap->im_agctl[agno].extfree); - iagp->extfreeback = -1; + iagp->extfreeback = cpu_to_le32(-1); imap->im_agctl[agno].extfree = iagno; } else { /* remove the iag from the ag extent list if all extents @@ -1202,7 +1202,7 @@ int diFree(struct inode *ip) imap->im_agctl[agno].extfree = le32_to_cpu(iagp->extfreefwd); - iagp->extfreefwd = iagp->extfreeback = -1; + iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1); IAGFREE_LOCK(imap); iagp->iagfree = cpu_to_le32(imap->im_freeiag); @@ -1224,7 +1224,7 @@ int diFree(struct inode *ip) imap->im_agctl[agno].inofree = 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 @@ -2132,7 +2132,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) * allocated. if so, update the free inode summary * map to reflect this. */ - if (iagp->wmap[extno] == ONES) { + if (iagp->wmap[extno] == cpu_to_le32(ONES)) { sword = extno >> L2EXTSPERSUM; bitno = extno & (EXTSPERSUM - 1); iagp->inosmap[sword] |= cpu_to_le32(HIGHORDER >> bitno); @@ -2154,7 +2154,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) imap->im_agctl[agno].inofree = 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 @@ -2363,7 +2363,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) imap->im_agctl[agno].extfree = le32_to_cpu(iagp->extfreefwd); - iagp->extfreefwd = iagp->extfreeback = -1; + iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1); } else { /* if the iag has all free extents (newly allocated iag), * add the iag to the ag free extent list. @@ -2373,7 +2373,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) aiagp->extfreeback = cpu_to_le32(iagno); iagp->extfreefwd = cpu_to_le32(fwd); - iagp->extfreeback = -1; + iagp->extfreeback = cpu_to_le32(-1); imap->im_agctl[agno].extfree = iagno; } } @@ -2387,7 +2387,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) iagp->inofreefwd = cpu_to_le32(imap->im_agctl[agno].inofree); - iagp->inofreeback = -1; + iagp->inofreeback = cpu_to_le32(-1); imap->im_agctl[agno].inofree = iagno; } @@ -2593,9 +2593,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) /* init the iag */ memset(iagp, 0, sizeof(struct iag)); iagp->iagnum = cpu_to_le32(iagno); - iagp->inofreefwd = iagp->inofreeback = -1; - iagp->extfreefwd = iagp->extfreeback = -1; - iagp->iagfree = -1; + iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1); + iagp->extfreefwd = iagp->extfreeback = cpu_to_le32(-1); + iagp->iagfree = cpu_to_le32(-1); iagp->nfreeinos = 0; iagp->nfreeexts = cpu_to_le32(EXTSPERIAG); @@ -2603,8 +2603,14 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) * summary map initialization handled by bzero). */ for (i = 0; i < SMAPSZ; i++) - iagp->inosmap[i] = ONES; + iagp->inosmap[i] = cpu_to_le32(ONES); + /* + * Invalidate the page after writing and syncing it. + * After it's initialized, we access it in a different + * address space + */ + set_bit(META_discard, &mp->flag); flush_metapage(mp); /* @@ -2677,7 +2683,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) /* remove the iag from the iag free list */ 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 */ *iagnop = iagno; @@ -2925,8 +2931,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) /* init per AG control information im_agctl[] */ for (i = 0; i < MAXAG; i++) { - imap->im_agctl[i].inofree = -1; /* free inode list */ - imap->im_agctl[i].extfree = -1; /* free extent list */ + imap->im_agctl[i].inofree = -1; + imap->im_agctl[i].extfree = -1; imap->im_agctl[i].numinos = 0; /* number of backed inodes */ imap->im_agctl[i].numfree = 0; /* number of free backed inodes */ } @@ -2971,18 +2977,18 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) /* if any backed free inodes, insert at AG free inode list */ if ((int) le32_to_cpu(iagp->nfreeinos) > 0) { - if ((head = imap->im_agctl[n].inofree) == -1) - iagp->inofreefwd = iagp->inofreeback = -1; - else { + if ((head = imap->im_agctl[n].inofree) == -1) { + iagp->inofreefwd = cpu_to_le32(-1); + iagp->inofreeback = cpu_to_le32(-1); + } else { if ((rc = diIAGRead(imap, head, &hbp))) { rcx = rc; goto nextiag; } hiagp = (struct iag *) hbp->data; - hiagp->inofreeback = - le32_to_cpu(iagp->iagnum); + hiagp->inofreeback = iagp->iagnum; iagp->inofreefwd = cpu_to_le32(head); - iagp->inofreeback = -1; + iagp->inofreeback = cpu_to_le32(-1); write_metapage(hbp); } @@ -2997,9 +3003,10 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) /* if any free extents, insert at AG free extent list */ if (le32_to_cpu(iagp->nfreeexts) > 0) { - if ((head = imap->im_agctl[n].extfree) == -1) - iagp->extfreefwd = iagp->extfreeback = -1; - else { + if ((head = imap->im_agctl[n].extfree) == -1) { + iagp->extfreefwd = cpu_to_le32(-1); + iagp->extfreeback = cpu_to_le32(-1); + } else { if ((rc = diIAGRead(imap, head, &hbp))) { rcx = rc; goto nextiag; @@ -3007,7 +3014,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) hiagp = (struct iag *) hbp->data; hiagp->extfreeback = iagp->iagnum; iagp->extfreefwd = cpu_to_le32(head); - iagp->extfreeback = -1; + iagp->extfreeback = cpu_to_le32(-1); write_metapage(hbp); } @@ -3054,7 +3061,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, if (readSuper(sb, &bh)) return; 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); sync_dirty_buffer(bh);