diff options
Diffstat (limited to 'fs/jfs/jfs_dmap.c')
-rw-r--r-- | fs/jfs/jfs_dmap.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 51c02bf07878..68000a50ceb6 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -74,7 +74,7 @@ | |||
74 | static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | 74 | static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, |
75 | int nblocks); | 75 | int nblocks); |
76 | static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); | 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 | static int dbJoin(dmtree_t * tp, int leafno, int newval); | 78 | static int dbJoin(dmtree_t * tp, int leafno, int newval); |
79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); | 79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); |
80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, | 80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, |
@@ -2466,7 +2466,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) | |||
2466 | * that it is at the front of a binary buddy system. | 2466 | * that it is at the front of a binary buddy system. |
2467 | */ | 2467 | */ |
2468 | if (oldval == NOFREE) { | 2468 | if (oldval == NOFREE) { |
2469 | dbBackSplit((dmtree_t *) dcp, leafno); | 2469 | rc = dbBackSplit((dmtree_t *) dcp, leafno); |
2470 | if (rc) | ||
2471 | return rc; | ||
2470 | oldval = dcp->stree[ti]; | 2472 | oldval = dcp->stree[ti]; |
2471 | } | 2473 | } |
2472 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); | 2474 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); |
@@ -2626,7 +2628,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) | |||
2626 | * | 2628 | * |
2627 | * 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; |
2628 | */ | 2630 | */ |
2629 | static void dbBackSplit(dmtree_t * tp, int leafno) | 2631 | static int dbBackSplit(dmtree_t * tp, int leafno) |
2630 | { | 2632 | { |
2631 | int budsz, bud, w, bsz, size; | 2633 | int budsz, bud, w, bsz, size; |
2632 | int cursz; | 2634 | int cursz; |
@@ -2661,7 +2663,10 @@ static void dbBackSplit(dmtree_t * tp, int leafno) | |||
2661 | */ | 2663 | */ |
2662 | for (w = leafno, bsz = budsz;; bsz <<= 1, | 2664 | for (w = leafno, bsz = budsz;; bsz <<= 1, |
2663 | w = (w < bud) ? w : bud) { | 2665 | w = (w < bud) ? w : bud) { |
2664 | 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 | } | ||
2665 | 2670 | ||
2666 | /* determine the buddy. | 2671 | /* determine the buddy. |
2667 | */ | 2672 | */ |
@@ -2680,7 +2685,11 @@ static void dbBackSplit(dmtree_t * tp, int leafno) | |||
2680 | } | 2685 | } |
2681 | } | 2686 | } |
2682 | 2687 | ||
2683 | 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; | ||
2684 | } | 2693 | } |
2685 | 2694 | ||
2686 | 2695 | ||