diff options
Diffstat (limited to 'lib/ext2fs/closefs.c')
-rw-r--r-- | lib/ext2fs/closefs.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index 206faa6c..baf8ce13 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -1,6 +1,6 @@ /* * closefs.c --- close an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -58,7 +58,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) * * See also the comment for ext2fs_reserve_super_and_bgd() */ -int ext2fs_super_and_bgd_loc(ext2_filsys fs, +int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, @@ -75,7 +75,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; else - old_desc_blocks = + old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; if (group == fs->group_desc_count-1) { @@ -112,7 +112,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, numblocks--; } } - + numblocks -= 2 + fs->inode_blocks_per_group; if (ret_super_blk) @@ -200,7 +200,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, struct ext2_super_block *super_shadow) { dgrp_t sgrp = group; - + if (sgrp > ((1 << 16) - 1)) sgrp = (1 << 16) - 1; #ifdef WORDS_BIGENDIAN @@ -209,7 +209,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, fs->super->s_block_group_nr = sgrp; #endif - return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, + return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, super_shadow); } @@ -228,7 +228,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) #endif char *group_ptr; int old_desc_blocks; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); fs_state = fs->super->s_state; @@ -241,13 +241,13 @@ errcode_t ext2fs_flush(ext2_filsys fs) retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super_shadow); if (retval) goto errout; - retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize, + retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize, &group_shadow); if (retval) goto errout; memset(group_shadow, 0, (size_t) fs->blocksize * fs->desc_blocks); - + /* swap the group descriptors */ for (j=0, s=fs->group_desc, t=group_shadow; j < fs->group_desc_count; j++, t++, s++) { @@ -258,7 +258,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) super_shadow = fs->super; group_shadow = fs->group_desc; #endif - + /* * Set the state of the FS to be non-valid. (The state has * already been backed up earlier, and will be restored after @@ -293,7 +293,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) blk_t super_blk, old_desc_blk, new_desc_blk; int meta_bg; - ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, + ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, &new_desc_blk, &meta_bg); if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { @@ -304,7 +304,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) } if (fs->flags & EXT2_FLAG_SUPER_ONLY) continue; - if ((old_desc_blk) && + if ((old_desc_blk) && (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { retval = io_channel_write_blk(fs->io, old_desc_blk, old_desc_blocks, group_ptr); @@ -370,7 +370,7 @@ errout: errcode_t ext2fs_close(ext2_filsys fs) { errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (fs->flags & EXT2_FLAG_DIRTY) { |