11 #include <linux/kernel.h>
14 #include <linux/string.h>
15 #include <linux/errno.h>
26 struct buffer_head *bh;
28 unsigned int bmap_nr_new, bmap_nr;
29 unsigned int block_r_new, block_r;
41 printk(
"can\'t shrink filesystem on-line\n");
46 bh = sb_bread(s, block_count_new - 1);
48 printk(
"reiserfs_resize: can\'t read last block\n");
58 (
"reiserfs_resize: unable to resize a reiserfs without distributed bitmap (fs version < 3.5.12)\n");
67 bmap_nr_new = block_count_new / (s->
s_blocksize * 8);
68 block_r_new = block_count_new - bmap_nr_new * s->
s_blocksize * 8;
76 bmap_nr = reiserfs_bmap_count(s);
79 if (bmap_nr_new > bmap_nr) {
83 (
"reiserfs_resize: unable to allocate memory for journal bitmaps\n");
93 copy_size = bmap_nr_new < bmap_nr ? bmap_nr_new : bmap_nr;
95 copy_size *
sizeof(
struct reiserfs_list_bitmap_node *);
117 printk(
"reiserfs_resize: unable to allocate memory.\n");
120 for (i = 0; i < bmap_nr; i++)
121 bitmap[i] = old_bitmap[i];
127 for (i = bmap_nr; i < bmap_nr_new; i++) {
139 set_buffer_uptodate(bh);
199 free_blocks + (block_count_new - block_count -
200 (bmap_nr_new - bmap_nr)));