]> err.no Git - linux-2.6/blobdiff - fs/reiserfs/resize.c
[PATCH] splice: fix problem introduced with inode diet
[linux-2.6] / fs / reiserfs / resize.c
index 958b75978994e2e2040eef36b0c67f6cd7b6dd84..315684793d1d8d0ff6b61ec08c4e9a5e4dc75d22 100644 (file)
@@ -128,10 +128,12 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                 * transaction begins, and the new bitmaps don't matter if the
                 * transaction fails. */
                for (i = bmap_nr; i < bmap_nr_new; i++) {
-                       bh = sb_getblk(s, i * s->s_blocksize * 8);
-                       get_bh(bh);
+                       /* don't use read_bitmap_block since it will cache
+                        * the uninitialized bitmap */
+                       bh = sb_bread(s, i * s->s_blocksize * 8);
                        memset(bh->b_data, 0, sb_blocksize(sb));
                        reiserfs_test_and_set_le_bit(0, bh->b_data);
+                       reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);
 
                        set_buffer_uptodate(bh);
                        mark_buffer_dirty(bh);
@@ -139,7 +141,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                        // update bitmap_info stuff
                        bitmap[i].first_zero_hint = 1;
                        bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
-                       bitmap[i].bh = bh;
                        brelse(bh);
                }
                /* free old bitmap blocks array */
@@ -156,8 +157,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 
        /* Extend old last bitmap block - new blocks have been made available */
        info = SB_AP_BITMAP(s) + bmap_nr - 1;
-       bh = info->bh;
-       get_bh(bh);
+       bh = reiserfs_read_bitmap_block(s, bmap_nr - 1);
+       if (!bh) {
+               int jerr = journal_end(&th, s, 10);
+               if (jerr)
+                       return jerr;
+               return -EIO;
+       }
 
        reiserfs_prepare_for_journal(s, bh, 1);
        for (i = block_r; i < s->s_blocksize * 8; i++)
@@ -171,8 +177,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 
        /* Correct new last bitmap block - It may not be full */
        info = SB_AP_BITMAP(s) + bmap_nr_new - 1;
-       bh = info->bh;
-       get_bh(bh);
+       bh = reiserfs_read_bitmap_block(s, bmap_nr_new - 1);
+       if (!bh) {
+               int jerr = journal_end(&th, s, 10);
+               if (jerr)
+                       return jerr;
+               return -EIO;
+       }
 
        reiserfs_prepare_for_journal(s, bh, 1);
        for (i = block_r_new; i < s->s_blocksize * 8; i++)