aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-30 21:37:12 -0500
committerPaul Mackerras <paulus@samba.org>2005-10-30 21:37:12 -0500
commit23fd07750a789a66fe88cf173d52a18f1a387da4 (patch)
tree06fdd6df35fdb835abdaa9b754d62f6b84b97250 /fs/jfs
parentbd787d438a59266af3c9f6351644c85ef1dd21fe (diff)
parented28f96ac1960f30f818374d65be71d2fdf811b0 (diff)
Merge ../linux-2.6 by hand
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/jfs_dmap.c20
-rw-r--r--fs/jfs/jfs_imap.c10
-rw-r--r--fs/jfs/jfs_metapage.c22
-rw-r--r--fs/jfs/jfs_txnmgr.c2
-rw-r--r--fs/jfs/jfs_xtree.c18
-rw-r--r--fs/jfs/super.c1
6 files changed, 46 insertions, 27 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index eadf319bee22..68000a50ceb6 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -74,7 +74,7 @@
74static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, 74static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
75 int nblocks); 75 int nblocks);
76static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); 76static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
77static void dbBackSplit(dmtree_t * tp, int leafno); 77static int dbBackSplit(dmtree_t * tp, int leafno);
78static int dbJoin(dmtree_t * tp, int leafno, int newval); 78static int dbJoin(dmtree_t * tp, int leafno, int newval);
79static void dbAdjTree(dmtree_t * tp, int leafno, int newval); 79static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
80static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, 80static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
@@ -305,7 +305,6 @@ int dbSync(struct inode *ipbmap)
305 filemap_fdatawrite(ipbmap->i_mapping); 305 filemap_fdatawrite(ipbmap->i_mapping);
306 filemap_fdatawait(ipbmap->i_mapping); 306 filemap_fdatawait(ipbmap->i_mapping);
307 307
308 ipbmap->i_state |= I_DIRTY;
309 diWriteSpecial(ipbmap, 0); 308 diWriteSpecial(ipbmap, 0);
310 309
311 return (0); 310 return (0);
@@ -2467,7 +2466,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
2467 * that it is at the front of a binary buddy system. 2466 * that it is at the front of a binary buddy system.
2468 */ 2467 */
2469 if (oldval == NOFREE) { 2468 if (oldval == NOFREE) {
2470 dbBackSplit((dmtree_t *) dcp, leafno); 2469 rc = dbBackSplit((dmtree_t *) dcp, leafno);
2470 if (rc)
2471 return rc;
2471 oldval = dcp->stree[ti]; 2472 oldval = dcp->stree[ti];
2472 } 2473 }
2473 dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); 2474 dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
@@ -2627,7 +2628,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval)
2627 * 2628 *
2628 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; 2629 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2629 */ 2630 */
2630static void dbBackSplit(dmtree_t * tp, int leafno) 2631static int dbBackSplit(dmtree_t * tp, int leafno)
2631{ 2632{
2632 int budsz, bud, w, bsz, size; 2633 int budsz, bud, w, bsz, size;
2633 int cursz; 2634 int cursz;
@@ -2662,7 +2663,10 @@ static void dbBackSplit(dmtree_t * tp, int leafno)
2662 */ 2663 */
2663 for (w = leafno, bsz = budsz;; bsz <<= 1, 2664 for (w = leafno, bsz = budsz;; bsz <<= 1,
2664 w = (w < bud) ? w : bud) { 2665 w = (w < bud) ? w : bud) {
2665 assert(bsz < le32_to_cpu(tp->dmt_nleafs)); 2666 if (bsz >= le32_to_cpu(tp->dmt_nleafs)) {
2667 jfs_err("JFS: block map error in dbBackSplit");
2668 return -EIO;
2669 }
2666 2670
2667 /* determine the buddy. 2671 /* determine the buddy.
2668 */ 2672 */
@@ -2681,7 +2685,11 @@ static void dbBackSplit(dmtree_t * tp, int leafno)
2681 } 2685 }
2682 } 2686 }
2683 2687
2684 assert(leaf[leafno] == size); 2688 if (leaf[leafno] != size) {
2689 jfs_err("JFS: wrong leaf value in dbBackSplit");
2690 return -EIO;
2691 }
2692 return 0;
2685} 2693}
2686 2694
2687 2695
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 4021d46da7e3..28201b194f53 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -57,6 +57,12 @@
57#include "jfs_debug.h" 57#include "jfs_debug.h"
58 58
59/* 59/*
60 * __mark_inode_dirty expects inodes to be hashed. Since we don't want
61 * special inodes in the fileset inode space, we hash them to a dummy head
62 */
63static HLIST_HEAD(aggregate_hash);
64
65/*
60 * imap locks 66 * imap locks
61 */ 67 */
62/* iag free list lock */ 68/* iag free list lock */
@@ -491,6 +497,8 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
491 /* release the page */ 497 /* release the page */
492 release_metapage(mp); 498 release_metapage(mp);
493 499
500 hlist_add_head(&ip->i_hash, &aggregate_hash);
501
494 return (ip); 502 return (ip);
495} 503}
496 504
@@ -514,8 +522,6 @@ void diWriteSpecial(struct inode *ip, int secondary)
514 ino_t inum = ip->i_ino; 522 ino_t inum = ip->i_ino;
515 struct metapage *mp; 523 struct metapage *mp;
516 524
517 ip->i_state &= ~I_DIRTY;
518
519 if (secondary) 525 if (secondary)
520 address = addressPXD(&sbi->ait2) >> sbi->l2nbperpage; 526 address = addressPXD(&sbi->ait2) >> sbi->l2nbperpage;
521 else 527 else
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 13d7e3f1feb4..8a53981f9f27 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -86,7 +86,7 @@ struct meta_anchor {
86 atomic_t io_count; 86 atomic_t io_count;
87 struct metapage *mp[MPS_PER_PAGE]; 87 struct metapage *mp[MPS_PER_PAGE];
88}; 88};
89#define mp_anchor(page) ((struct meta_anchor *)page->private) 89#define mp_anchor(page) ((struct meta_anchor *)page_private(page))
90 90
91static inline struct metapage *page_to_mp(struct page *page, uint offset) 91static inline struct metapage *page_to_mp(struct page *page, uint offset)
92{ 92{
@@ -108,7 +108,7 @@ static inline int insert_metapage(struct page *page, struct metapage *mp)
108 if (!a) 108 if (!a)
109 return -ENOMEM; 109 return -ENOMEM;
110 memset(a, 0, sizeof(struct meta_anchor)); 110 memset(a, 0, sizeof(struct meta_anchor));
111 page->private = (unsigned long)a; 111 set_page_private(page, (unsigned long)a);
112 SetPagePrivate(page); 112 SetPagePrivate(page);
113 kmap(page); 113 kmap(page);
114 } 114 }
@@ -136,7 +136,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
136 a->mp[index] = NULL; 136 a->mp[index] = NULL;
137 if (--a->mp_count == 0) { 137 if (--a->mp_count == 0) {
138 kfree(a); 138 kfree(a);
139 page->private = 0; 139 set_page_private(page, 0);
140 ClearPagePrivate(page); 140 ClearPagePrivate(page);
141 kunmap(page); 141 kunmap(page);
142 } 142 }
@@ -156,13 +156,13 @@ static inline void dec_io(struct page *page, void (*handler) (struct page *))
156#else 156#else
157static inline struct metapage *page_to_mp(struct page *page, uint offset) 157static inline struct metapage *page_to_mp(struct page *page, uint offset)
158{ 158{
159 return PagePrivate(page) ? (struct metapage *)page->private : NULL; 159 return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL;
160} 160}
161 161
162static inline int insert_metapage(struct page *page, struct metapage *mp) 162static inline int insert_metapage(struct page *page, struct metapage *mp)
163{ 163{
164 if (mp) { 164 if (mp) {
165 page->private = (unsigned long)mp; 165 set_page_private(page, (unsigned long)mp);
166 SetPagePrivate(page); 166 SetPagePrivate(page);
167 kmap(page); 167 kmap(page);
168 } 168 }
@@ -171,7 +171,7 @@ static inline int insert_metapage(struct page *page, struct metapage *mp)
171 171
172static inline void remove_metapage(struct page *page, struct metapage *mp) 172static inline void remove_metapage(struct page *page, struct metapage *mp)
173{ 173{
174 page->private = 0; 174 set_page_private(page, 0);
175 ClearPagePrivate(page); 175 ClearPagePrivate(page);
176 kunmap(page); 176 kunmap(page);
177} 177}
@@ -198,7 +198,7 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
198 } 198 }
199} 199}
200 200
201static inline struct metapage *alloc_metapage(unsigned int gfp_mask) 201static inline struct metapage *alloc_metapage(gfp_t gfp_mask)
202{ 202{
203 return mempool_alloc(metapage_mempool, gfp_mask); 203 return mempool_alloc(metapage_mempool, gfp_mask);
204} 204}
@@ -395,6 +395,12 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
395 395
396 if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) { 396 if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) {
397 redirty = 1; 397 redirty = 1;
398 /*
399 * Make sure this page isn't blocked indefinitely.
400 * If the journal isn't undergoing I/O, push it
401 */
402 if (mp->log && !(mp->log->cflag & logGC_PAGEOUT))
403 jfs_flush_journal(mp->log, 0);
398 continue; 404 continue;
399 } 405 }
400 406
@@ -534,7 +540,7 @@ add_failed:
534 return -EIO; 540 return -EIO;
535} 541}
536 542
537static int metapage_releasepage(struct page *page, int gfp_mask) 543static int metapage_releasepage(struct page *page, gfp_t gfp_mask)
538{ 544{
539 struct metapage *mp; 545 struct metapage *mp;
540 int busy = 0; 546 int busy = 0;
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 9b71ed2674fe..b660c93c92de 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -2396,7 +2396,6 @@ static void txUpdateMap(struct tblock * tblk)
2396 */ 2396 */
2397 if (tblk->xflag & COMMIT_CREATE) { 2397 if (tblk->xflag & COMMIT_CREATE) {
2398 diUpdatePMap(ipimap, tblk->ino, FALSE, tblk); 2398 diUpdatePMap(ipimap, tblk->ino, FALSE, tblk);
2399 ipimap->i_state |= I_DIRTY;
2400 /* update persistent block allocation map 2399 /* update persistent block allocation map
2401 * for the allocation of inode extent; 2400 * for the allocation of inode extent;
2402 */ 2401 */
@@ -2407,7 +2406,6 @@ static void txUpdateMap(struct tblock * tblk)
2407 } else if (tblk->xflag & COMMIT_DELETE) { 2406 } else if (tblk->xflag & COMMIT_DELETE) {
2408 ip = tblk->u.ip; 2407 ip = tblk->u.ip;
2409 diUpdatePMap(ipimap, ip->i_ino, TRUE, tblk); 2408 diUpdatePMap(ipimap, ip->i_ino, TRUE, tblk);
2410 ipimap->i_state |= I_DIRTY;
2411 iput(ip); 2409 iput(ip);
2412 } 2410 }
2413} 2411}
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index a7fe2f2b969f..e72f4ebb6e9c 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -3516,16 +3516,10 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3516 /* process entries backward from last index */ 3516 /* process entries backward from last index */
3517 index = le16_to_cpu(p->header.nextindex) - 1; 3517 index = le16_to_cpu(p->header.nextindex) - 1;
3518 3518
3519 if (p->header.flag & BT_INTERNAL)
3520 goto getChild;
3521
3522 /*
3523 * leaf page
3524 */
3525 3519
3526 /* Since this is the rightmost leaf, and we may have already freed 3520 /* Since this is the rightmost page at this level, and we may have
3527 * a page that was formerly to the right, let's make sure that the 3521 * already freed a page that was formerly to the right, let's make
3528 * next pointer is zero. 3522 * sure that the next pointer is zero.
3529 */ 3523 */
3530 if (p->header.next) { 3524 if (p->header.next) {
3531 if (log) 3525 if (log)
@@ -3539,6 +3533,12 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3539 p->header.next = 0; 3533 p->header.next = 0;
3540 } 3534 }
3541 3535
3536 if (p->header.flag & BT_INTERNAL)
3537 goto getChild;
3538
3539 /*
3540 * leaf page
3541 */
3542 freed = 0; 3542 freed = 0;
3543 3543
3544 /* does region covered by leaf page precede Teof ? */ 3544 /* does region covered by leaf page precede Teof ? */
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 71bc34b96b2b..4226af3ea91b 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -442,6 +442,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
442 inode->i_nlink = 1; 442 inode->i_nlink = 1;
443 inode->i_size = sb->s_bdev->bd_inode->i_size; 443 inode->i_size = sb->s_bdev->bd_inode->i_size;
444 inode->i_mapping->a_ops = &jfs_metapage_aops; 444 inode->i_mapping->a_ops = &jfs_metapage_aops;
445 insert_inode_hash(inode);
445 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); 446 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
446 447
447 sbi->direct_inode = inode; 448 sbi->direct_inode = inode;