OSDN Git Service

ChangeLog, closefs.c, ext2fs.h:
authorTheodore Ts'o <tytso@mit.edu>
Tue, 30 Jun 1998 05:33:11 +0000 (05:33 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 30 Jun 1998 05:33:11 +0000 (05:33 +0000)
  closefs.c (ext2fs_flush): Update the s_block_group_nr field as
   appropriate for all of the block group copies, so that it's clear
   where the beginning of the filesystem is on the disk.  (For when the
   partition table gets scrod.)
  ext2fs.h: Change the name of the feature from
   EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE to EXT2_FEATURE_INCOMPAT_FILESIZE
   (to match with the kernel).

lib/ext2fs/ChangeLog
lib/ext2fs/closefs.c
lib/ext2fs/ext2fs.h

index 6ed3497..36766e5 100644 (file)
@@ -1,3 +1,14 @@
+1998-06-30  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * closefs.c (ext2fs_flush): Update the s_block_group_nr field as
+               appropriate for all of the block group copies, so that
+               it's clear where the beginning of the filesystem is on the
+               disk.  (For when the partition table gets scrod.)
+
+       * ext2fs.h: Change the name of the feature from
+               EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE to
+               EXT2_FEATURE_INCOMPAT_FILESIZE (to match with the kernel).
+
 1998-06-18  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * inode.c (get_next_blockgroup): Fix bug where if
index dca4a1a..1a615f3 100644 (file)
@@ -58,7 +58,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block)
 
 errcode_t ext2fs_flush(ext2_filsys fs)
 {
-       dgrp_t          i,j,maxgroup;
+       dgrp_t          i,j,maxgroup,sgrp;
        blk_t           group_block;
        errcode_t       retval;
        char            *group_ptr;
@@ -66,12 +66,15 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        struct ext2_super_block *super_shadow = 0;
        struct ext2_group_desc *group_shadow = 0;
        struct ext2_group_desc *s, *t;
+       struct ext2fs_sb *sb, *sb_shadow;
        
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
        fs_state = fs->super->s_state;
 
        fs->super->s_wtime = time(NULL);
+       sb = (struct ext2fs_sb *) fs->super;
+       sb->s_block_group_nr = 0;
        if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
                retval = EXT2_ET_NO_MEMORY;
                retval = ext2fs_get_mem(SUPERBLOCK_SIZE,
@@ -89,6 +92,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
                /* swap the superblock */
                *super_shadow = *fs->super;
                ext2fs_swap_super(super_shadow);
+               sb_shadow = (struct ext2fs_sb *) super_shadow;
 
                /* swap the group descriptors */
                for (j=0, s=fs->group_desc, t=group_shadow;
@@ -98,6 +102,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
                }
        } else {
                super_shadow = fs->super;
+               sb_shadow = (struct ext2fs_sb *) fs->super;
                group_shadow = fs->group_desc;
        }
        
@@ -135,6 +140,14 @@ errcode_t ext2fs_flush(ext2_filsys fs)
                if (!ext2fs_bg_has_super(fs, i))
                        goto next_group;
 
+               sgrp = i;
+               if (sgrp > ((1 << 16) - 1))
+                       sgrp = (1 << 16) - 1;
+               if (fs->flags & EXT2_FLAG_SWAP_BYTES)
+                       sb_shadow->s_block_group_nr = ext2fs_swab16(sgrp);
+               else
+                       sb->s_block_group_nr = sgrp;
+
                if (i !=0 ) {
                        retval = io_channel_write_blk(fs->io, group_block,
                                                      -SUPERBLOCK_SIZE,
@@ -154,6 +167,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        next_group:
                group_block += EXT2_BLOCKS_PER_GROUP(fs->super);
        }
+       sb->s_block_group_nr = 0;
 
        /*
         * If the write_bitmaps() function is present, call it to
index 243dc22..29c439a 100644 (file)
@@ -454,7 +454,7 @@ struct ext2fs_sb {
 #define EXT2_FEATURE_INCOMPAT_COMPRESSION      0x0001
 #endif
 
-#ifndef EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE
+#ifndef EXT2_FEATURE_INCOMPAT_FILETYPE
 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
 #endif