Commit Graph

874 Commits (b89fc30dd7ff8a81b195296299564df9c1ff5433)

Author SHA1 Message Date
Andreas Dilger 6f19f44a4c libext2fs: Micro-optimization in inode scan code
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-31 14:28:37 -04:00
Andreas Dilger f628acea26 ext2fs_set_gdt_csum(): Return an error code on errors instead of void
Change the function signature so that ext2fs_set_gdt_csum() returns an
error code.

If the inode bitmap hasn't been loaded return EXT2_ET_NO_INODE_BITMAP.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-31 14:28:37 -04:00
Andreas Dilger d78ea441a2 ext2fs_set_gdt_csum(): Force the last block group to have a valid block bitmap
Never set the UNINIT_BLOCKS flag for the last group since the kernel
doesn't handle the case graefully if there is a full set of blocks in
each blockgroup marked UNINIT_BLOCKS.  The kernel should be fixed up,
but in the meantime this avoids hitting the problem, and is more
consistent with lazy_bg not marking the last group UNINIT.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-31 14:28:37 -04:00
Andreas Dilger 80fc4e698a ext2fs_set_gdt_csum(): Clean up superblock dirty flag handling
Only mark the superblock as dirty if the function actually managed to
change part of the block group descriptor.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-31 14:28:37 -04:00
Andreas Dilger 02a73f12df Fix the copyright notice in lib/ext2fs/tst_csum.c to be GPLv2 only
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-30 14:14:31 -04:00
Eric Sandeen d89ad0aefd Fix parallel builds for lib/ext2fs/extent.o
Updated the Makefile dependencies using "make depend".

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-25 09:59:45 -04:00
Eric Sandeen fb6627a3fb libext2fs: Fix byte-swap logic for i_block[] in inodes with extents
ext2fs_swap_inode_full() was incorrectly swapping the i_block array
for extents.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-24 08:25:40 -04:00
Eric Sandeen 85b59c40f4 Fix ext2fs_extent_get for uninit leaf extents
The ext2fs_extent_get() function was not OR-ing together UNINIT
and LEAF flags in the case where an extent was both; so if we
had an extent which was both uniint and leaf, pass1 would bail
out where depth == max_depth but was not marked as leaf, and
e2fsck (from the next branch) would abort with:

e2fsck 1.40.8 (13-Mar-2008)
Pass 1: Checking inodes, blocks, and sizes
Error1: No 'down' extent
Aborted

Also, if the error is encountered again, print the inode number
to aid debugging until it's properly handled, at least.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:45:27 -04:00
Jose R. Santos 3542ba0d37 Rename feature name from gdt_checksum to uninit_groups
This name is a more intuitive option when running mke2fs.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:33:12 -04:00
Jose R. Santos d4f34d41be Add uninit block group support to various libext2fs functions
Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:33:12 -04:00
Jose R. Santos ca2634a46a Add initial checksum support for the gdt_checksum/uninit_group feature
- Add support for computing CRC-16 value.
- Add call to check/verify/set csum on block_groups.
- Add a test program to verify csum operations.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:32:11 -04:00
Theodore Ts'o 2d328bb76d Fix miscellaneous gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-17 23:17:13 -04:00
Andreas Dilger a7c9cb7d0d Add support for the DIR_NLINK feature.
This patch includes the changes required to e2fsck to understand the
nlink count changes made in the kernel.

In e2fsck pass 4, when we fetch the actual link count, if it is
exceeds 65,000 we set the link count to 1.  We silently fix the
situation where the nlink count of the directory is 1, and there are
fewer than 65,000 subdirectories, since since that can happen
naturally.

Patch originally from CFS, significantly rewritten by Theodore Ts'o.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-15 01:39:19 -04:00
Theodore Ts'o 60bbd1af53 libext2fs: Make icount use a 32-bit counter
In order to more accurately count the number of directories, which
with the DIR_NLINKS feature can now be greater than 65,000, change
icount to use a 32-bit counter.  This doesn't cost us anything extra
when the icount data structures are stored in memory, since due to
padding for alignment reasons.

If the actual count is greater than 65,500, we return 65,500.  This is
because e2fsck doesn't actually need to know the exact count; it only
needs to know if the number of subdirectories is greater than 65,000.
In the future if someone really needs to know the exact number, we
could add a 32-bit interface.  One isn't needed now, though.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-15 01:39:19 -04:00
Theodore Ts'o 6567e5a684 Merge branch 'maint' 2008-03-15 01:27:08 -04:00
Theodore Ts'o a80f3694a7 ext2_fs.h: Rename EXT4_ORPHAN_FS to be EXT3_ORPHAN_FS
No application will ever use the ORPHAN_FS flag, since it only shows
up in kernel memory, but it's been pointed out it was first used in
ext3, and so it should be renamed for accuracy.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-15 01:25:51 -04:00
Eric Sandeen 82e541885e Fix ext2fs_swap_inode_full() for in-inode xattrs on big-endian machines
After the fix for resize2fs's inode mover losing in-inode
extended attributes, the regression test I wrote caught
that the attrs were still getting lost on powerpc.

Looks like the problem is that ext2fs_swap_inode_full()
isn't paying attention to whether or not the EA magic is
in hostorder, so it's not recognized (and not swapped)
on BE machines.  Patch below seems to fix it.

Yay for regression tests.  ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-03-14 14:32:53 -04:00
Theodore Ts'o 252b736369 libext2fs: Fix fencepost error in ext2fs_extent_insert()
ext2fs_extent_insert() was copying n-1 of the existing extents when
moving things down to make room for the new extent.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-14 10:42:50 -04:00
Theodore Ts'o 83d9be1d5d libext2fs: Fix ext2fs_extent_delete() to always point at a valid entry
When deleting the last entry in a node, back up the current pointer so
it is always pointing at a valid entry.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 23:55:40 -04:00
Jose R. Santos 51b263e369 Add {read,write}_blk64 to inode_io.c
Add 64-bit block capable routines to inode IO manager.  Since fileio.c
does not yet have 64bit support, these routines will not handle 64bit
block numbers correctly yet.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 13:47:05 -04:00
Jose R. Santos 59ecd32dcb Add {read,write}_blk64 to unix_io.c
Add 64-bit block capable routines to Unix IO manager.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 13:46:58 -04:00
Jose R. Santos 3154e1cceb Add 64-bit IO manager operations to struct_io_manager.
In order to provide 64-bit block support for IO managers an maintain
ABI compatibility with the old API, some new functions need to be
added to struct_io_manger.  Luckily, strcut_io_manager has some
reserved space that we can use to add these new functions.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 13:46:44 -04:00
Theodore Ts'o a040a99b6c Merge branch 'maint'
Conflicts:

	lib/ext2fs/ext2_err.et.in
2008-03-13 10:53:26 -04:00
Theodore Ts'o 52b1dd5e49 libext2fs: Add ext2fs_dblist_get_last() and ext2fs_dblist_drop_last()
Add two new functions which allows the caller to examine the last
directory block entry added to the list, and to drop if it necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 00:34:16 -04:00
Theodore Ts'o dd232049d1 blkid: Fix portability problem caused by using uint instead of unsigned int
This is needed to fix compilation with DJGPP; thanks to Cristophe
Grenier for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-08 20:01:05 -05:00
Theodore Ts'o a49670e64e Merge branch 'maint'
Conflicts:

	lib/blkid/devname.c
	lib/blkid/probe.c
	misc/mke2fs.c
	misc/tune2fs.c
2008-02-27 18:53:34 -05:00
Theodore Ts'o 3a538e4244 Fix gcc -Wall warnings for lib/blkid/probe.c
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-27 02:06:08 -05:00
Theodore Ts'o 1f1ee19485 libblkid: Add error checking to devicemapper code to avoid segfaults
If a device mapper volume disappears while libblkid code is running,
it is possible for the devicemapper code to return errors, and since
libblkid wasn't checking for error returns, it would dereference a
null pointer and crash.  Add error checking to prevent this.

Addresses-RedHat-Bugzilla: #433857

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-26 22:24:42 -05:00
Theodore Ts'o ab52e12a90 libext2fs: Add EXT2_FLAG_NONFREE_ON_ERROR to ext2fs_open2()
Add a flag which returns the partially completed filesystem object so
e2fsck can print more intelligent error messages.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-26 20:45:36 -05:00
Theodore Ts'o 7100351d35 libe2p: New e2p_edit_feature2 which provides better error handling
This creates a new enhanced edit_feature function for libe2p which
supports a different set of feature flags that are OK to clear as
opposed to set, and which returns more specific information about why
the user provided an invalid edit feature command.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-26 14:26:01 -05:00
Theodore Ts'o 395529bb46 libe2p: Change Raid to RAID in display option
Update m_raid_opt test so that it reflects the code change.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-22 16:52:27 -05:00
Valerie Clement e6bbc002c5 Add missing shift for ei_leaf_hi
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-22 15:57:34 -05:00
Valerie Clement d46d67a845 Add missing free in ext2fs_extent_free()
handle->path should be freed in ext2fs_extent_free()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-22 15:56:23 -05:00
Theodore Ts'o 7a3e1b7bff Fix memory leak in ext2fs_alloc_block()
If a block buffer was not supplied and ext2fs_alloc_block() returned
with no errors, it would leak a temporary block buffer.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-19 08:40:27 -05:00
Eric Sandeen a451d92f38 blkid: detect LVM2 physical volumes
Bits liberally stolen from lvm2 userspace.

Addresses-Red-Hat-Bugzilla: #409321

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-02-19 08:40:15 -05:00
Theodore Ts'o 0157e7c635 Merge branch 'maint' into next 2008-02-18 23:01:43 -05:00
Theodore Ts'o 6b226c3de2 libe2p: Make list_super2() print the RAID stride and stripe-width
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 22:59:42 -05:00
Theodore Ts'o 0c17cb25f2 Add support for setting RAID stride and strip-width via mke2fs and tune2fs
This is useful for mballoc to align block allocation on the RAID
stripe boundaries.

Signed-off-by: Rupesh Thakare <rupesh@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 22:56:25 -05:00
Andreas Dilger fefaef39e0 Improve support for in-inode EA's
Add vertificaton of the in-inode EA information, and allow in-inode
EA's to have a checksum.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 21:20:26 -05:00
Theodore Ts'o 15d482ba6e e2fsck: Add support for extents
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 20:06:18 -05:00
Theodore Ts'o cc9bf5d246 Add read/only support for extents to ext2fs_bmap()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 20:05:55 -05:00
Theodore Ts'o 206fea69f8 Add read-only extents support to ext2fs_block_iterate2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 20:05:47 -05:00
Theodore Ts'o 3eb07f6493 Add support for extents to libext2fs
Initial implemenation of extents support in libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 20:05:35 -05:00
Theodore Ts'o 4ce3b77480 Don't byte swap extents information in the inode
Responsibility for byte swapping the extents information rests with
the low-level extent code, which translates the on-disk extents
information to the abstract extent format.  The on-disk format will
eventually get more complicated, in order to add support for 64-bit
block numbers, bit-compressed extents, etc.  So to avoid needing to
expose all of that complexity in swapfs.c, the in-memory contents of
i_blocks will not be byte-swapped and will be identical to the on-disk
format.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 15:27:04 -05:00
Theodore Ts'o bbf54adb03 Merge branch 'maint' into next 2008-02-17 17:36:45 -05:00
Theodore Ts'o 3eed36b254 Update to latest samba tdb library before LGPLv3 change
The major changes were:

* Fix realloc() leak on failure case from Jim Meyering
* Fixed various problems in transaction lock code
* Made transaction_brlock() static
* Added more fine-grained locking features

Moved from svn revision #22080 to #23590

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-17 17:35:54 -05:00
Christophe GRENIER e7cc6f7d0b Add portability checks to support DJGPP
DJGPP lacks sys/select.h and sys/un.h; add header checks to be more
portable.

Signed-off-by: Christophe Grenier <grenier@cgsecurity.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-02-17 17:33:57 -05:00
Theodore Ts'o e70f32b79d libuuid: use fcntl locking instead of lockf
Cygwin doesn't support lockf(), so move to fcntl() locking as more
portable.  Also fix a bug which could cause get_lock() to loop forever
if the attempt to lock the file fails for some reason.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-16 10:05:48 -05:00
Theodore Ts'o 357d1863d6 libext2: Add BLOCK_FLAG_READ_ONLY flag to ext2fs_block_iterate2()
This flag allows the caller to promise that it will not try to modify
the block numbers returned by the iterator.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-10 08:04:09 -05:00
Theodore Ts'o ef80fdc8ad Merge branch 'maint' into next 2008-02-10 08:03:54 -05:00