summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/CHANGES157
-rw-r--r--fs/ext2/acl.c6
-rw-r--r--fs/ext2/balloc.c73
-rw-r--r--fs/ext2/ialloc.c40
-rw-r--r--fs/ext2/super.c16
5 files changed, 3 insertions, 289 deletions
diff --git a/fs/ext2/CHANGES b/fs/ext2/CHANGES
deleted file mode 100644
index aa5aaf0e5911..000000000000
--- a/fs/ext2/CHANGES
+++ /dev/null
@@ -1,157 +0,0 @@
-Changes from version 0.5a to version 0.5b
-=========================================
- - Now that we have sysctl(), the immutable flag cannot be changed when
- the system is running at security level > 0.
- - Some cleanups in the code.
- - More consistency checks on directories.
- - The ext2.diff patch from Tom May <ftom@netcom.com> has been
- integrated. This patch replaces expensive "/" and "%" with
- cheap ">>" and "&" where possible.
-
-Changes from version 0.5 to version 0.5a
-========================================
- - Zero the partial block following the end of the file when a file
- is truncated.
- - Dates updated in the copyright.
- - More checks when the filesystem is mounted: the count of blocks,
- fragments, and inodes per group is checked against the block size.
- - The buffers used by the error routines are now static variables, to
- avoid using space on the kernel stack, as requested by Linus.
- - Some cleanups in the error messages (some versions of syslog contain
- a bug which truncates an error message if it contains '\n').
- - Check that no data can be written to a file past the 2GB limit.
- - The famous readdir() bug has been fixed by Stephen Tweedie.
- - Added a revision level in the superblock.
- - Full support for O_SYNC flag of the open system call.
- - New mount options: `resuid=#uid' and `resgid=#gid'. `resuid' causes
- ext2fs to consider user #uid like root for the reserved blocks.
- `resgid' acts the same way with group #gid. New fields in the
- superblock contain default values for resuid and resgid and can
- be modified by tune2fs.
- Idea comes from Rene Cougnenc <cougnenc@renux.frmug.fr.net>.
- - New mount options: `bsddf' and `minixdf'. `bsddf' causes ext2fs
- to remove the blocks used for FS structures from the total block
- count in statfs. With `minixdf', ext2fs mimics Minix behavior
- in statfs (i.e. it returns the total number of blocks on the
- partition). This is intended to make bde happy :-)
- - New file attributes:
- - Immutable files cannot be modified. Data cannot be written to
- these files. They cannot be removed, renamed and new links cannot
- be created. Even root cannot modify the files. He has to remove
- the immutable attribute first.
- - Append-only files: can only be written in append-mode when writing.
- They cannot be removed, renamed and new links cannot be created.
- Note: files may only be added to an append-only directory.
- - No-dump files: the attribute is not used by the kernel. My port
- of dump uses it to avoid backing up files which are not important.
- - New check in ext2_check_dir_entry: the inode number is checked.
- - Support for big file systems: the copy of the FS descriptor is now
- dynamically allocated (previous versions used a fixed size array).
- This allows to mount 2GB+ FS.
- - Reorganization of the ext2_inode structure to allow other operating
- systems to create specific fields if they use ext2fs as their native
- file system. Currently, ext2fs is only implemented in Linux but
- will soon be part of Gnu Hurd and of Masix.
-
-Changes from version 0.4b to version 0.5
-========================================
- - New superblock fields: s_lastcheck and s_checkinterval added
- by Uwe Ohse <uwe@tirka.gun.de> to implement timedependent checks
- of the file system
- - Real random numbers for secure rm added by Pierre del Perugia
- <delperug@gla.ecoledoc.ibp.fr>
- - The mount warnings related to the state of a fs are not printed
- if the fs is mounted read-only, idea by Nick Holloway
- <alfie@dcs.warwick.ac.uk>
-
-Changes from version 0.4a to version 0.4b
-=========================================
- - Copyrights changed to include the name of my laboratory.
- - Clean up of balloc.c and ialloc.c.
- - More consistency checks.
- - Block preallocation added by Stephen Tweedie.
- - Direct reads of directories disallowed.
- - Readahead implemented in readdir by Stephen Tweedie.
- - Bugs in block and inodes allocation fixed.
- - Readahead implemented in ext2_find_entry by Chip Salzenberg.
- - New mount options:
- `check=none|normal|strict'
- `debug'
- `errors=continue|remount-ro|panic'
- `grpid', `bsdgroups'
- `nocheck'
- `nogrpid', `sysvgroups'
- - truncate() now tries to deallocate contiguous blocks in a single call
- to ext2_free_blocks().
- - lots of cosmetic changes.
-
-Changes from version 0.4 to version 0.4a
-========================================
- - the `sync' option support is now complete. Version 0.4 was not
- supporting it when truncating a file. I have tested the synchronous
- writes and they work but they make the system very slow :-( I have
- to work again on this to make it faster.
- - when detecting an error on a mounted filesystem, version 0.4 used
- to try to write a flag in the super block even if the filesystem had
- been mounted read-only. This is fixed.
- - the `sb=#' option now causes the kernel code to use the filesystem
- descriptors located at block #+1. Version 0.4 used the superblock
- backup located at block # but used the main copy of the descriptors.
- - a new file attribute `S' is supported. This attribute causes
- synchronous writes but is applied to a file not to the entire file
- system (thanks to Michael Kraehe <kraehe@bakunin.north.de> for
- suggesting it).
- - the directory cache is inhibited by default. The cache management
- code seems to be buggy and I have to look at it carefully before
- using it again.
- - deleting a file with the `s' attribute (secure deletion) causes its
- blocks to be overwritten with random values not with zeros (thanks to
- Michael A. Griffith <grif@cs.ucr.edu> for suggesting it).
- - lots of cosmetic changes have been made.
-
-Changes from version 0.3 to version 0.4
-=======================================
- - Three new mount options are supported: `check', `sync' and `sb=#'.
- `check' tells the kernel code to make more consistency checks
- when the file system is mounted. Currently, the kernel code checks
- that the blocks and inodes bitmaps are consistent with the free
- blocks and inodes counts. More checks will be added in future
- releases.
- `sync' tells the kernel code to use synchronous writes when updating
- an inode, a bitmap, a directory entry or an indirect block. This
- can make the file system much slower but can be a big win for files
- recovery in case of a crash (and we can now say to the BSD folks
- that Linux also supports synchronous updates :-).
- `sb=#' tells the kernel code to use an alternate super block instead
- of its master copy. `#' is the number of the block (counted in
- 1024 bytes blocks) which contains the alternate super block.
- An ext2 file system typically contains backups of the super block
- at blocks 8193, 16385, and so on.
- - I have change the meaning of the valid flag used by e2fsck. it
- now contains the state of the file system. If the kernel code
- detects an inconsistency while the file system is mounted, it flags
- it as erroneous and e2fsck will detect that on next run.
- - The super block now contains a mount counter. This counter is
- incremented each time the file system is mounted read/write. When
- this counter becomes bigger than a maximal mount counts (also stored
- in the super block), e2fsck checks the file system, even if it had
- been unmounted cleanly, and resets this counter to 0.
- - File attributes are now supported. One can associate a set of
- attributes to a file. Three attributes are defined:
- `c': the file is marked for automatic compression,
- `s': the file is marked for secure deletion: when the file is
- deleted, its blocks are zeroed and written back to the disk,
- `u': the file is marked for undeletion: when the file is deleted,
- its contents are saved to allow a future undeletion.
- Currently, only the `s' attribute is implemented in the kernel
- code. Support for the other attributes will be added in a future
- release.
- - a few bugs related to times updates have been fixed by Bruce
- Evans and me.
- - a bug related to the links count of deleted inodes has been fixed.
- Previous versions used to keep the links count set to 1 when a file
- was deleted. The new version now sets links_count to 0 when deleting
- the last link.
- - a race condition when deallocating an inode has been fixed by
- Stephen Tweedie.
-
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 213148c36ebe..6af2f4130290 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -194,8 +194,7 @@ ext2_get_acl(struct inode *inode, int type)
acl = NULL;
else
acl = ERR_PTR(retval);
- if (value)
- kfree(value);
+ kfree(value);
if (!IS_ERR(acl)) {
switch(type) {
@@ -262,8 +261,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
error = ext2_xattr_set(inode, name_index, "", value, size, 0);
- if (value)
- kfree(value);
+ kfree(value);
if (!error) {
switch(type) {
case ACL_TYPE_ACCESS:
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 6591abef64d0..bb6908066494 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -624,76 +624,3 @@ unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
return EXT2_SB(sb)->s_gdb_count;
}
-#ifdef CONFIG_EXT2_CHECK
-/* Called at mount-time, super-block is locked */
-void ext2_check_blocks_bitmap (struct super_block * sb)
-{
- struct buffer_head *bitmap_bh = NULL;
- struct ext2_super_block * es;
- unsigned long desc_count, bitmap_count, x, j;
- unsigned long desc_blocks;
- struct ext2_group_desc * desc;
- int i;
-
- es = EXT2_SB(sb)->s_es;
- desc_count = 0;
- bitmap_count = 0;
- desc = NULL;
- for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
- desc = ext2_get_group_desc (sb, i, NULL);
- if (!desc)
- continue;
- desc_count += le16_to_cpu(desc->bg_free_blocks_count);
- brelse(bitmap_bh);
- bitmap_bh = read_block_bitmap(sb, i);
- if (!bitmap_bh)
- continue;
-
- if (ext2_bg_has_super(sb, i) &&
- !ext2_test_bit(0, bitmap_bh->b_data))
- ext2_error(sb, __FUNCTION__,
- "Superblock in group %d is marked free", i);
-
- desc_blocks = ext2_bg_num_gdb(sb, i);
- for (j = 0; j < desc_blocks; j++)
- if (!ext2_test_bit(j + 1, bitmap_bh->b_data))
- ext2_error(sb, __FUNCTION__,
- "Descriptor block #%ld in group "
- "%d is marked free", j, i);
-
- if (!block_in_use(le32_to_cpu(desc->bg_block_bitmap),
- sb, bitmap_bh->b_data))
- ext2_error(sb, "ext2_check_blocks_bitmap",
- "Block bitmap for group %d is marked free",
- i);
-
- if (!block_in_use(le32_to_cpu(desc->bg_inode_bitmap),
- sb, bitmap_bh->b_data))
- ext2_error(sb, "ext2_check_blocks_bitmap",
- "Inode bitmap for group %d is marked free",
- i);
-
- for (j = 0; j < EXT2_SB(sb)->s_itb_per_group; j++)
- if (!block_in_use(le32_to_cpu(desc->bg_inode_table) + j,
- sb, bitmap_bh->b_data))
- ext2_error (sb, "ext2_check_blocks_bitmap",
- "Block #%ld of the inode table in "
- "group %d is marked free", j, i);
-
- x = ext2_count_free(bitmap_bh, sb->s_blocksize);
- if (le16_to_cpu(desc->bg_free_blocks_count) != x)
- ext2_error (sb, "ext2_check_blocks_bitmap",
- "Wrong free blocks count for group %d, "
- "stored = %d, counted = %lu", i,
- le16_to_cpu(desc->bg_free_blocks_count), x);
- bitmap_count += x;
- }
- if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count)
- ext2_error (sb, "ext2_check_blocks_bitmap",
- "Wrong free blocks count in super block, "
- "stored = %lu, counted = %lu",
- (unsigned long)le32_to_cpu(es->s_free_blocks_count),
- bitmap_count);
- brelse(bitmap_bh);
-}
-#endif
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index e2d6208633a7..74714af4ae69 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -700,43 +700,3 @@ unsigned long ext2_count_dirs (struct super_block * sb)
return count;
}
-#ifdef CONFIG_EXT2_CHECK
-/* Called at mount-time, super-block is locked */
-void ext2_check_inodes_bitmap (struct super_block * sb)
-{
- struct ext2_super_block * es = EXT2_SB(sb)->s_es;
- unsigned long desc_count = 0, bitmap_count = 0;
- struct buffer_head *bitmap_bh = NULL;
- int i;
-
- for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
- struct ext2_group_desc *desc;
- unsigned x;
-
- desc = ext2_get_group_desc(sb, i, NULL);
- if (!desc)
- continue;
- desc_count += le16_to_cpu(desc->bg_free_inodes_count);
- brelse(bitmap_bh);
- bitmap_bh = read_inode_bitmap(sb, i);
- if (!bitmap_bh)
- continue;
-
- x = ext2_count_free(bitmap_bh, EXT2_INODES_PER_GROUP(sb) / 8);
- if (le16_to_cpu(desc->bg_free_inodes_count) != x)
- ext2_error (sb, "ext2_check_inodes_bitmap",
- "Wrong free inodes count in group %d, "
- "stored = %d, counted = %lu", i,
- le16_to_cpu(desc->bg_free_inodes_count), x);
- bitmap_count += x;
- }
- brelse(bitmap_bh);
- if (percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter) !=
- bitmap_count)
- ext2_error(sb, "ext2_check_inodes_bitmap",
- "Wrong free inodes count in super block, "
- "stored = %lu, counted = %lu",
- (unsigned long)le32_to_cpu(es->s_free_inodes_count),
- bitmap_count);
-}
-#endif
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3c0c7c6a5b44..e4ed4b31a433 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -281,7 +281,7 @@ static unsigned long get_sb_block(void **data)
enum {
Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid,
Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic,
- Opt_err_ro, Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug,
+ Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
Opt_usrquota, Opt_grpquota
@@ -303,7 +303,6 @@ static match_table_t tokens = {
{Opt_nouid32, "nouid32"},
{Opt_nocheck, "check=none"},
{Opt_nocheck, "nocheck"},
- {Opt_check, "check"},
{Opt_debug, "debug"},
{Opt_oldalloc, "oldalloc"},
{Opt_orlov, "orlov"},
@@ -376,13 +375,6 @@ static int parse_options (char * options,
case Opt_nouid32:
set_opt (sbi->s_mount_opt, NO_UID32);
break;
- case Opt_check:
-#ifdef CONFIG_EXT2_CHECK
- set_opt (sbi->s_mount_opt, CHECK);
-#else
- printk("EXT2 Check option not supported\n");
-#endif
- break;
case Opt_nocheck:
clear_opt (sbi->s_mount_opt, CHECK);
break;
@@ -503,12 +495,6 @@ static int ext2_setup_super (struct super_block * sb,
EXT2_BLOCKS_PER_GROUP(sb),
EXT2_INODES_PER_GROUP(sb),
sbi->s_mount_opt);
-#ifdef CONFIG_EXT2_CHECK
- if (test_opt (sb, CHECK)) {
- ext2_check_blocks_bitmap (sb);
- ext2_check_inodes_bitmap (sb);
- }
-#endif
return res;
}