aboutsummaryrefslogtreecommitdiff
path: root/ext2fs/ialloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext2fs/ialloc.c')
-rw-r--r--ext2fs/ialloc.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index f2d9348e..15c17a4e 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -1,8 +1,8 @@
/* Inode allocation routines.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,99,2000,02 Free Software Foundation, Inc.
- Converted to work under the hurd by Miles Bader <miles@gnu.ai.mit.edu>
+ Converted to work under the hurd by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/*
+/*
* linux/fs/ext2/ialloc.c
*
* Copyright (C) 1992, 1993, 1994, 1995
@@ -26,7 +26,7 @@
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
- * BSD ufs-inspired inode and directory allocation by
+ * BSD ufs-inspired inode and directory allocation by
* Stephen Tweedie (sct@dcs.ed.ac.uk), 1993
*/
@@ -42,10 +42,11 @@
*/
#include "ext2fs.h"
+#include "bitmap.c"
/* ---------------------------------------------------------------- */
-/* Free node NP; the on disk copy has already been synced with
+/* Free node NP; the on disk copy has already been synced with
diskfs_node_update (where NP->dn_stat.st_mode was 0). It's
mode used to be OLD_MODE. */
void
@@ -63,9 +64,9 @@ diskfs_free_node (struct node *np, mode_t old_mode)
spin_lock (&global_lock);
- if (inum < EXT2_FIRST_INO || inum > sblock->s_inodes_count)
+ if (inum < EXT2_FIRST_INO (sblock) || inum > sblock->s_inodes_count)
{
- ext2_error ("reserved inode or nonexistent inode: %u", inum);
+ ext2_error ("reserved inode or nonexistent inode: %Ld", inum);
spin_unlock (&global_lock);
return;
}
@@ -77,7 +78,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
bh = bptr (gdp->bg_inode_bitmap);
if (!clear_bit (bit, bh))
- ext2_warning ("bit already cleared for inode %u", inum);
+ ext2_warning ("bit already cleared for inode %Ld", inum);
else
{
record_global_poke (bh);
@@ -236,7 +237,7 @@ repeat:
}
inum += i * sblock->s_inodes_per_group + 1;
- if (inum < EXT2_FIRST_INO || inum > sblock->s_inodes_count)
+ if (inum < EXT2_FIRST_INO (sblock) || inum > sblock->s_inodes_count)
{
ext2_error ("reserved inode or inode > inodes count - "
"block_group = %d,inode=%d", i, inum);
@@ -290,7 +291,6 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
if (st->st_blocks)
{
- ext2_warning("Free inode %d had %d blocks", inum, st->st_blocks);
st->st_blocks = 0;
np->dn_set_ctime = 1;
}
@@ -301,15 +301,23 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
np->dn->info.i_data[block] = 0;
np->dn_set_ctime = 1;
}
- np->istranslated = 0;
+ if (np->dn->info_i_translator != 0)
+ {
+ np->dn->info_i_translator = 0;
+ np->dn_set_ctime = 1;
+ }
+ st->st_mode &= ~S_IPTRANS;
if (np->allocsize)
{
- ext2_warning ("Free inode %d had a size of %ld", inum, st->st_size);
st->st_size = 0;
np->allocsize = 0;
np->dn_set_ctime = 1;
}
+ /* Propagate initial inode flags from the directory, as Linux does. */
+ np->dn->info.i_flags =
+ ext2_mask_flags(mode, dir->dn->info.i_flags & EXT2_FL_INHERITED);
+
st->st_flags = 0;
/*
@@ -330,7 +338,7 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
/* ---------------------------------------------------------------- */
-unsigned long
+unsigned long
ext2_count_free_inodes ()
{
#ifdef EXT2FS_DEBUG
@@ -353,7 +361,7 @@ ext2_count_free_inodes ()
i, gdp->bg_free_inodes_count, x);
bitmap_count += x;
}
- ext2_debug ("stored = %lu, computed = %lu, %lu",
+ ext2_debug ("stored = %u, computed = %lu, %lu",
sblock->s_free_inodes_count, desc_count, bitmap_count);
spin_unlock (&global_lock);
return desc_count;
@@ -364,7 +372,7 @@ ext2_count_free_inodes ()
/* ---------------------------------------------------------------- */
-void
+void
ext2_check_inodes_bitmap ()
{
int i;