Commit Graph

1013 Commits (0eeec8ac61bf1eaa31533b2be825cd75580829c9)

Author SHA1 Message Date
Theodore Ts'o 0eeec8ac61 Fix compiling under diet libc
Some recent changes had caused diet libc support to bitrot.  Fix up
missing header files and other portability fixups needed for dietlibc.
(Many of these changes also improve general portability.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-12 09:10:39 -04:00
Theodore Ts'o a846a6e0a7 Install with relative symlinks if $(root_libdir) == $(libdir)
When installing the ELF link library, avoid using absolute pathnames
if $(root_libdir) and $(libdir) are the same.

Addresses-Sourceforge-Bug: #1782913

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-07 03:17:22 -04:00
Theodore Ts'o 97be89b60b Fix pkg-config files: use Requires.private and fix the include directory
Addresses-Sourceforge-Bug: #2089537

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-02 21:20:44 -04:00
Theodore Ts'o e01f9be336 libext2fs: Compile ext2fs_swab64() for all platforms
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>
2008-09-02 08:49:10 -04:00
Theodore Ts'o 5c0255e8ad libext2fs: Remove unused ext2fs_find_{first,ext}_bit_set()
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>
2008-09-02 08:47:19 -04:00
Theodore Ts'o af773654b2 Enable test_io debugging by default
Test I/O debugging is incredibly useful for rooting out problems, so
let's enable by default, especially now that its overhead is only
incurred when it is needed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-01 11:36:59 -04:00
Theodore Ts'o 7fd2651f67 libe2p: Fix potential core-dumping bug in iterate_on_dir()
iterate_on_dir() can try to copy too much data from the directory
entry, resulting in a crash.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-01 09:38:32 -04:00
Theodore Ts'o 94b993d56a Update makefile dependency for lib/e2p/Makefile.in
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-29 23:26:26 -04:00
Theodore Ts'o b55d73985c Further optimize journal placement for flex_bg filesystems
If the number of block groups is greater than half the flex_bg size,
the journal we be placed in the flex_bg super-group which is closest
to the mid-point of the filesystem, and in the first free block group
beyond where the metadata for the flex_bg is stored.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-28 10:20:43 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o 4690e621ac Improve future compatibility for the 64-bit I/O channel functions
Provide a C language wrapper function for io_channel_read_blk64() and
io_channel_write_blk64() instead of using a C preprocessor macro, with
an fallback to the old 32-bit functions if an application-provided I/O
channel manager doesn't supply 64-bit method functions and the block
numbers can fit in 32-bit integer.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 21:46:26 -04:00
Theodore Ts'o 9033faf525 libext2fs: Fix ext2fs_bmap() to work with extents and BMAP_ALLOC
Fix bugs with extents support when allocating blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 18:37:11 -04:00
Theodore Ts'o 64987c052c ext2fs_block_iterate2: Fix memory leak on error paths
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:50:14 -04:00
Theodore Ts'o 961306d31a If the filesystem supports extents create an extent-based journal inode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:47:39 -04:00
Theodore Ts'o 685d544eff ext2fs_block_iterate2: Add BLOCK_FLAG_APPEND support for extent-based files
This is needed so that extent-based inodes (including a journal inode)
can be created via block_iterate.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:47:30 -04:00
Theodore Ts'o 1af01e94cc Create the journal in the middle of the filesystem
This speeds up access to the journal by eliminating worst-case seeks
from one end of the disk to another, which can be quite common in very
fsync-intensive workloads if the file is located near the end of the
disk, and the journal is located the beginning of the disk.

In addition, this can help eliminate journal fragmentation when
flex_bg is enabled, since the first block group has a large amount of
metadata.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:04:16 -04:00
Theodore Ts'o 674c0cc4cb ext2fs_mkjournal(): Don't allocate an extra block to the journal
Addresses-Sourceforge-Bug: 1483791

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:03:37 -04:00
Theodore Ts'o e6baebd2a9 libblkid: Give a priority bonus to "leaf" devicemapper devices
Give a boost to dm devices which are not used to build other dm
devices, since "leaf" devices are generally more likely to be
interesting as devices to mount.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 02:24:51 -04:00
Theodore Ts'o 0bb740621f libblkid: Unexport the private symbol blkid_devdirs
blkid_devdirs was defined in blkidP.h and was never intended to be
used outside of the library.  Since it no longer needs to be shared
across object files, rename it and turn it into a static variable.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 00:00:44 -04:00
Theodore Ts'o 7515a74478 Remove use of devmapper library by the blkid library
The devmapper library is no longer needed given commit f4e89bcd.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-26 23:56:00 -04:00
Theodore Ts'o f4e89bcdf2 libblkid: Optimize devicemapper support
This commit works by removing all calls from libdevmapper altogether,
and using the standard support for "normal" non-dm devices.

It depends on dm devices being placed in /dev/mapper (but the previous
code had this dependency anyway), and /proc/partitions containing dm
devices.

We don't actually rip out the libdevmapper code in this commit, but
just disable it via #undef HAVE_DEVMAPPER, just so it's easier to
review and understand the fundamental code changes.  A subsequent
commit will remove the libdevmapper code, as well as unexport
the blkid_devdirs string array.

Thanks to Karel Zak for inspiring me to look at the dm code in blkid,
so I could realize how much it deserved to ripped out by its roots.  :-)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-26 23:53:22 -04:00
Theodore Ts'o 5dd77dbe5a Add support for with empty directory blocks in 64k blocksize filesystems
The rec_len field in the directory entry is 16 bits, so if the
filesystem is completely empty, rec_len of 0 is used to designate
65536, for the case where the directory entry takes the entire 64k
block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-25 21:08:19 -04:00
Theodore Ts'o d56ccbd8f9 libblkid: Fix namespace leakage of unicode_16be_to_utf8
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 23:34:13 -04:00
Theodore Ts'o e32677cd58 libe2p: Fix namespace leakage of os_tab
Make os_tab static, since there's no reason it should be exposed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 22:46:31 -04:00
Theodore Ts'o c4dcb1c10a libext2fs: Fix namespace leakage of crc16 functions
Rename crc16 to ext2fs_crc16, and make crc16_table static, since
there's not reason it should be exposed at all.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 22:44:33 -04:00
Andreas Dilger 03efde8abe add debugfs command to print known features
Print out the currently supported features of e2fsprogs/libext2fs
via a new "debugfs supported_features" command.  This helps scripts
to know whether it is possible to try and enable specific features
in the filesystem.

Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-24 21:31:52 -04:00
Andreas Dilger 9f9e5c3aea libext2fs: grow dblist more aggressively
Make the dblist grow more quickly when many directory blocks are added,
otherwise the array has to get copied too often, which is slow when it
is large.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-24 20:55:49 -04:00
Andreas Dilger 864b8d4eab Fix miscellaneous compile warnings
Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 20:37:39 -04:00
Theodore Ts'o b41fb00225 libblkid: Strengthen the JFS probe routine
Check to make sure a JFS filesystem is really correct by checking the
relationship between the following fields in the JFS superblock:
s_bsize, s_l2bsize, s_pbsize, s_l2pbsize, and s_l2bfactor.  Thanks to
Lesh Bogdanow for this suggestion.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 17:29:33 -04:00
Theodore Ts'o 78d89cda68 libblkid: Fix false detection of DFSee created filesystems.
OS/2 and DFSee creates a pseudo FAT-12/16 header in the first 512
bytes of a filesystem which looks enough like a FAT-12/16 to fool
blkid.  Part of this is because we don't require ms_magic or vs_magic
to be the strings "FAT12 ", "FAT16 ", or "FAT32 ", since some FAT
filesystem formatters don't set ms_magic or vs_magic.  To address
this, we explicitly test for "JFS     " and "HPFS    " in ms_magic,
and if they are found, we assume the filesystem is definitely not
a FAT filesystem.

Addresses-Launchpad-Bug: #255255

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 17:24:18 -04:00
Manish Katiyar baf8ab980e libext2fs: Fix memory leak in ext2fs_initialize().
Below patch ensures that cleanup is done properly in ext2fs_initialize
from all return paths in case of errors.

Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-23 09:08:23 -04:00
Theodore Ts'o 9c460caae3 libblkid: Enhance support for MacOS's hfs, hfsplus, and hfsx filesystems
Add detection for hfsx filesystems.  Add label and uuid detetion for
hfs, hfsplus, and hfsx.

Addresses-Sourceforge-Feature-Requests: #2060292

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 16:45:44 -04:00
Theodore Ts'o 5b7adf0690 libblkid: Fix potential crash if blkid cache is out of date when probing
Fix bug added in 57926c8c55

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 12:43:14 -04:00
Theodore Ts'o 6ec9ef1881 libuuid: Windows portability fixes
Make the uuid library (more) portable for Windows.

Addresses-Sourceforge-Feature-Request: #1937287

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 12:15:56 -04:00
Theodore Ts'o 2d40a91e17 libext2fs: Replace use of sprintf with strcpy/strcat to help SILO
Some bootloaders, like SILO, don't provide sprintf in their limited
bootloader environment.  Since the uses in rw_bitmaps.c is only doing
sprintf("foo %s"), it's easy to replace that usage with strcpy/strcat.

Addresses-Sourceforge-Bug: #2049120

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 10:37:18 -04:00
Theodore Ts'o c71d781370 libext2fs: Add support for uninit_bg feature to allocation functions
If the allocation functions need to allocate out of a block group
where the inode and/or block bitmaps have not yet been initialized,
initialize them so ext2fs_new_block() and ext2fs_new_inode() work
correctly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 02:52:12 -04:00
Theodore Ts'o 213fe9288b ext2fs_block_iterate2(): Support changing interior nodes of an extent tree
Resize2fs needs to be able to relocate the interior nodes of an extent
tree.  Add support for this feature via ext2fs_extent_replace().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 02:50:02 -04:00
Theodore Ts'o da994e9c11 ext2fs_extent_set_bmap(): Avoid creating extra extents for resize2fs
When resize2fs moves blocks belonging to an inode, it will call
ext2fs_extent_set_bmap() for logical blocks 0, 1, 2, 3, ...

Optimize for this calling pattern so we don't end up creating a
separate extent for each block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 02:46:16 -04:00
Theodore Ts'o 2047e0a1ee ext2fs_extent_set_bmap(): fix bug when replacing a single block extent
When replacing a single block extent, make sure we set or clear the
uninitialized extent flag as requested by the caller.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 02:43:59 -04:00
Theodore Ts'o a9ea7285e6 Fix ext2fs_extent_set_bmap() when setting a block before the first extent
When setting a logical block which is before the first extent in the
extent tree, make sure the new extent goes in front, at the very
beginning of the extent tree.  This fixes a bug where previously the
new extent would be inserted out of order in this case.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-22 02:43:05 -04:00
Theodore Ts'o 57fd39e943 libext2fs: Fix reading bitmaps from e2image files
Fix a signed vs. unsigned bug that was accidentally introduced in
commit f1f115a7, which was introduced in e2fsprogs 1.41.0

Addresses-Debian-Bug: #495830

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-21 17:56:44 -04:00
Manish Katiyar f93d9f653c libext2fs : Fix memory leaks in ext2fs_extent_open()
Memory allocated for the ext2_extent_handle is not getting freed from
all the return paths in case of error. Below patch fixes it.

Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-16 10:52:25 -04:00
Li Zefan f64b36d138 Fix a typo in lib/e2p/Makefile.in
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-15 07:46:02 -04:00
Theodore Ts'o 3bcc6276a0 libext2fs: Initialize unset inode timestamps when writing a new inode
As Li Zefan <lizf@cn.fujitsu.com> reported, the creation timestamp was
not getting set on the lost+found inode.  This patch makes sure all of
the timestamps are appropriately set.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-14 14:44:15 -04:00
Benno Schulenberg dcf051eccc libblkid: On the man page, replace empty references with an existing one.
And update the FSF's address.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-14 13:31:37 -04:00
Theodore Ts'o 57926c8c55 blkid: Fix probing logic so we find renamed devices
This fixes a bug where if there is an entry in the /etc/blkid.tab file
for a particular device (major, minor) number but the filename does
not exist, blkid wouldn't try to find the correct filename.

Addresses-Debian-Bug: #493216
2008-08-09 22:37:58 -04:00
Aneesh Kumar K.V ac24e62c4e e2fsprogs: Fix tst_extents output on bigendian machine.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-07-18 21:16:32 -04:00
Frederic Bohe b526459399 Fix inode table allocation with flexbg
Disordered inode tables may appear when inode_blocks_per_group is lesser
or equal to the number of groups in a flex group.

This bug can be reproduced with:
	mkfs.ext4 -t ext4dev -G512 70G

In that case, you can see with dump2fs that inode tables for groups 510
and 511 are placed just after group 51's inode table instead of being
placed after group 509's inode table.

Signed-off-by: Frederic Bohe <frederic.bohe@bull.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-07-17 11:11:48 -04:00
Manish Katiyar 8eb3b8a0a0 ext2fs_read_inode: Check the validity of the inode number earlier
It looks like the right place to check for ino=0 in
ext2fs_read_inode_full() is before creating the inode cache, otherwise
since we set icache[i].ino = 0 in create_icache(), it will match the
loop below and thus we return a wrong value.

Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-15 11:10:19 -04:00
Theodore Ts'o f56aa6e6ee Don't assume that /bin/true is always in /bin
... because it isn't on MacOS X

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-14 17:47:52 -04:00