]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
E2fsck now updates the global free block and
authorTheodore Ts'o <tytso@mit.edu>
Sun, 6 Apr 2003 03:50:44 +0000 (22:50 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 6 Apr 2003 03:50:44 +0000 (22:50 -0500)
inode counters from the block group specific counters
quietly.  This is needed for an experimental patch which
eliminates locking the entire filesystem when allocating
blocks or inodes; if the filesystem is not unmounted
cleanly, the global counts may not be accurate.

e2fsck/ChangeLog
e2fsck/super.c
tests/ChangeLog
tests/f_baddir/expect.1
tests/f_dup/expect.1
tests/f_dup2/expect.1
tests/f_end-bitmap/expect.1
tests/f_lpf/expect.1

index 0fb86426ab62b67f618c31c56c308d25ac312362..5109482299203ad6268c95712c6b58181348a013 100644 (file)
@@ -1,3 +1,12 @@
+2003-04-05  Theodore Ts'o  <tytso@mit.edu>
+
+       * super.c (check_super_block): Update the global free block and
+               inode counters from the block group specific counters
+               quietly.  This is needed for an experimental patch which
+               eliminates locking the entire filesystem when allocating
+               blocks or inodes; if the filesystem is not unmounted
+               cleanly, the global counts may not be accurate.
+
 2003-03-17  Theodore Ts'o  <tytso@mit.edu>
 
        * util.c: Explicitly declare e2fsck_global_ctx as extern for the
index 2deff4469af750bc141daa9efcbdd1ec76b8453e..9210739ac0be43e1a72dd0db145d90c26c36df8a 100644 (file)
@@ -323,6 +323,7 @@ void check_super_block(e2fsck_t ctx)
        dgrp_t  i;
        blk_t   should_be;
        struct problem_context  pctx;
+       __u32   free_blocks = 0, free_inodes = 0;
 
        inodes_per_block = EXT2_INODES_PER_BLOCK(fs->super);
        ipg_max = inodes_per_block * (blocks_per_group - 4);
@@ -462,6 +463,8 @@ void check_super_block(e2fsck_t ctx)
                        ctx->invalid_inode_table_flag[i]++;
                        ctx->invalid_bitmaps++;
                }
+               free_blocks += fs->group_desc[i].bg_free_blocks_count;
+               free_inodes += fs->group_desc[i].bg_free_inodes_count;
                first_block += fs->super->s_blocks_per_group;
                last_block += fs->super->s_blocks_per_group;
        }
@@ -488,6 +491,21 @@ void check_super_block(e2fsck_t ctx)
                }
        }
 #endif
+
+       /*
+        * Update the global counts from the block group counts.  This
+        * is needed for an experimental patch which eliminates
+        * locking the entire filesystem when allocating blocks or
+        * inodes; if the filesystem is not unmounted cleanly, the
+        * global counts may not be accurate.
+        */
+       if (!(ctx->options & E2F_OPT_READONLY) &&
+           ((free_blocks != fs->super->s_free_blocks_count) ||
+            (free_inodes != fs->super->s_free_inodes_count))) {
+               fs->super->s_free_blocks_count = free_blocks;
+               fs->super->s_free_inodes_count = free_inodes;
+               ext2fs_mark_super_dirty(fs);
+       }
        
        /*
         * For the Hurd, check to see if the filetype option is set,
index 116203228d66ecac18e0203af2ddb20b5a2d3831..40659073da03d1b9a9182b5fac714c551fd0466a 100644 (file)
@@ -1,3 +1,10 @@
+2003-04-05  Theodore Ts'o  <tytso@mit.edu>
+
+       * f_baddir, f_dup, f_dup2, f_end-bitmap, f_lpf: Update test cases
+               to deal with changes to automatically calculate and update
+               the global inode and block counts at the beginning of the
+               e2fsck run.
+
 2003-03-25  Theodore Ts'o  <tytso@mit.edu>
 
        * f_h_badnode, f_h_badroot, f_h_reindex: Updated expect script to
index 375a2bf9c0696be9f3d331da6c61129397c5be2c..d47352dc8f80052887ba1a7b29c17ccfda0daf45 100644 (file)
@@ -39,9 +39,6 @@ Pass 5: Checking group summary information
 Block bitmap differences:  -22
 Fix? yes
 
-Free blocks count wrong (74, counted=75).
-Fix? yes
-
 Inode bitmap differences:  -13
 Fix? yes
 
index a6745c415726d9b9df550fd5ca0186d75aa46a9e..e09a786ac2a52a8479ed319ed027ad7e800485c2 100644 (file)
@@ -26,7 +26,7 @@ Pass 5: Checking group summary information
 Free blocks count wrong for group #0 (44, counted=60).
 Fix? yes
 
-Free blocks count wrong (62, counted=60).
+Free blocks count wrong (44, counted=60).
 Fix? yes
 
 Padding at end of block bitmap is not set. Fix? yes
index 28b740428ed467d3dc7b0218e12cd98ed4cb8e03..5d448fe535a482e6c7cb8e05b0e00d36f0013ba2 100644 (file)
@@ -33,7 +33,7 @@ Pass 5: Checking group summary information
 Free blocks count wrong for group #0 (8, counted=22).
 Fix? yes
 
-Free blocks count wrong (26, counted=22).
+Free blocks count wrong (8, counted=22).
 Fix? yes
 
 Padding at end of block bitmap is not set. Fix? yes
index 87e2fd647bbbd37e0e369f942c1ed2b97f349129..3348a2b316bcb2bed3ab3e7f559f9a70877e5c85 100644 (file)
@@ -8,6 +8,9 @@ Pass 5: Checking group summary information
 Free blocks count wrong for group #0 (44, counted=63).
 Fix? yes
 
+Free blocks count wrong (44, counted=63).
+Fix? yes
+
 Padding at end of block bitmap is not set. Fix? yes
 
 
index 4f2853c5b19764becbcde9549a38da4446b01318..6c0a746c96ef13a68e9aa126688b96fe0154dce8 100644 (file)
@@ -30,7 +30,7 @@ Fix? yes
 Free blocks count wrong for group #0 (24, counted=33).
 Fix? yes
 
-Free blocks count wrong (38, counted=33).
+Free blocks count wrong (24, counted=33).
 Fix? yes
 
 Inode bitmap differences:  +13