ChangeLog, mke2fs.c:

mke2fs.c (zap_sector): Change zap_bootsect to more general zap_sect.
  	(main): Clear the superblock when starting mke2fs, to avoid leaving
  	the filesystem in an inconsistent state.
bitmap-optimize
Theodore Ts'o 2000-08-14 14:44:15 +00:00
parent 153a977a25
commit e41784eb0e
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2000-08-14 <tytso@valinux.com>
* mke2fs.c (zap_sector): Change zap_bootsect to more general
zap_sect.
(main): Clear the superblock when starting mke2fs, to
avoid leaving the filesystem in an inconsistent state.
2000-07-26 <tytso@valinux.com>
* get_device_by_label.c: Improve /proc/partitions parsing in

View File

@ -548,20 +548,20 @@ static void reserve_inodes(ext2_filsys fs)
ext2fs_mark_ib_dirty(fs);
}
#ifdef ZAP_BOOTBLOCK
static void zap_bootblock(ext2_filsys fs)
static void zap_sector(ext2_filsys fs, int sect)
{
char buf[512];
int retval;
memset(buf, 0, 512);
retval = io_channel_write_blk(fs->io, 0, -512, buf);
io_channel_set_blksize(fs->io, 512);
retval = io_channel_write_blk(fs->io, sect, -512, buf);
io_channel_set_blksize(fs->io, fs->blocksize);
if (retval)
printf(_("Warning: could not erase block 0: %s\n"),
error_message(retval));
}
#endif
static void show_stats(ext2_filsys fs)
@ -1034,6 +1034,11 @@ int main (int argc, char *argv[])
exit(1);
}
/*
* Wipe out the old on-disk superblock
*/
zap_sector(fs, 2);
/*
* Generate a UUID for it...
*/
@ -1103,7 +1108,7 @@ int main (int argc, char *argv[])
reserve_inodes(fs);
create_bad_block_inode(fs, bb_list);
#ifdef ZAP_BOOTBLOCK
zap_bootblock(fs);
zap_sector(fs, 0);
#endif
}