aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_dmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/jfs_dmap.c')
-rw-r--r--fs/jfs/jfs_dmap.c20
1 files changed, 14 insertions, 6 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