Commit Graph

7 Commits (9f6ba888f027ba4daf57ac61a11a6dce98e42347)

Author SHA1 Message Date
Justin Maggard 4fca2b9c07 Fix EXT4_FEATURE_RO_COMPAT_HUGE_FILE check
Creating a 4TB file on a filesystem with the 64bit flag set results in
e2fsck consistently complaining about i_blocks being wrong, with
confusing messages like this:

Inode 29818882, i_blocks is 8388608816, should be 8388608816.  Fix? no

That appears to be caused by ext2fs_inode_i_blocks() checking for the
EXT4_FEATURE_RO_COMPAT_HUGE_FILE in the wrong place.  Fix it.

Signed-off-by: Justin Maggard <jmaggard10@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-11-22 17:32:28 -05:00
Eric Sandeen efe0b40146 libext2fs: make fs->group_desc opaque
To prevent direct array indexing of fs->group_desc[i] (because the
group_desc may be a different size for different filesystems) make it
an opaque pointer that may only be accessed through the accessor
functions in blknum.c.  The type itself is still available in a public
header; if we have a group_desc that we know is one type or another,
it's ok to access its fields directly.  This change only prevents us
from indexing off fs->group_desc[i] directly.

Old-style applications who don't want to change their source code can
(as a temporary short-term hack) #define EXT2FS_OLD_32_COMPAT before
including ext2fs.h.

Change the accessors in blknum.c to use ext4fs_group_desc(), a version
of ext2fs_group_desc() which returns a ext4_group_desc pointer.

This simplifies and collapses a fair bit of code in blknum.c

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 21:00:00 -04:00
Theodore Ts'o cd65a24e75 libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(),
we're left with ext2fs_bg_flag_test().  Convert it to
ext2fs_bg_flags_test().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:42:12 -04:00
Eric Sandeen e633b58ac7 libext2fs: clean up ext2fs_bg_flags_ interfaces
The ext2fs_bg_flag* functions were confusing.

Currently we have this:

void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);

(_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags)

and these, which can twiddle individual bits in bg_flags:

void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);

A better interface, after the patch below, is just:

ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */

and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:41:32 -04:00
Theodore Ts'o 72a729dbf9 Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
2009-10-24 15:14:54 -04:00
Nick Dokos d62d218f11 libext2fs: Fix counting routines in blknum.c to take/return __u32 counts
Several routines in lib/ext2fs/blknum.c:

        ext2fs_bg_free_blocks_count()
        ext2fs_bg_free_inodes_count()
        ext2fs_bg_used_dirs_count()
        ext2fs_bg_itable_unused()

and their _set() counterparts, operate as if they are dealing with
blk64_t quantities, but they should be dealing with __u32 counts
instead.

Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07 21:13:59 -04:00
Jose R. Santos e3854b3b7c Add new blk64_t handling functions
Add new blknum.c file which contains funtions to handle blk64_t and
low/high values in super blocks and inodes.

(Includes fixes from Nick Dokos, and additions from Valerie Aurora Henson)

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-06 15:22:43 -04:00