^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Written by Alexander Zarochentcev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * The kernel part of the (on-line) reiserfs resizer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/vmalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "reiserfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct reiserfs_super_block *sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct reiserfs_bitmap_info *bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct reiserfs_bitmap_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct reiserfs_bitmap_info *old_bitmap = SB_AP_BITMAP(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct buffer_head *bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct reiserfs_transaction_handle th;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int bmap_nr_new, bmap_nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned int block_r_new, block_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct reiserfs_list_bitmap *jb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct reiserfs_list_bitmap jbitmap[JOURNAL_NUM_BITMAPS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned long int block_count, free_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int copy_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) sb = SB_DISK_SUPER_BLOCK(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) if (SB_BLOCK_COUNT(s) >= block_count_new) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) printk("can\'t shrink filesystem on-line\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* check the device size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) depth = reiserfs_write_unlock_nested(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) bh = sb_bread(s, block_count_new - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) reiserfs_write_lock_nested(s, depth);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) if (!bh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) printk("reiserfs_resize: can\'t read last block\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) bforget(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * old disk layout detection; those partitions can be mounted, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * cannot be resized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) if (SB_BUFFER_WITH_SB(s)->b_blocknr * SB_BUFFER_WITH_SB(s)->b_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) != REISERFS_DISK_OFFSET_IN_BYTES) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) printk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) ("reiserfs_resize: unable to resize a reiserfs without distributed bitmap (fs version < 3.5.12)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return -ENOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* count used bits in last bitmap block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) block_r = SB_BLOCK_COUNT(s) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) (reiserfs_bmap_count(s) - 1) * s->s_blocksize * 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* count bitmap blocks in new fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) bmap_nr_new = block_count_new / (s->s_blocksize * 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) block_r_new = block_count_new - bmap_nr_new * s->s_blocksize * 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (block_r_new)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) bmap_nr_new++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) block_r_new = s->s_blocksize * 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* save old values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) block_count = SB_BLOCK_COUNT(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) bmap_nr = reiserfs_bmap_count(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* resizing of reiserfs bitmaps (journal and real), if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) if (bmap_nr_new > bmap_nr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /* reallocate journal bitmaps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (reiserfs_allocate_list_bitmaps(s, jbitmap, bmap_nr_new) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) printk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ("reiserfs_resize: unable to allocate memory for journal bitmaps\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * the new journal bitmaps are zero filled, now we copy i
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * the bitmap node pointers from the old journal bitmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * structs, and then transfer the new data structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * into the journal struct.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * using the copy_size var below allows this code to work for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * both shrinking and expanding the FS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) copy_size = bmap_nr_new < bmap_nr ? bmap_nr_new : bmap_nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) copy_size =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) copy_size * sizeof(struct reiserfs_list_bitmap_node *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) for (i = 0; i < JOURNAL_NUM_BITMAPS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct reiserfs_bitmap_node **node_tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) jb = SB_JOURNAL(s)->j_list_bitmap + i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) memcpy(jbitmap[i].bitmaps, jb->bitmaps, copy_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * just in case vfree schedules on us, copy the new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * pointer into the journal struct before freeing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * old one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) node_tmp = jb->bitmaps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) jb->bitmaps = jbitmap[i].bitmaps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) vfree(node_tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * allocate additional bitmap blocks, reallocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * array of bitmap block pointers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) bitmap =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) vzalloc(array_size(bmap_nr_new,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) sizeof(struct reiserfs_bitmap_info)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (!bitmap) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Journal bitmaps are still supersized, but the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * memory isn't leaked, so I guess it's ok
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) printk("reiserfs_resize: unable to allocate memory.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) for (i = 0; i < bmap_nr; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) bitmap[i] = old_bitmap[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * This doesn't go through the journal, but it doesn't have to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * The changes are still atomic: We're synced up when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * journal transaction begins, and the new bitmaps don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * matter if the transaction fails.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) for (i = bmap_nr; i < bmap_nr_new; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) int depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * don't use read_bitmap_block since it will cache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * the uninitialized bitmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) depth = reiserfs_write_unlock_nested(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) bh = sb_bread(s, i * s->s_blocksize * 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) reiserfs_write_lock_nested(s, depth);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (!bh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) vfree(bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) memset(bh->b_data, 0, sb_blocksize(sb));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) reiserfs_set_le_bit(0, bh->b_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) set_buffer_uptodate(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) mark_buffer_dirty(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) depth = reiserfs_write_unlock_nested(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) sync_dirty_buffer(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) reiserfs_write_lock_nested(s, depth);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /* update bitmap_info stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /* free old bitmap blocks array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) SB_AP_BITMAP(s) = bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) vfree(old_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * begin transaction, if there was an error, it's fine. Yes, we have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * incorrect bitmaps now, but none of it is ever going to touch the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * disk anyway.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) err = journal_begin(&th, s, 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /* Extend old last bitmap block - new blocks have been made available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) info = SB_AP_BITMAP(s) + bmap_nr - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) bh = reiserfs_read_bitmap_block(s, bmap_nr - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) if (!bh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) int jerr = journal_end(&th);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) if (jerr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) return jerr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) reiserfs_prepare_for_journal(s, bh, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) for (i = block_r; i < s->s_blocksize * 8; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) reiserfs_clear_le_bit(i, bh->b_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) info->free_count += s->s_blocksize * 8 - block_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) journal_mark_dirty(&th, bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /* Correct new last bitmap block - It may not be full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) info = SB_AP_BITMAP(s) + bmap_nr_new - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) bh = reiserfs_read_bitmap_block(s, bmap_nr_new - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (!bh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) int jerr = journal_end(&th);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (jerr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) return jerr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) reiserfs_prepare_for_journal(s, bh, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) for (i = block_r_new; i < s->s_blocksize * 8; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) reiserfs_set_le_bit(i, bh->b_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) journal_mark_dirty(&th, bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) brelse(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) info->free_count -= s->s_blocksize * 8 - block_r_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* update super */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) free_blocks = SB_FREE_BLOCKS(s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) PUT_SB_FREE_BLOCKS(s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) free_blocks + (block_count_new - block_count -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) (bmap_nr_new - bmap_nr)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) PUT_SB_BLOCK_COUNT(s, block_count_new);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) SB_JOURNAL(s)->j_must_wait = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return journal_end(&th);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }