]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix bug where ext2fs_mkdir wasn't correctly bumping the number of
authorTheodore Ts'o <tytso@mit.edu>
Sun, 3 Feb 2002 06:28:52 +0000 (01:28 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 3 Feb 2002 06:28:52 +0000 (01:28 -0500)
directories in use in a bloock group.

lib/ext2fs/ChangeLog
lib/ext2fs/alloc_stats.c
lib/ext2fs/ext2fs.h
lib/ext2fs/mkdir.c

index ee2a003fe3864a7b69acd338706105caa6eaa860..2a817dd582afa93e30e76d4151f8c3f14805a781 100644 (file)
@@ -2,6 +2,16 @@
 
        * Release of E2fsprogs 1.26
 
+2002-02-03  Theodore Tso  <tytso@valinux.com>
+
+       * mkdir.c (ext2fs_mkdir): Change to use ext2fs_inode_alloc_stats2
+               so that the number of directories in use is adjusted
+               appropriately.
+
+       * alloc_stats.c (ext2fs_inode_alloc_stats2): Add new function
+               which optionally will modify the number of directories
+               count.
+
 2002-01-03  Theodore Tso  <tytso@mit.edu>
 
        * dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
index 986f459fb12ebd30b7b2b7e95d6c64df49835d30..4088f7b87df26f0cc09e0cca21d4fc4dc38378d0 100644 (file)
@@ -15,7 +15,8 @@
 #include "ext2_fs.h"
 #include "ext2fs.h"
 
-void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
+void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
+                              int inuse, int isdir)
 {
        int     group = ext2fs_group_of_ino(fs, ino);
 
@@ -24,11 +25,18 @@ void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
        else
                ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
        fs->group_desc[group].bg_free_inodes_count -= inuse;
+       if (isdir)
+               fs->group_desc[group].bg_used_dirs_count += inuse;
        fs->super->s_free_inodes_count -= inuse;
        ext2fs_mark_super_dirty(fs);
        ext2fs_mark_ib_dirty(fs);
 }
 
+void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
+{
+       ext2fs_inode_alloc_stats2(fs, ino, inuse, 0);
+}
+
 void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse)
 {
        int     group = ext2fs_group_of_blk(fs, blk);
index bfca032698e15958fa31d5dea311b509a773bf50..75512d110aa15ee7421cf4c4832d10905014160e 100644 (file)
@@ -445,6 +445,8 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
 
 /* alloc_stats.c */
 void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
+void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
+                              int inuse, int isdir);
 void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
 
 /* alloc_tables.c */
index 4fa711d01af87ebe2064200286069a11752b2f2a..ea189d9c2f03aba7efe26f5aa595949eeb9bcdac 100644 (file)
@@ -130,7 +130,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
         * Update accounting....
         */
        ext2fs_block_alloc_stats(fs, blk, +1);
-       ext2fs_inode_alloc_stats(fs, ino, +1);
+       ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
 
 cleanup:
        if (block)