reiserfs: strip trailing whitespace
[pandora-kernel.git] / fs / reiserfs / resize.c
index 3bec2f9..238e9d9 100644 (file)
@@ -1,8 +1,8 @@
-/* 
+/*
  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
  */
 
-/* 
+/*
  * Written by Alexander Zarochentcev.
  *
  * The kernel part of the (on-line) reiserfs resizer.
@@ -61,7 +61,8 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
        }
 
        /* count used bits in last bitmap block */
-       block_r = SB_BLOCK_COUNT(s) - (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8;
+       block_r = SB_BLOCK_COUNT(s) -
+                       (reiserfs_bmap_count(s) - 1) * s->s_blocksize * 8;
 
        /* count bitmap blocks in new fs */
        bmap_nr_new = block_count_new / (s->s_blocksize * 8);
@@ -73,7 +74,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 
        /* save old values */
        block_count = SB_BLOCK_COUNT(s);
-       bmap_nr = SB_BMAP_NR(s);
+       bmap_nr = reiserfs_bmap_count(s);
 
        /* resizing of reiserfs bitmaps (journal and real), if needed */
        if (bmap_nr_new > bmap_nr) {
@@ -100,7 +101,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                        memcpy(jbitmap[i].bitmaps, jb->bitmaps, copy_size);
 
                        /* just in case vfree schedules on us, copy the new
-                        ** pointer into the journal struct before freeing the 
+                        ** pointer into the journal struct before freeing the
                         ** old one
                         */
                        node_tmp = jb->bitmaps;
@@ -143,7 +144,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                        mark_buffer_dirty(bh);
                        sync_dirty_buffer(bh);
                        // update bitmap_info stuff
-                       bitmap[i].first_zero_hint = 1;
                        bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
                        brelse(bh);
                }
@@ -173,8 +173,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
        for (i = block_r; i < s->s_blocksize * 8; i++)
                reiserfs_test_and_clear_le_bit(i, bh->b_data);
        info->free_count += s->s_blocksize * 8 - block_r;
-       if (!info->first_zero_hint)
-               info->first_zero_hint = block_r;
 
        journal_mark_dirty(&th, s, bh);
        brelse(bh);
@@ -196,9 +194,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
        brelse(bh);
 
        info->free_count -= s->s_blocksize * 8 - block_r_new;
-       /* Extreme case where last bitmap is the only valid block in itself. */
-       if (!info->free_count)
-               info->first_zero_hint = 0;
        /* update super */
        reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
        free_blocks = SB_FREE_BLOCKS(s);
@@ -206,7 +201,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                           free_blocks + (block_count_new - block_count -
                                          (bmap_nr_new - bmap_nr)));
        PUT_SB_BLOCK_COUNT(s, block_count_new);
-       PUT_SB_BMAP_NR(s, bmap_nr_new);
+       PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new);
        s->s_dirt = 1;
 
        journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));