Commit 8caf89157d64f1eedba37113afb4b303b2b3e301

Authored by Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6

Showing 6 changed files Side-by-side Diff

... ... @@ -74,7 +74,7 @@
74 74 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
75 75 int nblocks);
76 76 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
77   -static void dbBackSplit(dmtree_t * tp, int leafno);
  77 +static int dbBackSplit(dmtree_t * tp, int leafno);
78 78 static int dbJoin(dmtree_t * tp, int leafno, int newval);
79 79 static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
80 80 static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
... ... @@ -305,7 +305,6 @@
305 305 filemap_fdatawrite(ipbmap->i_mapping);
306 306 filemap_fdatawait(ipbmap->i_mapping);
307 307  
308   - ipbmap->i_state |= I_DIRTY;
309 308 diWriteSpecial(ipbmap, 0);
310 309  
311 310 return (0);
... ... @@ -2467,7 +2466,9 @@
2467 2466 * that it is at the front of a binary buddy system.
2468 2467 */
2469 2468 if (oldval == NOFREE) {
2470   - dbBackSplit((dmtree_t *) dcp, leafno);
  2469 + rc = dbBackSplit((dmtree_t *) dcp, leafno);
  2470 + if (rc)
  2471 + return rc;
2471 2472 oldval = dcp->stree[ti];
2472 2473 }
2473 2474 dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
... ... @@ -2627,7 +2628,7 @@
2627 2628 *
2628 2629 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
2629 2630 */
2630   -static void dbBackSplit(dmtree_t * tp, int leafno)
  2631 +static int dbBackSplit(dmtree_t * tp, int leafno)
2631 2632 {
2632 2633 int budsz, bud, w, bsz, size;
2633 2634 int cursz;
... ... @@ -2662,7 +2663,10 @@
2662 2663 */
2663 2664 for (w = leafno, bsz = budsz;; bsz <<= 1,
2664 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 2671 /* determine the buddy.
2668 2672 */
... ... @@ -2681,7 +2685,11 @@
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  
... ... @@ -57,6 +57,12 @@
57 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 + */
  63 +static HLIST_HEAD(aggregate_hash);
  64 +
  65 +/*
60 66 * imap locks
61 67 */
62 68 /* iag free list lock */
... ... @@ -491,6 +497,8 @@
491 497 /* release the page */
492 498 release_metapage(mp);
493 499  
  500 + hlist_add_head(&ip->i_hash, &aggregate_hash);
  501 +
494 502 return (ip);
495 503 }
496 504  
... ... @@ -513,8 +521,6 @@
513 521 struct dinode *dp;
514 522 ino_t inum = ip->i_ino;
515 523 struct metapage *mp;
516   -
517   - ip->i_state &= ~I_DIRTY;
518 524  
519 525 if (secondary)
520 526 address = addressPXD(&sbi->ait2) >> sbi->l2nbperpage;
fs/jfs/jfs_metapage.c
... ... @@ -395,6 +395,12 @@
395 395  
396 396 if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) {
397 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 404 continue;
399 405 }
400 406  
... ... @@ -2396,7 +2396,6 @@
2396 2396 */
2397 2397 if (tblk->xflag & COMMIT_CREATE) {
2398 2398 diUpdatePMap(ipimap, tblk->ino, FALSE, tblk);
2399   - ipimap->i_state |= I_DIRTY;
2400 2399 /* update persistent block allocation map
2401 2400 * for the allocation of inode extent;
2402 2401 */
... ... @@ -2407,7 +2406,6 @@
2407 2406 } else if (tblk->xflag & COMMIT_DELETE) {
2408 2407 ip = tblk->u.ip;
2409 2408 diUpdatePMap(ipimap, ip->i_ino, TRUE, tblk);
2410   - ipimap->i_state |= I_DIRTY;
2411 2409 iput(ip);
2412 2410 }
2413 2411 }
... ... @@ -3516,17 +3516,11 @@
3516 3516 /* process entries backward from last index */
3517 3517 index = le16_to_cpu(p->header.nextindex) - 1;
3518 3518  
3519   - if (p->header.flag & BT_INTERNAL)
3520   - goto getChild;
3521 3519  
3522   - /*
3523   - * leaf page
  3520 + /* Since this is the rightmost page at this level, and we may have
  3521 + * already freed a page that was formerly to the right, let's make
  3522 + * sure that the next pointer is zero.
3524 3523 */
3525   -
3526   - /* Since this is the rightmost leaf, and we may have already freed
3527   - * a page that was formerly to the right, let's make sure that the
3528   - * next pointer is zero.
3529   - */
3530 3524 if (p->header.next) {
3531 3525 if (log)
3532 3526 /*
... ... @@ -3539,6 +3533,12 @@
3539 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 3542 freed = 0;
3543 3543  
3544 3544 /* does region covered by leaf page precede Teof ? */
... ... @@ -442,6 +442,7 @@
442 442 inode->i_nlink = 1;
443 443 inode->i_size = sb->s_bdev->bd_inode->i_size;
444 444 inode->i_mapping->a_ops = &jfs_metapage_aops;
  445 + insert_inode_hash(inode);
445 446 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
446 447  
447 448 sbi->direct_inode = inode;