@@ -229,5 +229,7 @@ request do_journal_write, "Write a transaction to the journal",
request do_journal_run, "Recover the journal",
journal_run, jr;
+request do_fake_fill_fs, "Make the filesystem to look as if it was full",
+ fake_fill_fs;
end;
@@ -2209,6 +2209,36 @@ err:
ext2fs_free_mem(&buf);
}
+void do_fake_fill_fs(int argc, char *argv[])
+{
+ __u64 block_count, i;
+ unsigned long v;
+ char *tmp;
+ int f;
+
+ if (common_args_process(argc, argv, 2, 2, argv[0],
+ "filling(%)", CHECK_FS_BITMAPS))
+ return;
+ if (check_fs_read_write(argv[0]))
+ return;
+ v = strtoul(argv[1], &tmp, 0);
+ if (v < 1 || v > 100) {
+ com_err("argv[0]", 0, "filling [1-100]");
+ }
+
+ block_count = ext2fs_blocks_count(current_fs->super);
+ for (i = 1, f = 0; i < block_count; i++) {
+ if (!ext2fs_test_block_bitmap2(current_fs->block_map, i)) {
+ f %= 100;
+ if (f < v)
+ ext2fs_block_alloc_stats2(current_fs, i, +1);
+ f ++;
+ }
+ }
+
+ ext2fs_mark_bb_dirty(current_fs);
+}
+
#ifndef READ_ONLY
void do_set_current_time(int argc, char *argv[],
int sci_idx EXT2FS_ATTR((unused)),