ext4: release reserved quota when block reservation for delalloc retry
[safe/jmp/linux-2.6] / fs / reiserfs / resize.c
index 66f1cda..18b315d 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) {
@@ -81,7 +82,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
                if (reiserfs_allocate_list_bitmaps(s, jbitmap, bmap_nr_new) < 0) {
                        printk
                            ("reiserfs_resize: unable to allocate memory for journal bitmaps\n");
-                       unlock_super(s);
                        return -ENOMEM;
                }
                /* the new journal bitmaps are zero filled, now we copy in the bitmap
@@ -100,7 +100,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;
@@ -200,7 +200,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));