Although nothing uses ext2fs_swab64() yet, debian's dpkg-gensymbols
picked up the fact that ext2fs_swab64() isn't getting defined on
non-x86 platforms. Oops. This patch moves the definition of
ext2fs_swab64() to a place where it will be compiled for all
architectures.
Addresses-Debian-Bug: #497515
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
These functions were commented out for x86, but they were still being
defined for other architectures. We now remove them entirely.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Fedora seems to be gearing up to add
-Werror-implicit-function-declaration
to the standard build flags, so I thought I'd get out ahead
of this one...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This changes ext2fs_fast_{mark,unmark,test}_{inode,block}_bitmap() to
be inline functions which calls ext2fs_{mark,unmark,test}_generic_bitmap().
This is part of the preparation to support the new-style bitmaps.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The x86 assembly instructures for bit test-and-set, test-and-clear,
etc., interpret the bit number as a 32-bit signed number, which is
problematic in order to support filesystems > 8TB.
Added new inline functions (in C) to implement a
ext2fs_fast_set/clear_bit() that does not return the old value of the
bit, and use it for the fast block/bitmap functions.
Added a regression test suite to test the low-level bit operations
functions to make sure they work correctly.
Note that a bitmap can address 2**32 blocks requires 2**29 bytes, or
512 megabytes. E2fsck requires 3 (and possibly 4 block bitmaps),
which means that the block bitmaps can require 2GB all by themselves,
and this doesn't include the 4 or 5 inode bitmaps (which assuming an
8k inode ratio, will take 256 megabytes each). This means that it's
more likely that a filesystem check of a filesystem greater than 2**31
blocks will fail if the e2fsck is dynamically linked (since the shared
libraries can consume a substantial portion of the 3GB address space
available to x86 userspace applications). Even if e2fsck is
statically linked, for a badly damaged filesystem, which may require
additional block and/or inode bitmaps, I am not sure e2fsck will
succeed in all cases.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
We no longer have the sparc assembly code in the header file any more, so we
shouldn't set _EXT2_HAVE_AS_BITOPS_. This would break compiles on the sparc
architectures when using gcc.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext2fs_test_bit to take an unsigned int for the bit number. Negative
bit numbers were never allowed (and didn't make any sense), so this should
be a safe change. This is needed to allow safe use of block numbers
greater than or equal to 2**31.
than the GCC 3.4 compile code and triggers compiler warnings on
sparc64. Thanks to Matthias Andree for his analysis and suggestions.
(Addresses Debian Bug #232326)
Remove support for the --enable-old-bitops configure option which
was only for very old sparc systems.
included if EXT2FS_ENABLE_SWAPFS is defined, since we need to support
byte swapping even if we don't support the conversion functions.
(Fixes Debian bug #101686).
Makefile.in, gen_bitmap.c, bitops.h: Move inline functions
ext2fs_mark_generic_bitmap and ext2fs_unmark_generic_bitmap to
gen_bitmap.c as normal functions. (This saves space and doesn't
significantly change the speed of e2fsck on a P-III.)
ChangeLog:
Add missing log entry for unix.c.
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
bitops.h (ext2fs_swab16, ext2fs_swab32): Add i386 assembly inline
functions.
tst_byteswap.c: New function to test the byteswap functions. Add to
regression test suite.
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
bitops.h (ext2fs_mark_generic_bitmap, ext2fs_unmark_generic_bitmap,
ext2fs_mark_block_bitmap, ext2fs_unmark_block_bitmap,
ext2fs_mark_inode_bitmap, ext2fs_unmark_inode_bitmap): Change to
return the previous state of the bit that is being marked or unmarked.
For speed optimization.
ChangeLog, pass3.c:
pass3.c (check_directory): Only do the loop detection algorithm if
we've searched over 2048 parent directories and haven't found the end
yet. This means that in the common case, we don't allocate or clear
the inode_loop_detection bitmap, which for large systems, merely
clearing the bitmap for each directory was turning out to be quite
expensive. Thanks to Jani Jaakkola (jjaakkol@cs.helsinki.fi) for
identifying this problem.
ChangeLog, Makefile.in, e2fsck.h, unix.c:
Makefile.in: Call sync after finishing building all in this directory.
unix.c (PRS): sync the filesystem before trying to use BLKFLSBUF, to
minimize the chance of causing dirty blocks to get dropped.
e2fsck.h: Manually define BLKFLSBUF if not defined, and we're on a
Linux/i386 system.
ext2fs.h, bitops.h: Add support for the Watcom C compiler to do inline
functions.
ext2fs.h, dosio.c: Use asm/types.h instead of linux/types.h to evade a
potential problem with glibc's header files trying to spike out
linux/types.h.
ext2fs.h (ext2fs_resize_mem): Change the function prototype to include
the old size of the memory, which is needed for some braindamaged
memory allocation systems that don't support realloc().
badblocks.c (ext2fs_badblocks_list_add):
bb_inode.c (clear_bad_block_proc):
dblist.c (ext2fs_add_dir_block):
icount.c (insert_icount_el):
irel_ma.c (ima_put):
rs_bitmap.c (ext2fs_resize_generic_bitmap): Update functions to pass
the old size of the memory to be resized to ext2fs_resize_mem().
ChangeLog, dirinfo.c:
dirinfo.c (e2fsck_add_dir_info): Update function to pass the old size
of the memory to be resized to ext2fs_resize_mem().
ChangeLog, extent.c, resize2fs.c:
resize2fs.c (adjust_superblock):
extent.c (ext2fs_add_extent_entry): Update functions to pass the old
size of the memory to be resized to ext2fs_resize_mem().
bitops.h: Don't try to do i386 inline asm functions if the compiler
isn't GCC.
ext2fs.h: If EXT2_FLAT_INCLUDES is defined, #include e2_types.h,
instead of linux/types.h, and e2_bitops.h instead of ext2fs/bitops.h.
icount.c, version.c: Don't #include <et/com_err.h>, as it isn't necessary.