• Home
  • History
  • Annotate
  • only in /external/e2fsprogs/lib/ext2fs/
History log of /external/e2fsprogs/lib/ext2fs/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d25948b9b4a9e361ef071dc8175df0407f60b7e0 21-Nov-2014 JP Abgrall <jpa@google.com> tune2fs: Allow building it as a static lib

This allows getting all of tune2fs as a static library.
The entry point is
int tune2fs_main(int argc, char **argv).
It requires passing argv[0]="tune2fs" to get tune2fs behavior.

Bug: 18430740
Change-Id: I7bf8d96c53066a4da37778c0d67383b0b820e2ff
ndroid.mk
6c6a75dc1ed760f80417dd52a2a7b570fb738a0a 20-Mar-2014 JP Abgrall <jpa@google.com> llseek: setup the correct seek for ext2fs_llseek

After
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/lib/ext2fs/llseek.c?id=274d46e1d35af423d0292d63c4d0ad7a03be82ba

with
__linux__
defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
SIZEOF_OFF_T >= SIZEOF_LONG_LONG
it leads to ext2fs_llseek() doing a "return lseek(fd, offset, origin);"
Which fails for offsets > 32bit.

Also, with
__linux__
!(defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE))
defined(HAVE_LLSEEK)
SIZEOF_OFF_T == SIZEOF_LONG_LONG
my_llseek is not defined at all. And there is no need to define
llseek as lseek, as llseek is never used.
Luckily ext2fs_llseek() then does "return lseek(...);"
It would seem that my_llseek should be used in both places.

Bug: 13340735
Change-Id: Ie7330300c9c1ca103eaaef97536dcf10adbbba02
Signed-off-by: JP Abgrall <jpa@google.com>
lseek.c
e0ed7404719a9ddd2ba427a80db5365c8bad18c0 20-Mar-2014 JP Abgrall <jpa@google.com> Switch back to 1.42.9 now that there is a fix

Revert "Revert changes that moved from 1.41.14 to 1.42.9"

This reverts commit 65f0aab98b20b5994a726ab90d355248bcddfffd.
ndroid.mk
ODULE_LICENSE_LGPL
akefile.in
akefile.pq
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_inode.c
itmaps.c
itops.c
itops.h
lkmap64_ba.c
lkmap64_rb.c
lknum.c
lock.c
map.c
map64.h
move.c
rel.h
rel_ma.c
heck_desc.c
losefs.c
rc32c.c
rc32c_defs.h
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
upfs.c
2image.h
xpanddir.c
xt2_err.c
xt2_err.et.in
xt2_err.h
xt2_fs.h
xt2_io.h
xt2_types.h
xt2_types.h.in
xt2fs.h
xt2fs.pc.in
xt2fsP.h
xt_attr.c
xtent.c
xtent_dbg.ct
iemap.h
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
en_bitmap64.c
en_crc32ctable.c
et_pathname.c
etsectsize.c
etsize.c
_block.c
count.c
mager.c
nitialize.c
nline.c
node.c
node_io.c
o_manager.c
rel.h
smounted.c
ernel-jbd.h
ernel-list.h
ink.c
lseek.c
kdir.c
kjournal.c
mp.c
amei.c
ewdir.c
t_io.c
penfs.c
rogress.c
unch.c
cow2.c
cow2.h
btree.c
btree.h
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
parse.c
wapfs.c
ymlink.c
db.c
db.h
est_io.c
st_badblocks.c
st_bitmaps.c
st_bitmaps_cmd.ct
st_bitmaps_cmds
st_bitmaps_exp
st_bitops.c
st_fs_struct.c
st_inode_size.c
st_iscan.c
st_super_size.c
ndo_io.c
nix_io.c
alid_blk.c
65f0aab98b20b5994a726ab90d355248bcddfffd 06-Mar-2014 JP Abgrall <jpa@google.com> Revert changes that moved from 1.41.14 to 1.42.9

Revert "e2fsck: Don't use e2fsck_global_ctx unless HAVE_SIGNAL_H"
commit e80e74c41d85ff93f3d212ba6512340f48054a93.

Revert "Merge remote-tracking branch 'linaro/linaro-1.42.9' into aosp_master"
This reverts commit e97b2b6fc82f840e84dfc631b87f21be44ff2421, reversing
changes made to 7e2fb9d09c245eba70ee008b78007315e9c0f1df.

Revert "Prepare for upstream 1.42.9"
This reverts commit 7e2fb9d09c245eba70ee008b78007315e9c0f1df.

Bug: 13340735
Change-Id: If48b153a95ef5f69f7cdccb00e23524abff3c5a8
Signed-off-by: JP Abgrall <jpa@google.com>
ndroid.mk
ODULE_LICENSE_LGPL
akefile.in
akefile.pq
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_inode.c
itmaps.c
itops.c
itops.h
lkmap64_ba.c
lkmap64_rb.c
lknum.c
lock.c
map.c
map64.h
move.c
rel.h
rel_ma.c
heck_desc.c
losefs.c
rc32c.c
rc32c_defs.h
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
upfs.c
2image.h
xpanddir.c
xt2_err.c
xt2_err.et.in
xt2_err.h
xt2_fs.h
xt2_io.h
xt2_types.h
xt2_types.h.in
xt2fs.h
xt2fs.pc.in
xt2fsP.h
xt_attr.c
xtent.c
xtent_dbg.ct
iemap.h
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
en_bitmap64.c
en_crc32ctable.c
et_pathname.c
etsectsize.c
etsize.c
_block.c
count.c
mager.c
nitialize.c
nline.c
node.c
node_io.c
o_manager.c
rel.h
smounted.c
ernel-jbd.h
ernel-list.h
ink.c
lseek.c
kdir.c
kjournal.c
mp.c
amei.c
ewdir.c
t_io.c
penfs.c
rogress.c
unch.c
cow2.c
cow2.h
btree.c
btree.h
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
parse.c
wapfs.c
ymlink.c
db.c
db.h
est_io.c
st_badblocks.c
st_bitmaps.c
st_bitmaps_cmd.ct
st_bitmaps_cmds
st_bitmaps_exp
st_bitops.c
st_fs_struct.c
st_inode_size.c
st_iscan.c
st_super_size.c
ndo_io.c
nix_io.c
alid_blk.c
18a1444b4f1e6a0948fd38fa0de382d86cfe04de 31-Dec-2013 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Add files that would normally be generated by the e2fsprogs build system

Android doesn't run ./configure and friends, so it has to rely on
pre-populated versions of the autogenerated files.

This is somewhat bogus (e.g. hardcoded little-endian reference in
lib/ext2fs/ext2_types.h) and should at some point be fixed, but it's
what Android has always done, not a regression from the 1.41.14 branch.

Also, don't #include config.h which we don't generate (we pass what it
usually contains as -D parameters from Android.mk) anywhere.

Add a new Android.mk file for the quota library.

Change-Id: I162c6327fee5bd06261d9cdcc34bda10f04a6f21
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
ndroid.mk
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_compat.c
b_inode.c
itmaps.c
itops.c
lkmap64_ba.c
lknum.c
lock.c
map.c
move.c
rel_ma.c
heck_desc.c
losefs.c
rc16.c
rc32c.c
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
osio.c
upfs.c
xpanddir.c
xt2_err.c
xt2_err.h
xt2_types.h
xt_attr.c
xtent.c
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
en_bitmap64.c
et_pathname.c
etsectsize.c
etsize.c
_block.c
count.c
mager.c
nd_block.c
nitialize.c
nline.c
node.c
node_io.c
o_manager.c
rel_ma.c
smounted.c
ink.c
lseek.c
ookup.c
kdir.c
kjournal.c
mp.c
amei.c
ative.c
ewdir.c
t_io.c
penfs.c
rogress.c
unch.c
cow2.c
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
wapfs.c
ymlink.c
db.c
dbtool.c
est_io.c
st_badblocks.c
st_bitmaps.c
st_bitops.c
st_byteswap.c
st_getsectsize.c
st_getsize.c
st_inode_size.c
st_iscan.c
st_super_size.c
st_types.c
ndo_io.c
nix_io.c
nlink.c
alid_blk.c
ersion.c
rite_bb_file.c
5fe0b41dba699fa14432a633c863ea8cb7bf3f5d 31-Dec-2013 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Re-add Android makefiles from AOSP master

Change-Id: I6c6dbe11baa395442f4cf845ad39801f1c426129
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
ndroid.mk
aa2c743331f392e49d5b168b5e3d8c8a8084b8b4 25-Dec-2013 Theodore Ts'o <tytso@mit.edu> e2image: only skip writing zero blocks when writing to a new file

The e2image progam was originally intended to create image files.
However, some people have started using e2image to copy a file system
from one block device to another, since it is more efficient than
using dd because it only copies the blocks which are in use. If we
are doing this, however, we must not skip writing blocks which are all
zero in the source device, since they may not be zero in the
destination device.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Phillip Susi <psusi@ubuntu.com>
2image.h
b3c2a638139b5da7f63f7ebe450860918d297a39 25-Dec-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: checksum bg descriptors larger than 64 bytes

Currently the ext4 block group descriptor is 64 bytes. In case we
need to support larger block group descriptors in the future, teach
ext2fs_group_desc_csum() to checksum parts of the block group
descriptors that libext2fs doesn't yet understand.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
2bc30417541deffca795db8ec4e7f7ccb616dc3f 23-Dec-2013 Andreas Dilger <adilger@dilger.ca> debugfs, e2fsck: fix s_desc_size handling

The s_desc_size in the superblock specifies the group descriptor
size in bytes, but in various places the EXT4_FEATURE_INCOMPAT_64BIT
flag implies that the descriptor size is EXT2_MIN_DESC_SIZE_64BIT
(64 bytes) instead of checking the actual size. In other places,
the s_desc_size field is used without checking for INCOMPAT_64BIT.

In the case of ext2fs_group_desc() the s_desc_size was being ignored,
and assumed to be sizeof(struct ext4_group_desc), which would result
in garbage for any but the first group descriptor. Similarly, in
ext2fs_group_desc_csum() and print_csum() they assumed that the
maximum group descriptor size was sizeof(struct ext4_group_desc).
Fix these functions to use the actual superblock s_desc_size if
INCOMPAT_64BIT.

Conversely, in ext2fs_swap_group_desc2() s_desc_size was used
without checking for INCOMPAT_64BIT being set.

The e2fsprogs behaviour is different than that of the kernel,
which always checks INCOMPAT_64BIT, and only uses s_desc_size to
determine the offset of group descriptors and what range of bytes
to checksum.

Allow specifying the s_desc_size field at mke2fs time with the
"-E desc_size=NNN" option. Allow a power-of-two s_desc_size
value up to s_blocksize if INCOMPAT_64BIT is specified. This
is not expected to be used by regular users at this time, so it
is not currently documented in the mke2fs usage or man page.

Add m_desc_size_128, f_desc_size_128, and f_desc_bad test cases to
verify mke2fs and e2fsck handling of larger group descriptor sizes.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lknum.c
sum.c
nitialize.c
wapfs.c
11d1116a7c0b833af317249d12025413fecbcd70 23-Dec-2013 Andreas Dilger <adilger@dilger.ca> e2fsck: verify s_desc_size is power-of-two value

Add a LOG2_CHECK mode for check_super_value() so that it is easy
to verify values that are supposed to be power-of-two values
(s_desc_size and s_inode_size so far). In ext2fs_check_desc()
also check for a power-of-two s_desc_size.

Print out s_desc_size in debugfs "stats" and dumpe2fs output, if
it is non-zero.

It turns out that the s_desc_size validation in check_super_block()
is not currently used by e2fsck, because the group descriptors are
verified earlier by ext2fs_check_desc(), and even without an
explicit check of s_desc_size the group descriptors fail to align
correctly on disk. It makes sense to keep the check_super_block()
regardless, in case the code changes at some point in the future.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
heck_desc.c
losefs.c
xt2_fs.h
f404167dda29a59d2be2882328aeb074b9899669 17-Dec-2013 Theodore Ts'o <tytso@mit.edu> Clean up sparse warnings

Mostly by adding static and removing excess extern qualifiers. Also
convert a few remaining non-ANSI function declarations to ANSI.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
map.c
blist.c
ir_iterate.c
xtent.c
ileio.c
mp.c
unch.c
fbabd5c44c2303501ad79b0e0386fe6436e0e147 16-Dec-2013 Kazuya Mio <k-mio@sx.jp.nec.com> mke2fs: disallow creating FS on a loop mounted file with no option

When /etc/mtab is a symlink of /proc/mounts, mke2fs without -FF option
can create a filesystem on the image file that is mounted.
According to mke2fs man page, we should specify -FF option in this case.

This patch protects filesystem from unintended mke2fs caused by human error.

How to reproduce:
# mke2fs -t ext4 -Fq fs.img
# mount -o loop fs.img /mnt/mp1
# mke2fs -t ext4 -Fq fs.img && echo "mke2fs success"
mke2fs success

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
smounted.c
230272c15a71edfd53bc805adf560d0386dddff3 16-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: don't update the summary counts when doing implied cluster allocation

When we're appending a block to a directory file or the journal file,
and the new block is part of a cluster that has already been allocated
to the file (implied cluster allocation), don't update the bitmap or
the summary counts because that was performed when the cluster was
allocated.

Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xpanddir.c
kjournal.c
84397754250d13e8596dd68c157c4c9863800079 16-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: only punch complete clusters

When bigalloc is enabled, using ext2fs_block_alloc_stats2() to free
any block in a cluster has the effect of freeing the entire cluster.
This is problematic if a caller instructs us to punch, say, blocks
12-15 of a 16-block cluster, because blocks 0-11 now point to a "free"
cluster.

The naive way to solve this problem is to see if any of the other
blocks in this logical cluster map to a physical cluster. If so, then
we know that the cluster is still in use and it mustn't be freed.
Otherwise, we are punching the last mapped block in this cluster, so
we can free the cluster.

The implementation given only does the rigorous checks for the partial
clusters at the beginning and end of the punching range.

Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
xt2fs.h
unch.c
eaf4403561c5822d3cdcc93092039d49d1c0375e 16-Dec-2013 Andreas Dilger <adilger@dilger.ca> ext2fs,blkid: delete unused LIST_HEAD() macro

The LIST_HEAD() macro conflicts with the <sys/queue.h> declaration
of the same name. Delete the unused LIST_HEAD() macro from the
libext2fs and libblkid headers to avoid compiler warnings. It can
be replaced by INIT_LIST_HEAD() or LIST_HEAD_INIT() if needed.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ernel-list.h
269da3b8068ecb0bdf8077b0f7b27f164203cb35 16-Dec-2013 Andreas Dilger <adilger@dilger.ca> ext2fs: quiet compiler warnings

Include ext2fsP.h in fileio.c for ext2fs_file_block_offset_too_big()
declaration. Fix up the declaration to mark it extern in the header.

Include <strings.h> header for strcasecmp() in tune2fs.c if available,
as described in the strcasecmp(3) man page, instead of doing this
indirectly by declaring _BSD_SOURCE and getting it from <string.h>.

If CONFIG_QUOTA is undefined, parse_quota_opts() is unused in
tune2fs.c so #ifdef it out.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fsP.h
ileio.c
3a941bef3b9036ca3db9d510c71bcae801ea4dd1 16-Dec-2013 Andreas Dilger <adilger@dilger.ca> build: use long long for __u64 by default

Don't print a verbose configure error in parse-types.h if
<asm/types.h> missing and __[SU]*_TYPEDEF is unset. This is
always the case for non-Linux builds.

The printf formatting strings all use "%llu" for printing 64-bit
values and this it produces a large number of warnings if __u64
is defined as "unsigned long". If __U64_TYPEDEF isn't set use
"unsigned long long" for __u64 in ext2-types.h and blkid-types.h
by default instead of using "unsigned long".

Fix a few places where "%d" or "%u" or "%Lu" were used to print a
64-bit value, by converting them to use "%lld" or "%llu" instead.

Fix a few places where "%lu" was used to print .tv_usec, by casting
the variable to "(long)" since .tv_usec is "int" on some systems.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_types.h.in
4c6fd9c20a3473db3fe419d613244e26c4a92b7b 15-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: clamp block-map punch range end to 2^32 blocks

In the ^extent case, passing ~0ULL as the 'end' parameter to
ext2fs_punch() causes the (end - start + 1) calculation to overflow to
zero. Since the old-style mapped block files cannot have more than
2^32 blocks, just clamp it to ~0U.

This fixes a regression in t_quota_2off with the patch "libext2fs: use
ext2fs_punch() to truncate quota file" applied.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
299cc61755f72311df002cc99dae13f469e0a198 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: zero block contents past EOF when setting size

When we set the file size, find the block containing EOF, and zero
everything in that block past EOF so that we can't return stale data
if we ever use fallocate or truncate to lengthen the file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
042a0f52ec79e448fd798df7757c6addeb00aede 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: don't error out when punching a totally sparse file

If we're asked to punch a file with no data blocks mapped to it and a
non-zero length, we don't need to do any work in ext2fs_punch_extent()
and can return success. Unfortunately, the extent_get() function
returns "no current node" because it (correctly) failed to find any
extents, which is bubbled up to callers. Since no extents being found
is not an error in this corner case, fix up ext2fs_punch_extent() to
return 0 to callers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
dc9673abcf8e00f2b2e6e346b6312ef3745ac543 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix punching extents when there are no left extents

When deleting an entire extent, we cannot always slip to the previous
leaf extent because there might not /be/ a previous extent.
Attempting to correct for that error by asking for the 'current' leaf
extent also doesn't work, because the failed attempt to change to the
previous extent leaves us with no current extent.

Fix this problem by recording the lblk of the next extent before
deleting the current extent and _goto()ing to the next extent after
the deletion.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
8a86bbb19714c135aef07095d0b3c1d7e4f7a155 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fail fileio write if we can't allocate a block

If we're using ext2fs_file_write() to write to a hole in a file,
ensure that we can actually allocate the block before updating i_size.
In other words, don't update i_size and don't return success if we hit
an error while allocating space.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
13b48a0ae1b4556fdddbc3742022137302498300 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix a broken close() test

Zero is a valid file descriptor, so close it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kjournal.c
6a26b38ac46a0489bd477832dcaebd276c2f489b 11-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix memory leaks (on error paths)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap64.c
kjournal.c
ewdir.c
cow2.c
8d74ab767d0f97258fed40f2f2d862227545bcea 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: check return values

Fix up a few places where we ignore return values.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lushb.c
count.c
mager.c
kjournal.c
unch.c
85b8f7affa5fadb1972e82e04cc3d1828966b238 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> debugfs: don't leak mmp_s memory (on error path)

ext2fs_free_mem() takes a pointer to a pointer, similar to
ext2fs_get_mem(). Improve the documentation, and fix debugfs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
56fa48879641603f2a3814fbe130ab2a29dcf411 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fileio should use 64bit io routines

When reading or writing file blocks, use the IO manager routines that
can handle 64bit block numbers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
62f17f36031102a2a40fac338e063c556f73b94a 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: make symlinks safe for 64bit blocks and extents

If we have to create a big symlink (i.e. one that doesn't fit into
i_block[]), we are not 64bit block safe and the namei code does not
handle extents at all. Fix both.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
amei.c
ymlink.c
ba0230f885af90185d00e7e3702e35c656b47ea1 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix "a" vs "an" in the error catalog

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
1e7451493ed67ae94ba5c1d2bed059527bc9848d 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: don't allow ridiculously large logical block numbers

Forbid clients from trying to map logical block numbers that are
larger than the lblk->pblk data structures are capable of handling.
While we're at it, don't let clients set the file size to a number
that's beyond what can be mapped.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
xt2fsP.h
ileio.c
3b6c0938ec5aa401c7ae6c95e94e5ad30a7b8562 11-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix tests that set LARGE_FILE

For each site where we test for a large file (> 2GB) and set the
LARGE_FILE feature, use a helper function to make the size test
consistent with the test that's in e2fsck. This fixes the fsck
complaints when we try to create a 2GB journal (not so hard with 64k
block size) and fixes the incorrect test in fileio.c.

Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
ileio.c
kjournal.c
341bc5e368f7a768482f041971fb3c4b156d6ed9 12-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: don't overflow when punching indirect blocks with large blocks

On a FS with a rather large blockize (> 4K), the old block map
structure can construct a fat enough "tree" (or whatever we call that
lopsided thing) that (at least in theory) one could create mappings
for logical blocks higher than 32 bits. In practice this doesn't
happen, but the 'max' and 'iter' variables that the punch helpers use
will overflow because the BLOCK_SIZE_BITS shifts are too large to fit
a 32-bit variable. The current variable declarations also cause punch
to fail on TIND-mapped blocks even if the file is < 16T. So enlarge
the fields to fit.

Yes, this is an obscure corner case, but it seems a little silly if we
can't punch a file's block 300,000,000 on a 64k-block filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
2fe2d408a4e231eb5d2342b7f3dbd155563aa755 04-Dec-2013 Andreas Dilger <adilger@dilger.ca> mmp: fix 64-bit handling of s_mmp_block

Fix the checking of s_mmp_block in e2fsck_pass1() and
ext2fs_mmp_read() to handle the high 32 bits of s_blocks_count.
Remove redundant check of s_mmp_block in do_dump_mmp() right before
ext2fs_mmp_read() is called.

Also fix s_blocks_count_hi in check_backup_super_block(), since it
cannot use the ext2fs_blocks_count() helper easily.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
mp.c
17abb05f515d72c78667108a95c904ef65bcc6aa 03-Dec-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix function declarations to match definition

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
144f4e8ca511ef699570bc0426d5969d2b903d77 03-Dec-2013 Eric Whitney <enwlinux@gmail.com> libext2fs: fix printf conversion spec in tst_iscan.c

A recent patch to fix blk_t to blk64_t assignment mismatches in
e2fsprogs (commit 4dbfd79d1458ce1259b951377e341aeb6197f8c1) created
a printf conversion spec / argument type mismatch in tst_iscan.c.
Fix this to avoid truncation of the printed value and to silence
a compiler warning seen when "make check" is run.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
st_iscan.c
15a668c4b57f0d38776a0eac23e884e084a1be87 03-Dec-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: add explicit casts to bitops.h

Add some explicit casts to silence some -Wconversion noise.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
b70483742b7ad993b574fbfb96ce77f5c05c84f9 03-Dec-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: add explicit casts to ext2fs.h

Add some explicit casts to silence some -Wconversion noise.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
496220309337863b45d9ee6173ff431919fb51f5 02-Dec-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: fix some memory leaks with image file handling

These memory leaks were discovered by using "valgrind
--leak-check=full" while running "e2image -I bar.img foo.e2i"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
reefs.c
penfs.c
8b3c52fb8115c8c37835d74455619f380acbc833 02-Dec-2013 Kit Westneat <kwestneat@ddn.com> libext2fs: set the fs block size to new_io in ext2fs_rewrite_to_io()

e2image manually opens a new IO channel, and then sets the file system
to use this new IO channel via ext2fs_rewrite+to_io(). We need to
make sure the IO channel is set to the file system's block size to
avoid some nasty buffer overruns.

[ Modified by tytso to use io_channel_set_blksize() ]

Signed-off-by: Kit Westneat <kwestneat@ddn.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
penfs.c
d87f198ca3250c9dff6a4002cd2bbbb5ab6f113a 24-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: reject 64bit badblocks numbers

Don't accept block numbers larger than 2^32 for the badblocks list,
and don't run badblocks on them either.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ead_bb_file.c
d36e027f9ce175f2437dcf681479935e185755a0 18-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: stop iterating dirents when done linking

When we've succesfully linked an inode into a directory, we can stop
iterating the directory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ink.c
832cb612f8c1c10525fe438206d4fe5c6d38a4e7 12-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> e2fsprogs: add (optional) sparse checking to the build

Run sparse against source files when building e2fsprogs with 'make C=1'. If
instead C=2, it configures basic ext2 types for bitwise checking with sparse,
which can help find the (many many) spots where conversion errors are
(possibly) happening.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2fs.h
57bde59a067c21ed924de4194344948f3c3ecb9a 12-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: openfs() musn't allow bigalloc without EXT2_FLAGS_64BITS

Currently, only the new 64-bit bitmap implementation supports the
block<->cluster conversions that bigalloc requires. Therefore, if we
have a bigalloc filesystem, require EXT2_FLAGS_64BITS be passed in to
ext2fs_open(). This does not mean that bigalloc file systems have to
be 64-bits; just that the userspace utilities have to be able to use
the new 64-bit capable library functions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
penfs.c
2a091427bcbff1fd1cf3f0bccf00da98d52b8f16 08-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: search all possible blocks in implied_cluster_alloc()

implied_cluster_alloc() is written such that if the the user passes in
a logical block that is the zeroth block in a logical cluster (lblk %
cluster_ratio == 0), then it will assume that there is no physical
cluster mapped to any other part of the logical cluster.

This is not true if we happen to be allocating logical blocks in
reverse order. Therefore, search the whole cluster, except for the
lblk that we passed in.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
4605a35d1ef573dc166a73ed910d0ee7b02489cb 08-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix off-by-one error in file truncation

When told to truncate a file, ext2fs_file_set_size2() should start with
the first block past the end of the file. The current calculation
jumps one more block ahead, with the result that it fails to hack off
the last block. Adding blocksize-1 and dividing is sufficient to find
the last block.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
470ca046b1e682c419d50efc8d4941db1b8601d9 08-Oct-2013 Niu Yawei <yawei.niu@gmail.com> libext2fs: update i_size in ext2fs_file_write()

ext2fs_file_write() needs to update i_size on successful write,
otherwise, ext2fs_file_read() in same open/close cycle will not
be able to read the just written data.

This fixes a bug which results in the the problem of quotacheck
triggered on 'tune2fs -O quota' failed to write back multiple
users/groups accounting information.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
a25487cbaf0e340144cb4673d52136abdb3eb2cf 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> e2fsprogs: fix inode and block relocation functions to use blk64_t

The inode and block relocation functions aren't currently compiled in
(so we don't need to worry about breaking ABI compatibility). They
were originally intended for use by resize2fs, but we never ended up
using them, so (wisely) they weren't ever included in libext2fs as an
exported interface (they're not even compiled by the Makefile).

Fix them so that in case we ever use them, so that in places where raw
data types (int, long, etc.) stood in for blk_t and blk64_t. Also fix
some sites where we should probably be using blk64_t.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
rel.h
rel_ma.c
rel.h
4dbfd79d1458ce1259b951377e341aeb6197f8c1 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> e2fsprogs: fix blk_t <- blk64_t assignment mismatches

Fix all the places where we should be using a blk64_t instead of a
blk_t. These fixes are more severe because 64bit values could be
truncated silently.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2fsP.h
ileio.c
node.c
unch.c
st_iscan.c
581646b94f3b57a461105968b49105a1357216ea 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: ind_punch() must not stop examining blocks prematurely

When we're iterating the main loop in ind_punch(), "offset" tracks how
far we've progressed into the block map, "start" tells us where to
start punching, and "count" tells us how many blocks we are to punch
after "start". Therefore, we would like to break out of the loop once
the "offset" that we're looking at has progressed past the end of the
punch range. Unfortunately, if start !=0, the if-break clause in the
loop causes us to break out of the loop early.

Therefore, change the breakout test to terminate the loop at the
correct time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
4ee4ad80dcceb42b1e5cfd2d4067a38b99b9fa95 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: allow callers to punch a single block

The range of blocks to punch is treated as an inclusive range on both
ends, i.e. if start=1 and end=2, both blocks 1 and 2 are punched out.
Thus, start == end means that the caller wishes to punch a single
block. Remove the check that prevents us from punching a single
block.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
unch.c
5d494038eede1bb538441dedf4207529629154b3 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: rewind extent pointer when totally deleting an extent

During a punch operation, if we decide to delete an extent out of the
extent tree, the subsequent extents are moved on top of the current
extent (that is to say, they're memmmove'd down one slot). Therefore
it is not correct to advance to the next leaf because that means we
miss half the extents in the range! Rereading the current pointer
should be fine.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
unch.c
580d8a0933e9fe390a445c50358af852345c0a47 07-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: fix a minor grammatical error in the error catalog

'an block' should be 'a block'.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_err.et.in
92a7b0d2e3f7e0ea190477c82edf57fb85eed95c 01-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: set the large_file feature flag when setting i_size > 2GB

If someone tries to write a file that is larger than 2GB, we need to
set the large_file feature flag to affirm that i_size_hi can hold
meaningful contents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ileio.c
7320cb7106e5f5a552d07432e9322e1059c02bf3 01-Oct-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: only link an inode into a directory once

The ext2fs_link helper function link_proc does not check the value of
ls->done, which means that if the function finds multiple empty spaces
that will fit the new directory entry, it will create a directory
entry in each of the spaces. Instead of doing that, check the done
value and don't do anything more if we've already added the directory
entry.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ink.c
8ab395524b95875818505a497428cab73e80c0d5 05-Aug-2013 Zheng Liu <wenqing.lz@taobao.com> libext2fs: fix a coding style for EXT2_NO_MTAB_FILE

When we define an error in lib/ext2fs/ext2_err.et.in, we will always use
EXT2_ET_* prefix for a new error. But EXT2_NO_MTAB_FILE doesn't obey
this rule. So fix it.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
smounted.c
a88c2fb508e42be997512732085a2ed887155b9f 09-Sep-2013 Eric Sandeen <sandeen@redhat.com> resize2fs: fix interior extent node corruption

If we have an extent tree like this (from debuge2fs's "ex" command):

Level Entries Logical Physical Length Flags
...
2/ 2 60/ 63 13096 - 13117 650024 - 650045 22
2/ 2 61/ 63 13134 - 13142 650062 - 650070 9
2/ 2 62/ 63 13193 - 13194 650121 - 650122 2
2/ 2 63/ 63 13227 - 13227 650155 - 650155 1 A)
1/ 2 4/ 14 13228 - 17108 655367 3881 B)
2/ 2 1/117 13228 - 13251 650156 - 650179 24 C)
2/ 2 2/117 13275 - 13287 650203 - 650215 13
2/ 2 3/117 13348 - 13353 650276 - 650281 6
...

and we resize the fs in such a way that all of those blocks must
be moved down, we do them one at a time. Eventually we move 1-block
extent A) to a lower block, and then follow it with the other
blocks in the next logical offsets from extent C) in the next
interior node B).

The userspace extent code tries to merge, so when it finds that
logical 13228 can be merged with logical 13227 into a single extent,
it does. And so on, all through extent C), up to block 13250 (why
not 13251? [1]), and eventually move the node block as well.
So we end up with this when all the blocks are moved post-resize:

Level Entries Logical Physical Length Flags
...
2/ 2 120/122 13193 - 13193 33220 - 33220 1
2/ 2 121/122 13194 - 13194 33221 - 33221 1
2/ 2 122/122 13227 - 13250 33222 - 33245 24 D)
1/ 2 5/ 19 13228 - 17108 34676 3881 E) ***
2/ 2 1/222 13251 - 13251 33246 - 33246 1 F)
2/ 2 2/222 13275 - 13286 33247 - 33258 12
...

All those adjacent blocks got moved into extent D), which is nice -
but the next interior node E) was never updated to reflect its new
starting point - it says the leaf extents beneath it start at 13228,
when in fact they start at 13251.

So as we move blocks one by one out of original extent C) above, we
need to keep updating C)'s parent node B) for a proper starting point.
fix_parents() does this.

Once the tree is corrupted like this, more corruption can
ensue post-resize, because we traverse the tree by interior nodes,
relying on their start block to know where we are in the tree.
If it gets off, we'll end up inserting blocks into the wrong part
of the tree, etc.

I have a testcase using fsx to create a complex extent tree which
is then moved during resize; it hit this corruption quite easily,
and with this fix, it succeeds.

Note the first hunk in the commit is for going the other way,
moving the last block of an extent to the extent after it; this
needs the same sort of fix-up, although I haven't seen it in
practice.

[1] We leave the last block because a single-block extent is its
own case, and there is no merging code in that case. \o/

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
816d2c9cf7fb17fe808a081e076cb558f44ec30d 09-Sep-2013 Darrick J. Wong <darrick.wong@oracle.com> libext2fs: ext2fs_dup_handle should not alias MMP buffers

It turns out that resize2fs uses ext2fs_dup_handle to duplicate fs handles. If
MMP is enabled, this causes both handles to share MMP buffers, which is bad
news when it comes time to free both handles. Change the code to (we hope) fix
this. This prevents resize2fs from failing with a double-free error when
handed a MMP filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
upfs.c
42b61c50e5af99a10fc56975ecd08ab71e4f00e8 08-Jul-2013 Theodore Ts'o <tytso@mit.edu> libext2fs, tests: allow /etc/mtab file to be missing

The environment variable EXT2FS_NO_MTAB_OK will suppress the error
code EXT2_NO_MTAB_FILE when the /etc/mtab file can not be found. This
allows the e2fsprogs regression test suite to be run in chroots which
might not have an /etc/mtab file.

By default will still want to complain if the /etc/mtab file is
missing, since we really don't want to discourage distributions and
purveyors of embedded systems from running without an /etc/mtab file.
But if it's missing it only results in a missing sanity check that
might cause file system corruption if the file system is mounted when
programs such as e2fsck, tune2fs, or resize2fs is running, so there is
no potential security problems that might result if this environment
variable is set inappropriately.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
smounted.c
b49d67ddd8af9568bd5eee319af0479f042db4fd 17-Jun-2013 Theodore Ts'o <tytso@mit.edu> Use ext2fs_cpu_to_be32() instead of cpu_to_be32() in kernel-jbd.h

Avoid compatibility problems by using the byte swapping functions
defined by e2fsprogs, instead of the ones defined in the system header
files. We use them everywhere else, so we should use them in
kernel-jbd.h too.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ernel-jbd.h
1ad3174af5213fa7029944cc19723cda08f221d3 16-Jun-2013 Theodore Ts'o <tytso@mit.edu> Try to use secure_getenv() in preference to __secure_getenv()

If secure_getenv() use it in preference to __secure_getenv().
Starting with (e)glibc version 2.17, secure_getenv() exists, while
__secure_getenv() only works with shared library links (where it is a
weak symbol), but not for static links with /lib/libc.a

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
est_io.c
4718395120454ad7c193c76258ef5359f2ab3f2f 16-Jun-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: optimize ext2fs_bg_has_super()

Reduce the CPU time needed when checking whether a block group has a
sparse superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2fs.h
3ac420165c0ad6cf2aa6450095e55975f4571a3f 10-Jun-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: remove lib/ext2fs/sparse.c

This file was never getting compiled, and there is no user of
ext2fs_list_backups() in the e2fsprogs sources. So remove it as a
clean up.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
parse.c
e48bf256e99e4923c6193ff78000af18c700d93d 20-May-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: fix gcc -Wall warnings

Primarily signed vs unsigned and const warnings.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.c
itops.h
lkmap64_rb.c
lock.c
rc32c.c
en_bitmap64.c
mp.c
btree.c
btree.h
w_bitmaps.c
ymlink.c
572ef60b8923dc072e2644f706b25c3c92cb4bb6 22-Apr-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: only use override function when reading an 128 byte inode

The ext2fs_read_inode_full() function should not use fs->read_inode()
if the caller has requested more than the base 128 byte inode
structure and the inode size is greater than 128 bytes. Otherwise the
caller won't get all of the bytes that they were asking for, since
there's no way for the fs->read_inode override function can know what
the size of the buffer passed to ext2fs_read_inode_full().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
8034d9fa0f9a06f5caeab431fe226423dc5dc7d9 22-Apr-2013 Tomas Racek <tracek@redhat.com> e2image: fix flag settings in e2image.h

This prevents from SIGSEGV when -s options is used.

Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
2image.h
5084088215242e5839fa482dd25e06a127aba311 25-Feb-2013 Jan Kara <jack@suse.cz> libext2fs: Provide prototype for ext2fs_symlink()

New function ext2fs_symlink() doesn't have a prototype in ext2fs.h and
thus debugfs compilation gives warning:

debugfs.c:2219:2: warning: implicit declaration of function 'ext2fs_symlink'

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
0d89e5acea99fc00d9b834eab6d228c47a71920a 28-Jan-2013 Philipp Thomas <pth@suse.de> Fix warnings about functions not returning a value

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap64.c
b55705e0ba83147f16a3abb955f3761f78b7db94 28-Jan-2013 Andreas Dilger <adilger@dilger.ca> build: quiet build warnings for "gcc -Wall"

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
274d46e1d35af423d0292d63c4d0ad7a03be82ba 24-Jan-2013 Phillip Susi <psusi@ubuntu.com> libext2fs: fix ext2fs_llseek on i386

ext2fs_llseek() was using lseek instead of lseek64. The
only time it would use lseek64 is if passed an offset that
overflowed 32 bits. This works for SEEK_SET, but not
SEEK_CUR, which can apply a small offset to move the file
pointer past the 32 bit limit.

The code has been changed to instead try lseek64 first, and
fall back to lseek if that fails. It also was doing a
runtime check of the size of off_t. This has been moved to
compile time.

This fixes a problem which would cause e2image when built for
x86-32 to bomb out when used with large file systems.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lseek.c
3e1816b8cc9086354453bd75aaaeade558f98b3e 20-Jan-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: teach the ext2fs_*_block_bitmap_range2() about clusters

The ext2fs_{mark,unmark,test}_block_bitmap2() functions understand
about clusters, and will take block numbers and convert them to
clusters before checking the bitmap. The
ext2fs_*_block_bitmap_range2() functions did not do this, which made
them inconsistent. Fortunately, nothing has depended on this
incorrect behavior, and in fact most of the usage of these functions
have only recently been added, and only for optimizations that were
only enabled for non-bigalloc file systems.

So this is a change in previously exported functions, but (a) it
doesn't change the behavior at all for non-bigalloc file systems, and
(b) the change is more likely to fix bugs for bigalloc file systems.
For example, this change fixes a problem with resize2fs and bigalloc
file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap64.c
f01c1a6bce5e6674cbfa5260db1691bca01a4410 04-Jan-2013 Darren Hart <dvhart@infradead.org> libext2fs: add the ext2fs_symlink() function

Creating symlinks is a complex affair when accounting for slowlinks.

Create a new function, ext2fs_symlink(), modeled after ext2fs_mkdir().
Like ext2fs_mkdir(), ext2fs_symlink() takes on the task of allocating a
new inode and block (for slowlinks), setting up sane default values in
the inode, copying the target path to either the inode (for fastlinks)
or to the first block (for slowlinks), and accounting for the inode and
block stats. Disallow link targets longer than blocksize as the Linux
kernel prevents this.

It does not attempt to expand the parent directory, instead returning
EXT2_ET_DIR_NO_SPACE and leaving it to the caller to expand just as
ext2fs_mkdir() does. Ideally, I think both of these functions should
make a single attempt to expand the directory.

[ Fixed a few bugs discovered when creating a test case for ext2fs_symlink() ]

Signed-off-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>
akefile.in
xt2_err.et.in
ymlink.c
53f2a1eaf051b9ef8a2927cdd7d6de281c8d5a03 16-Jan-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: add error codes from 1.43.x development branch

To maintain the error codes numbering, we need to pull in the changes
from the 1.43.x development branch for the libext2's error table.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
dd4f565d5ac3b1f37100291fb1cd067dd0d55d05 15-Jan-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: avoid 32-bit overflow in ext2fs_initialize with a 512M cluster size

If the user attemps to create a 512MB cluster, we need to adjust the
defaults to avoid a 32-bit overflow of s_blocks_per_group. Also check
to make sure that the caller of ext2fs_initialize() has not given a
value of s_clusters_per_group that would result in an overflow of
s_blocks_per_group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
nitialize.c
f0257d8891c602cabc7358a5ca826444a172ccf5 09-Jan-2013 Theodore Ts'o <tytso@mit.edu> libext2fs: ext2fs_open2() should not set ret_fs after a MMP failure

The addition of MMP code was added in the wrong place, so ret_fs could
get set (and EXT2_FLAG_NOFREE_ON_ERROR was cleared as well, which
could confuse e2fsck which depends on this flag being cleared if
ext2fs_open2() succeeded.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
027b0577d4e5081a4d28dff9289559d38a36d533 03-Jan-2013 Theodore Ts'o <tytso@mit.edu> Fix 32-bit overflow problems: dgrp_t * s_blocks_per_group

There are a number of places where we multiply a dgrp_t with
s_blocks_per_group expecting that we will get a blk64_t. This
requires a cast, or using the convenience function
ext2fs_group_first_block2().

This audit was suggested by Eric Sandeen.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
lloc.c
xtent.c
kjournal.c
a0ba54ec00abce6ce9e7e5f2d5f6e0899559ebb8 03-Jan-2013 Theodore Ts'o <tytso@mit.edu> resize2fs: use [un]mark_block_range bitmap functions to reduce CPU usage

Use ext2fs_[un]mark_block_range2() functions to reduce the CPU
overhead of resizing large file systems by 45%, primarily by
reducing the time spent in fix_uninit_block_bitmaps().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
e3507739e4185bdb2394928eb6479e48f4e690a8 01-Jan-2013 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nits

This fixes the last set of gcc -Wall complaints.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lkmap64_rb.c
mager.c
penfs.c
00eb0eee0addfd3b7ede98b85e00dff1547838a0 29-Nov-2012 Andreas Dilger <adilger@dilger.ca> build: quiet some "gcc -Wall" compiler warnings

Quiet a number of simple compiler warnings:
- pointers not initialized by ext2fs_get_mem()
- return without value in non-void function
- dereferencing type-punned pointers
- unused variables

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
rc32c.c
blist.c
cow2.c
st_bitmaps.c
1d6fd6d0c3766a8165e69284c75812574a29c804 29-Nov-2012 Andreas Dilger <adilger@dilger.ca> misc: cleanup unused variables on MacOS

Clean up unused variables found by GCC on MacOS.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lkmap64_rb.c
map.c
smounted.c
kjournal.c
w_bitmaps.c
nix_io.c
f797cf3e37b476aac593fe9a9f4630448d335332 29-Nov-2012 Andreas Dilger <adilger@dilger.ca> tests: don't consider "make check" a compiler error

In a number of places, the output format from "make check" is
incorrectly interpreted as compiler warning output (triggered by
the presence of colons and parenthesis in the output). Convert
these lines to similar output that does not trigger false build
warnings.

In the case of the tst_uuid.c program, the "ctime()" output was
difficult to change, but in fact it is better to actually compare
the time-based UUID against wallclock time instead of just printing
the formatted time as a string, so this test is improved.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
sum.c
nline.c
068136c31e6fb7d6508d59190eeab6257340075c 23-Dec-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: link the test programs with static libraries

Force the use of the static libraries when linking the test program so
that "make check" works when the shared libraries have not been
installed, and so that we test against the version of the libraries in
the source tree.

Reported-by: g.esp@free.fr
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
bee7b67ce92bb912fccc0dcce3c71c186c2a988b 23-Dec-2012 Theodore Ts'o <tytso@mit.edu> debugfs: add the ability to manipulate the extent tree directly

This commit adds the functionality which had previously only been in
the tst_extents command to debugfs. The debugfs command extent_open
will open extent tree of a particular inode, and enables a series of
commands which will allow the user to interact with the extent tree
directly. Once the extent tree is closed via extent_open(), these
additional commands will be disabled again.

This commit exports two new functions from lib/ext2fs/extent.c which
had previously been statically defined: ext2fs_extent_node_split() and
ext2fs_extent_goto2().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2fs.h
xtent.c
xtent_dbg.ct
eacf6a0878a92836231ee69813cb8764d21140f9 21-Dec-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: ext2fs_extents_fix_parents() should not modify the handle location

Previously, ext2fs_extent_fix_parents() would only avoid modifying the
cursor location associated with the extent handle the cursor was
pointed at a leaf node in the extent tree. This is because it saved
the starting logical block number of the current extent, but not the
"level" of the extent (where level 0 is the leaf node, level 1 is the
interior node which points at blocks containing leaf nodes, etc.)

Fix ext2fs_extent_fix_parents() so it is guaranteed to not change the
current extent in the handle even if the current extent is not at the
bottom of the tree.

Also add a fix_extent command to the tst_extents program to make it
easier to test this function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
xtent_dbg.ct
789bd401c3bce85d3c2ae4504ca62509aa0a8b88 20-Dec-2012 Eric Sandeen <sandeen@redhat.com> e2fsck: fix incorrect interior node logical start values

An index node's logical start (ei_block) should
match the logical start of the first node (index
or leaf) below it. If we find a node whose start
does not match its parent, fix all of its parents
accordingly.

If it finds such a problem, we'll see:

Pass 1: Checking inodes, blocks, and sizes
Interior extent node level 0 of inode 274258:
Logical start 3666 does not match logical start 4093 at next level. Fix<y>?

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
xtent.c
dbe5c43b2e6fcc8fe831a134fbc3dda1f5dd0733 17-Dec-2012 Mikael Pettersson <mikpe@it.uu.se> libext2fs: remove m68k-specific bitops code

The current m68k code was buggy for multiple reasons; first the bfset,
et. al commands interpret the bit number as a signed number, not an
unsigned number. Secondly, there were missing memory clobbers. Since
there is no real benefit in using explicit asm's at this point (gcc is
smart enough to optimize the generic C code to use the set/clear/test
bit m68k instruction) fix this bug by removing the m68k specific asm
versions of these functions.

Tested on m68k-linux with e2fsprogs-1.42.6 and gcc-4.6.3 as before.
All tests pass and the debug output looks sane.

I compared the e2fsck binaries from the previous build with this
one. They had identical .text sizes, and almost the same number
of bit field instructions (obviously compiler-generated), so this
change should have no serious performance implications.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Schwab <schwab@linux-m68k.org>
itops.h
4e0bb5eb745009decac4c5836671ff4bef21ce2a 17-Dec-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix memory and fd leak in error path of unix_open()

Fix a potential memory leak reported by Li Xi. In addition, there
were possible error cases where the file descriptor would not be
properly closed, so fix those as well while we're at it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Li Xi <pkuelelixi@gmail.com>
nix_io.c
1564150d3111f95317073ebc853b79aa5307cff5 17-Oct-2012 Gregoire Pichon <gregoire.pichon@bull.net> mke2fs: fix handling of mmp_update_interval option

Make sure the s_mmp_update_interval super block field is set
from the file system parameters block which is passed into the
ext2fs_initialize() function.

Addresses-Lustre-Bug: LU-1888

Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nitialize.c
b65ccfc7a4e36d152c8ab8af57da783eca965a4c 25-Nov-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: optimize rb_get_bmap_range() for mostly allocated bmaps

This optimizies the CPU utilization of the rb_get_bmap_range()
function when most of the bitmap is allocated.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
lkmap64_rb.c
c3f9641eaf959b4222aa145477e6f0f8811244d8 25-Nov-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: optimize rb_get_bmap_range()

This simplifies the rb_get_bmap_range() function and speeds it up for
the case where most of the bitmap is zero.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
lkmap64_rb.c
c6b006ea6c9fec7f3f33347a52efc396063bcd26 24-Nov-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: add ext2fs_bitcount() function

This function efficiently counts the number of bits in a block of
memory.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
itops.c
itops.h
st_bitmaps.c
st_bitmaps_cmds
st_bitmaps_exp
fc8ea52033fffccfd8aeece9babf77c61c38aed9 24-Nov-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: optimize rb_set_bmap_range()

This speeds up reading bitmaps from disk for very large (and full)
disks by significant amounts (i.e., up to two CPU minutes for a 4T
file system).

Addresses-Google-Bug: #7534813

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
lkmap64_rb.c
3e554cc116a55c9fffe17f4e819d5f2ecf8ad0af 23-Nov-2012 Andreas Dilger <adilger@dilger.ca> ext2fs, blkid: localize environment-specific variables

Restructure the ext2fs_get_device_size() and blkid_get_dev_size()
code to localize the variables used for different device probing
methods. This at least reduces the #ifdef mess to only one part
of the code for each method, and avoids "unused variable" compiler
warnings added when variables are declared without being #ifdef'd.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
etsize.c
ab00fdac7c5345d06d936640c12e1d24c7fdb6b2 22-Nov-2012 Andreas Dilger <adilger@whamcloud.com> libext2fs: change mmp.c to LGPL to match other files

Change the license of the mmp.c file to LGPL to match the license
of other files in the libext2fs library.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mp.c
fb129bba73868a41df74fec87773abd0c6c6cd4a 06-Oct-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: further optimize rb_test_bit

Profiling shows that rb_test_bit() is now calling ext2fs_rb_next() a
lot, and this function is now the hot spot when running e2freefrag.
If we cache the results of ext2fs_rb_next(), we can eliminate those
extra calls, which further speeds up both e2freefrag and e2fsck by
reducing the amount of CPU time spent in userspace.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lkmap64_rb.c
0bcba36f3f90488d2ef7502bd3c4f4920f2c4251 06-Oct-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: remove pointless indirection in rbtree bitmaps

The code was previously allocating a single 4 or 8 byte pointer for
the rcursor and wcursor fields in the ext2fs_rb_private structure;
this added two extra memory allocations (which could fail), and extra
indirections, for no good reason. Removing the extra indirection also
makes the code more readable, so it's all upside and no downside.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
lkmap64_rb.c
547a59a821df1cffcd0ca2c763be9ef319cb980b 05-Oct-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: optimize rb_test_bit

Optimize testing for a bit in an rbtree-based bitmap for the case
where the calling application is scanning through the bitmap
sequentially. Previously, we did this for a set of bits which were
inside an allocated extent, but we did not optimize the case where
there was a large number of bits after an allocated extents which were
not in use.

1111111111111110000000000000000000
^ optimized ^not optimized

In my tests of a roughly half-filled file system, the run time of
e2freefrag was halved, and the cpu time spent in userspace was during
e2fsck's pass 5 was reduced by a factor of 30%.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
lkmap64_rb.c
c498cb11d3e72e41af760bd882675f44db8b77e7 23-Sep-2012 Theodore Ts'o <tytso@mit.edu> mke2fs: fix progress suppression to make regression tests reliable

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
rogress.c
b2f5ce5516a0b6d261876884139043c8e6579f0a 21-Sep-2012 Theodore Ts'o <tytso@mit.edu> mke2fs: throttle allocating groups progress as well

Throttle updates for the "Allocating Groups" progress updates to once
a second as well. We now do this throttling in libext2fs, so we don't
have to do this for each of mke2fs's progress updates, and because the
updates from ext2fs_allocate_tables() come from within libext2fs
anyway.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
rogress.c
ab3f5c5aad6310be1d1891c05f1bc8cf7ccf0cef 10-Sep-2012 Theodore Ts'o <tytso@mit.edu> Allow e2fsprogs to be built using the clang (LLVM) frontend

Since clang uses C99 semantics by default, the main changes required
to allow clang to build e2fsprogs was to add support the C99 inline
semantics, while still allowing us to be built when the legacy (but
still default for gcc) GNU C89 inline semantics are in force.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
itops.h
xt2fs.h
st_bitmaps.c
st_inode_size.c
st_super_size.c
321649c9f491c2012f5e1a20337fd276bc5290f0 30-Aug-2012 Akira Fujita <a-fujita@rs.jp.nec.com> mke2fs: recalculate the reserved blocks when the last BG is dropped

mke2fs -m option can set reserved blocks ratio up to 50%. But if the
last block group is not big enough to support the necessary data
structures, it gets dropped, we have to recalculate the number of
reserved blocks so that the reserved blocks matches the requested
percentage.

It also avoids a problem where if the user specifies a reserved blocks
of 50%, and after the last partial block group was dropped, if the
number of reserved blocks is greater than 50%, e2fsck will complain.

Steps to reproduce:

1. Create a FS which has the overhead for the last BG
and specify 50 % for reserved blocks ratio
# mke2fs -m 50 -t ext4 DEV 1025M

mke2fs 1.42.5 (29-Jul-2012)
warning: 256 blocks unused.

Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
656640 inodes, 2621440 blocks
1310848 blocks (50.00%) reserved for the super user
~~~~~~~ <-- Reserved blocks exceed 50% of FS blocks count!

2. e2fsck outputs filesystem corruption
# e2fsck DEV

e2fsck 1.42.5 (29-Jul-2012)
Corruption found in superblock. (r_blocks_count = 1310848).

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 32768 <device>

Signed-off-by: Akira Fujita <a-fujita@rs.jp.ne.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nitialize.c
d5aa6a82b37a0e78d8882601e6ad9da9d9dcb4da 04-Aug-2012 Theodore Ts'o <tytso@mit.edu> Put ELF_OTHER_LIBS in the right place for the linker

Commit a7c17431b9 attempted to fix a problem where the system
libraries might get used instead of local libraries for things like
-lcom_err. It tried to accomplish this by moving $(ELF_OTHER_LIBS) to
before $(LDFLAGS).

Unfortunately, this was the wrong fix; $(ELF_OTHER_LIBS) *MUST* be
after the object files, or the linker might not pull in the necessary
library and not include it into the DT_NEEDED section of the shared
library. The proper fix is to add a -L$(LIB) before $(LDFLAGS), and
then remove the -L option from all of the ELF_OTHER_LIBS definitions
in the library Makefiles.

Addresses-Sourceforge-Bug: #3554345

Cc: Olivier Blin <olivier.blin@softathome.com>
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
3aa8f60aaedd2e467cae690274c70c3d9835802b 29-Jul-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix uninit block calculation when inodes_per_block < first_ino

The following commands:

dd if=/dev/zero of=/tmp/foo count=1 ibs=$(( 256 * 1024 * 1024 ))
mke2fs -N 256 -t ext4 /tmp/foo

... will cause mke2fs to write until it fills the device. The cause
for this is that the explicit request for 256 inodes causes the number
of inodes per block group to be 8. The ext2fs_initialize() function
assumed that all of the reserved inodes would be in the first block
group, which is not true in this case. This caused the number of
uninitialized inodes in the first block group to be negative, which
then resulted in mke2fs trying to zero out a very large number of
blocks. Oops.

Addresses-Sourceforge-Bug: #3528892

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
c1986ecb6fc68427db7579d409929939117e45ff 13-Jun-2012 Theodore Ts'o <tytso@mit.edu> Fix blhc (Build Log Hardening Check) warnings

The Build Log Hardening Check is a debian tool which scans the output
of a package build making sure that the security hardening flags are
used when compiling and linking all of binaries in a package.

For the most part we were passing CFLAGS, CPPFLAGS, and LDFLAGS down
to the compiler and link commands, but there there were one or two
exceptions. In addition, there where a few places in "make install"
where the V=1 option was not being honored, which triggered blhc
warnings since it couldn't analyze those commands.

The e2fsck.static was the only binary that was not getting built and
packaged with the hardening flags, but I've fixed all of the blhc
warnings so in the future it will be obvious if we regress.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
0796e660859724f304155e094b6cf5739a610ae4 12-Jun-2012 Theodore Ts'o <tytso@mit.edu> lsattr, chattr: add support for btrfs's No_COW flag

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
beb388a473bc12fa874743a7b9f97ec3094bb9d1 12-Jun-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix block iterator for extents when truncating inodes

When e2fsck uses the block iterator to release the blocks in an
extent-mapped inode, when the last block in an extent is removed, the
current extent has been removed and the extent cursor is now pointing
at the next inode. But the block iterator code doesn't know that. So
when it tries to go the next extent, it will end up skipping an
extent, and so the inode will be incompletely truncated.

The fix is to go to the next extent before calling the callback
function for the current extent. This way, regardless of whether the
current extent gets removed, the extent cursor is still pointing at
the right place.

Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
e0e2c7db4d753aa0192a4a78974fb01bee8a2fb4 11-Jun-2012 Aditya Kali <adityakali@google.com> libext2fs: fix i_blocks for extent leaf create/delete with bigalloc

When libext2fs allocates/deletes an extent leaf, the i_blocks
value is incremented/decremented by fs->blocksize / 512. This
is incorrect in case of bigalloc. The correct way here is to
use cluster_size / 512.

The problem is seen if we try to create a large inode using
libext2fs (say using ext2fs_block_iterate3()) on a bigalloc
filesystem. fsck catches this and complains.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
182acd17bef0cf8dcb66568448a528abb1dfcd71 28-May-2012 Andreas Dilger <adilger@whamcloud.com> libext2fs: don't inline ext2fs_open_file() and ext2fs_stat()

The creation of inline wrappers ext2fs_open_file() and ext2fs_stat()
in commit c859cb1de0d624caa0779fb17d1a53766143136e in ext2fs.h caused
difficulties with the use of headers, since the headers for open64()
and stat64() may already be included (and skip the declaration of the
64-bit variants) before ext2fs.h is ever read. There is no real way
to solve the missing prototypes and resulting compiler warnings inside
ext2fs.h.

Since ext2fs_open_file() and ext2fs_stat() are not performance
critical operations, they do not need to be inline functions at all,
and the needed function headers can be handled properly in one file.

Similarly, posix_memalloc() was having difficulties with headers, and
was being defined in ext2fs.h, but it is now only being used by a
single file, so move the required header there.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
nline.c
nix_io.c
918eeb32e9bd1d053bafc9d3c70ef420c21eeda9 28-May-2012 Eric Sandeen <sandeen@redhat.com> libext2fs: fix rbtree backend for extent lengths greater than 2^32

For a completely full filesystem with more than 2^32 blocks, the
rbtree bitmap backend can assemble an extent of used blocks which is
longer than 2^32. If it does, it will overflow ->count, and corrupt
the rbtree for the bitmaps.

Discovered by completely filling a 32T filesystem using fallocate, and
then observing debugfs, dumpe2fs, and e2fsck all behaving badly.

(Note that filling with only 31 x 1T files did not show the problem,
because freespace was fragmented enough that there was no sufficiently
long range of used blocks.)

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lkmap64_rb.c
ae06582867e1a30d3f8ac2641e9f4cca8091b385 14-May-2012 Theodore Ts'o <tytso@mit.edu> Change pkg-config files so that both <et/com_err.h> and <com_err.h> work

Change the include path in the Cflags field so that #include
<lib/foo.h> and <foo.h> will work. We had originally used a C flags
which allowed <foo.h> to work, but many applications (especially those
not using pkg-config) had been using the <lob/foo.h> formulation which
didn't require an explicit -I{$includedir} option to the C compiler.

If those applications then converted over to pkg-config, and the
e2fsprogs libraries were installed with a prefix other than /usr, so
that the header files were in some directory such as
/usr/local/include, a program that used #include <lib/foo.h> would
fail to compile.

So change the pkg-config files to include both -I{$includedir} and
-I{$includir}/lib.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.pc.in
40024fdbafdf3875a0950e8fee5dd8bf69ea6b6c 14-May-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix bug in unix_io corrupted > 16TB file systems on 32-bit systems

The code was assuming that "unsigned long" was 64-bit, which of course
it isn't on 32-bit systems. This caused blocks to get written to the
wrong place.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nix_io.c
660b4c3b3fd78d0da408643b9c09b47becb5521a 12-May-2012 Theodore Ts'o <tytso@mit.edu> Reserve the codepoints for the INCOMPAT features LARGEDATA and INLINEDATA

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
d71520751ecfb9e0196ff154122f54f2e0f12d0f 02-May-2012 Theodore Ts'o <tytso@mit.edu> Support systems without posix_memalign() and memalign()

MacOS 10.5 doesn't have posix_memalign() nor memalign(), but it does
have valloc(). The Android SDK would like to be built on MacOS 10.5,
so I've added support for a good-enough emulation of memalign()'s
functionality using valloc(), with an explicit test to make sure
valloc() is returning a pointer which is sufficiently aligned given
the requested alignment. This won't work if you try to operate on a
file system with a 16k blocksize using an e2fsprogs built on MacOS
10.5 system, but it is good enough for the common case of 4k
blocksize file systems, and we will let the memory allocation fail in
the alignment is not good enough.

I've also added a unit test for ext2fs_get_memalign() so we can be
sure it's working as expected. I've tested the code paths with
HAVE_POSIX_MEMALIGN defined, HAVE_POSIX_MEMALIGN undefined, and
HAVE_POSIX_MEMALIGN and HAVE_MEMALIGN undefined on an x86 Linux
system, and so I know the valloc() code path works OK. The simplistic
(and less safe) patch at:

https://trac.macports.org/attachment/ticket/33692/patch-lib-ext2fs-inline.c.diff

Shows that using valloc() apparently works OK for MacOS 10.5 (but if
it doesn't the unit test will catch a problem).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
nline.c
fd1c5a0622a9578b86f695d2f60df7d4f8b21875 07-May-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: factor out I/O buffer allocation

Create a new function, io_channel_alloc_buf() which allocates I/O
buffers with appropriate alignment if we are using direct I/O. The
original code was sometimes using a larger alignment factor than
necessary, and would always request an aligned memory buffer even when
it was not necessary since the block device was not opened with
O_DIRECT.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_io.h
node.c
o_manager.c
penfs.c
w_bitmaps.c
nix_io.c
07d120848d143c40feb55be31f0f0bb1ad1ec6f9 07-May-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: make read_bitmaps() more efficient when using direct I/O

Read in a full block for each allocation bitmap, to avoid using a
kernel bounce buffer when using direct I/O.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
w_bitmaps.c
dd0a2679ddd0a9bf53e32efc0f67a7e7a5ea5f00 07-May-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: refactor Direct I/O alignment requirement calculations

Create a new function, ext2fs_get_dio_alignment(), which returns the
alignment requirements for direct I/O. This way we can factor out the
code from MMP and the Unix I/O manager. The two modules weren't
consistently calculating the alignment factors, and in particular MMP
would sometimes use a larger alignment factor than was strictly
necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
etsectsize.c
mp.c
nix_io.c
0a05b90330d8b505469c72143964b954776be232 07-May-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: move the alignment field from unix_io to the io_manager

The align field which indicated the required data alignment of data
buffers was stored in a field specific to the unix_io manager. Move
it to the top-level io_channel structure so it can be better
generalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_io.h
est_io.c
nix_io.c
46f100707c3cd07e271b0c6f5523ec6ca1ac4416 06-Apr-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: improve testing coverage of tst_bitmaps

Improve the test coverage of tst_bitmaps by:

(a) adding the ability to test the legacy (32-bit) bitmap code
(b) adding tests for ext2fs_find_first_zero_inode_bitmap2() and
ext2fs_find_first_zero_block_bitmap2()

The recent regressions caused by the addition (and use) of
ext2fs_find_first_zero_inode_bitmap2() would have been caught if we
had added these tests first. (Another object lesson in why unit tests
are critically important!)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
st_bitmaps.c
st_bitmaps_cmd.ct
st_bitmaps_cmds
st_bitmaps_exp
38792ca78bd4df44cb615bed04512f21945a150a 06-Apr-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: use correct types in ext2fs_find_first_zero_block_bitmap2()

Fortunately nothing was using this inline function, so we'll just fix
the types in its function signature, which were nonsensical (this was
caused by a cut-and-paste error).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
664c332612a0ef86df5c67286155ea895ed88ee3 06-Apr-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: add 32-bit compat code for ext2fs_find_first_zero_generic_bmap()

The lack of 32-bit support was causing febootstrap to crash since it
wasn't passing EXT2_FLAG_64BITS when opening the file system, so we
were still using the legacy bitmaps.

Also add support for bigalloc bitmap into the ffz functions.

Addresses-Red-Hat-Bugzilla: #808421

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
en_bitmap.c
en_bitmap64.c
b24efa218794b567c27ad99db319b4bd5d696958 06-Apr-2012 Theodore Ts'o <tytso@mit.edu> Don't assume that the presence of mntent.h means that setmntent() exists

Change autoconf to test for setmntent() and use that to decide whether
to use getmntent() and setmntent(), since some systems don't have
setmntent() but they do have the mntent.h header file.

Also, remove the includes of mntent.h from e2fsck and mke2fs and other
places where it is not needed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
smounted.c
304e11c2c1878ef392095d10bf5e93f7ea7131e4 05-Apr-2012 Theodore Ts'o <tytso@mit.edu> mke2fs: don't fail creating the journal if /etc/mtab is missing

The ext2fs_add_journal_inode() function calls
ext2fs_check_mount_point(), which can fail if /etc/mtab is missing.
This causes mke2fs to fail in the middle of the file system format
process; mke2fs calls ext2fs_check_mount_point() already (and has
appropriate fallbacks that calls fails), so add a flag so that mke2fs
can request ext2fs_add_journal_inode() to skip trying to call
e2fsck_check_mount_point().

Addresses-Sourceforge-Bug: #3509398

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
kjournal.c
e64e6761aa22f31123a91206a5686526f7b9c6c0 05-Apr-2012 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nitpicks

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lkmap64_rb.c
rc32c.c
xt2fs.h
en_bitmap64.c
et_pathname.c
count.c
btree.h
70d7281dcbf3180d291ade48296982dcda356877 28-Mar-2012 Theodore Ts'o <tytso@mit.edu> Update Release Notes, Changelogs, version.h, etc. for 1.42.2 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
3a6db9bbc8a5aa85c200e66fc0563a1e87417efe 27-Mar-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix ext2fs_get_memalign when posix_memalign() doesn't exist

Reported by: Gianluigi Tiesi <sherpya@netfarm.it>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nline.c
11f359f7660f0194ac1752ea83a704e6db1d5f9f 10-Mar-2012 Sami Liedes <sami.liedes@iki.fi> libext2fs: implement fast find_first_zero() for bitarray bitmaps.

With this change the CPU time needed to shrink a 100G filesystem drops
to 0.8% of the original (17 CPU seconds instead of 2057).

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lkmap64_ba.c
538eb8784a2c6cac28c539f545fa3bf6fea3246f 26-Mar-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: update dirty flags if the uninit flags are cleared

Update the block group descriptor checksum and mark the superblock and
allocation bitmaps as dirty in check_inode_uninit() and
check_block_uninit().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
c1a1e7fc24d6e37f931bbb8eeb29c90243f0a55d 10-Mar-2012 Sami Liedes <sami.liedes@iki.fi> libext2fs: Implement ext2fs_find_first_zero_generic_bmap().

This function searches a bitmap for the first zero bit within a range.
It checks if there is a bitmap backend specific implementation
available (if the relevant field in bitmap_ops is non-NULL). If not,
it uses a generic and slow method by repeatedly calling test_bmap() in
a loop. Also change ext2fs_new_inode() to use this new function.

This change in itself does not result in a large speedup, rather it
refactors the code in preparation for the introduction of a faster
find_first_zero() for bitarray based bitmaps.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lloc.c
itops.h
map64.h
en_bitmap64.c
5f7c04972fefa8198c34f231a9e8a5430705b4ab 23-Mar-2012 Sami Liedes <sami.liedes@iki.fi> libext2fs: document EXT2_FLAG_64BITS in ext2fs_open2()

From 5c7302de65d689ad84427649aab4d361b21270df Mon Sep 17 00:00:00 2001
From: Sami Liedes <sami.liedes@iki.fi>
Date: Sat, 10 Mar 2012 22:25:55 +0200
Subject: [PATCH] libext2fs: Document EXT2_FLAG_64BITS in ext2fs_open2().

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
penfs.c
75556776d315e67e411b983cdcdb05eb74b803a9 23-Mar-2012 Sami Liedes <sami.liedes@iki.fi> libext2fs: move a modulo operation out of a hot loop.

Filesystem shrinking in particular is a heavy user of this loop in
ext2fs_new_inode(). This change makes resize2fs use 24% less CPU time
for shrinking a 100G filesystem.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lloc.c
010dc7b90d97b93907cbf57b3b44f1c1cad234f6 23-Mar-2012 Lukas Czerner <lczerner@redhat.com> e2fsck: remove EXT4_EOFBLOCKS_FL flag handling

We've decided to remove EOFBLOCKS_FL from the ext4 file system entirely,
because it is not actually very useful and it is causing more problems
than it solves. We're going to remove it from e2fsprogs first and then
after the new e2fsprogs version is common enough we can remove the
kernel part as well.

This commit changes e2fsck to not check for EOFBLOCKS_FL. Instead we
simply search for initialized extents past the i_size as this should not
happen. Uninitialized extents can be past the i_size as we can do
fallocate with KEEP_SIZE flag.

Also remove the EXT4_EOFBLOCKS_FL from lib/ext2fs/ext2_fs.h since it is
no longer needed.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_fs.h
37c8db7b2078d0310e5676404e21cc143d8e4d56 22-Mar-2012 Theodore Ts'o <tytso@mit.edu> mke2fs: add option to use direct I/O (mke2fs -D)

This can be useful when using mke2fs on loaded servers, since
otherwise mke2fs can dirty a huge amount of memory very quickly,
leading to other applications not being happy at all.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
963d0f1a9458396c18d0aa030601f29cc1e25f30 20-Mar-2012 Andreas Dilger <adilger@whamcloud.com> tests: add field sizes to inode/super struct tests

In addition to validating the ordering of fields within the inode
and superblock structures, also validate the field sizes. Otherwise
it is possible to incorrectly change the size of one of these fields
without getting any kind of error from these tests. Failures would
only show up later in the test image checks if the field that is
changed is before another in-use field.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
st_inode_size.c
st_super_size.c
87141781aabb4dc01359428d2feecdc7f43eeac0 15-Mar-2012 Theodore Ts'o <tytso@mit.edu> dumpe2fs: print the expected block group checksum if it is incorrect

This helps to diagnose problems caused by incorrect block group
checksums.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
xt2fs.h
800766ee4a2bcdc0a32442d093d20da6ea3815ab 07-Mar-2012 Mike Frysinger <vapier@gentoo.org> libext2fs: check for fallocate symbol before using it

If we have newer kernel headers which define FALLOC_FL_PUNCH_HOLE, but we
are on an older glibc which lacks fallocate, we end up trying to use the
func anyways. Check the ifdef that autoconf already set up for us.

Reported-by: Ortwin Glueck <odi@odi.ch>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nix_io.c
7270fbe7fa51cbce01a07d031f03872f314206d1 24-Feb-2012 Andreas Dilger <adilger@whamcloud.com> build: fix compile warnings on OSX

Clean up some compile warnings related to fstat64(), which is
verbosely deprecated on OSX.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
etsize.c
997a0cf34e26c4af1cf18f2e61d8d1ad346e8e2f 27-Feb-2012 Mike Frysinger <vapier@gentoo.org> libext2fs: include config.h for HAVE_xxx defines

We check HAVE_UNISTD_H but haven't included config.h yet, so we end up
hitting warnings about missing prototypes for close/read/etc... funcs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mp.c
b96365f8c2e48b714332d038c6360f9993ac17e0 27-Feb-2012 Mike Frysinger <vapier@gentoo.org> libext2fs: include sys/time.h for gettimeofday()

Building on my glibc-2.15 system hits a warning:
gen_bitmap64.c: In function 'ext2fs_alloc_generic_bmap':
gen_bitmap64.c:127:2: warning: implicit declaration of function
'gettimeofday' [-Wimplicit-function-declaration]

Include sys/time.h if it's available for the prototype.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
d9a5d37535794842358e1cfe4faa4a89804ed209 21-Feb-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: support O_DIRECT functionality for Mac OS X

Darwin uses fcntl(fd, F_NOCACHE, 1) instead of the O_DIRECT flag.

Addresses-SourceForge-Bug: #3140289

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nix_io.c
48b89108202172268dd4a12645bece26c51d56fa 21-Feb-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: don't mark the superblock as dirty if the fs was opened r/o

If the file system is read/only opened with a backup superblock, and
the file system has uninit_bg enabled, the super block must not be
marked as dirty; otherwise, ext2fs_close() will call ext2fs_flush(),
which will fail, since the file descriptor for the block device was
opened read/only, and then the file descriptor won't actually be
closed.

This is normally not a problem since most of the time the program will
exit shortly after calling ext2fs_close(), and many programs don't
bother checking the error return from ext2fs_close(), especially if
the file system was opened read/only.

A big exception to this is e2fsck, since it opens and close the file
systems during its startup, and to make matters worse, registers an
error handler which will noisly complain about the failed writes
caused by ext2fs_flush().

Fix this by not marking the superblock as dirty if the file system was
opened read/only. The changes to the block group descriptors to clear
the uninit bits will still happen, so that e2fsck -n will properly
scan the whole file system. However, those changes will get dropped
when the file system handle is closed.

Addresses-SourceForge-Bug: #3444351

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
991211f676f49c6cf30af368dade2f81287f1fa8 17-Feb-2012 Theodore Ts'o <tytso@mit.edu> libext2fs, libe2p: Reserve RO_COMPAT_REPLICA feature

The replica is a feature which stores multiple copies of the key
metadata blocks so a single block failure in failure-prone media
(read: certain types of flash storage) doesn't take out the entire
file system.

Discussion on the upstream list proved not to be very positive on this
feature; the arguments were that it added complexity that wasn't
warrented, since common practice in industry is to insist on reliable
media, and if media is unreliable, you're kind of toast anyway (unless
the file system is being used as the back-end store of a cluster file
system where checksuming and data replication is happening above the
local disk file system level). So, this feature is being developed
out of tree.

We reserve the code points so that other people won't accidentally
step on them. Since it's not upstream, it's a soft reservation, but
it's not like we have any shortage of RO_COMPAT features. We are a
bit more tight on reserved inodes, but EXT2_BOOT_LOADER_INO and
EXT2_UNDEL_DIR_INO are not currently used anywhere, and
EXT2_EXCLUDE_INO is a reservation for another out-of-tree feature.
There are no features currently being discussed which require a
reserved inode, but if a need were to arise, we can claw back code
point reservations that were never used or not in tree, as those will
always be considered lower priority than in-tree features.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
xt2fs.h
3ae682bb0a5e025963b25ff5ac5d53e2115483f2 17-Feb-2012 Darrick J. Wong <djwong@us.ibm.com> libext2fs: Add ext2fs_file_get_inode_num call (for fuse2fs)

Add a function to return the inode number of an open file.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
ileio.c
a204236eafb47e3cd4e9dbc0e810bccd8c9173cc 15-Feb-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: fix BLOCK_ABORT handling in the block iterator for extents

When processing files that contain extents, the block iterator
functions were not properly handling the BLOCK_ABORT bit. This could
cause problems such as ext2fs_link() adding a directory entry multiple
times.

Thanks to Darrick Wong <djwong@us.ibm.com> for reporting this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
9e89dbbd462b389b6406eb9f02eb63ca997b0e8a 15-Feb-2012 Darrick J. Wong <djwong@us.ibm.com> libext2fs: when truncating file, punch out blocks at end

Currently, ext2fs_file_set_size2 punches out data blocks between the
end of the file and infinity when truncate_block <= old_truncate
(i.e. when you've made the file longer). This is not a useful
behavior, particularly since it *fails* to punch out the data blocks
when the file is shortened (i.e. truncate_block < old_truncate). This
seems to be the result of the test being backwards, so fix the code to
punch only when the file is getting shorter.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ileio.c
454ac9d56acb643c48222c71f2b0e63926783b17 08-Feb-2012 Andreas Dilger <adilger@whamcloud.com> libext2fs: quiet spurious group checksum errors

If we have to read the backup group descriptor checksums, the UNINIT
flags are cleared to ensure that all of the inodes in the filesystem
are scanned. However, the code that reset the UNINIT flags did not
reset the group checksum, and this produced many spurious error
messages in e2fsck.

Group descriptor 0 checksum is invalid. FIXED.
Group descriptor 1 checksum is invalid. FIXED.
:
:

Recompute checksums after modifying group descriptors to avoid these
error messages. Remove expected error messages in f_illitable_flexbg.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
penfs.c
1f572d1f88628c1e0dc88cb8cfaf2bb480b81e4f 17-Jan-2012 Theodore Ts'o <tytso@mit.edu> libext2fs: display partial path if fs corrupted in ext2fs_get_pathname()

The function ext2fs_get_pathname() used to return EXT2_ET_NO_DIRECTORY
if one of the directories in an inode's pathname is not a directory.
This is not very useful in an emergency, when the file system is
corrupted. This commit will cause ext2fs_get_pathname() to return a
partial pathname, which should help system administrators trying to
use debugfs to investigate a corrupted file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
et_pathname.c
24d364fc43601ea3d2e01cc506633302fa091d8f 10-Jan-2012 Mike Frysinger <vapier@gentoo.org> libext2fs: change getpagesize to sysconf

Newer versions of glibc no longer export the getpagesize() prototype when
using recent versions of POSIX (_XOPEN_SOURCE). So building tdb.c gives
use implicit function declaration warnings. Fix the issue by using the
portable sysconf() function which returns the same answer.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
db.c
9288e3be665bb8d5657d7f710687a50fad859acf 16-Dec-2011 Lukas Czerner <lczerner@redhat.com> libext2fs: add bitmap statistics

This feature is especially useful for better understanding how e2fsprogs
tools (mainly e2fsck) treats bitmaps and what bitmap backend can be most
suitable for particular bitmap. Backend itself (if implemented) can
provide statistics of its own as well.

[ Changed to provide basic statistics when enabled with the
E2FSPROGS_BITMAPS_STATS environment variable -- tytso]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lkmap64_ba.c
lkmap64_rb.c
map64.h
xt2fs.h
en_bitmap64.c
count.c
4a61d17c7c4c09ce3bb5f77bdb9b90eb9f10e8c3 17-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: adjust the description when copying a bitmap

Label the copy of a bitmap as "copy of ..." so that the bitmap's
description is more descriptive.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap64.c
830b44f4385eb255d08fe0c8b200f8d8e3e97a8d 16-Dec-2011 Theodore Ts'o <tytso@mit.edu> e2fsck: use different bitmap types as appropriate

Now that we have multiple backend implementations of the bitmap code,
this commit teaches e2fsck to use either the most appropriate backend
for each use case.

Since we don't know for sure if we will get it all right, the default
choices can be overridden via e2fsck.conf. The various definitions
are shown here, with the current defaults (which may change as we add
more bitmap implementations and as learn what works better).

; EXT2FS_BAMP64_BITARRAY is 1
; EXT2FS_BMAP64_RBTREE is 2
; EXT2FS_BMAP64_AUTODIR is 3
[bitmaps]
inode_used_map = 2 ; pass1
inode_dir_map = 3 ; pass1
inode_reg_map = 2 ; pass1
block_found_map = 2 ; pass1
inode_bad_map = 2 ; pass1
inode_imagic_map = 2 ; pass1
block_dup_map = 2 ; pass1
block_ea_map = 2 ; pass1
inode_link_info = 2 ; pass1
inode_dup_map = 2 ; pass1b
inode_done_map = 3 ; pass3
inode_loop_detect = 3 ; pass3
fs_bitmaps = 2

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
0ff7bf30074d8a449ba389e9f088d356447105de 16-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: use the rbtree bitmap by default when initializing a file system

This change causes the max resident memory of mke2fs, as reported by
/usr/bin/time, to drop from 9296k to 5328k when formatting a 25
gig volume.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
d182831a15dfa4d36979be10fdfd4ec06bdd65b9 18-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIR

This backend type will automatically switch between the bitarray and
the rbtree backend based on the number of directories in the file
system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2fs.h
en_bitmap64.c
c1359d91958cadfbc0987921ee5b4db717852e90 18-Dec-2011 Lukas Czerner <lczerner@redhat.com> libext2fs: add a bitmap implementation using rbtree's

For a long time we had a bitarray backend for storing filesystem
metadata bitmaps, however today this approach might hit its limits with
todays huge data storage devices, because of its memory utilization.

Bitarrays stores bitmaps as ..well, as bitmaps. But this is in most
cases highly unefficient because we need to allocate memory even for the
big parts of bitmaps we will never use, resulting in high memory
utilization especially for huge filesystem, when bitmaps might occupy
gigabytes of space.

This commit adds another backend to store bitmaps. It is based on
rbtrees and it stores just used extents of bitmaps. It means that it can
be more memory efficient in most cases.

I have done some limited benchmarking and it shows that rbtree backend
consumes approx 65% less memory that bitarray on 312GB filesystem aged
with Impression (default config). This number may grow significantly
with the filesystem size, but also it may be a lot lower (even negative)
if the inodes are very fragmented (need more benchmarking).

This commit itself does not enable the use of rbtree backend.

[ Simplified the code by avoiding unneeded memory allocation and
deallocation of del_ext. In addition, fixed a bug discovered by the
tst_bitmaps tests: rb_unamrk_bmap() must return true if the bit was
previously set in bitmap, and zero otherwise -- tytso ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
lkmap64_rb.c
map64.h
xt2fs.h
en_bitmap64.c
5db745a2836fd480d6be1b7cf388b0aad6b786ad 16-Dec-2011 Lukas Czerner <lczerner@redhat.com> libext2fs: add rbtree library

This commit adds rbtree library into e2fsprogs so it can be used for
various internal data structures. The rbtree implementation is ripped of
kernel rbtree implementation with small changes needed for it to work
outside kernel.

[ I prefixed the exported symbols and interface with ext2fs_ to keep
avoid pulluting the namespace exported by the libext2fs shared
library. -- tytso ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
btree.c
btree.h
b8ad88b3e746b0c37dfb61e0fe7ad7a7636f9537 18-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: add tests for the bitmap functions

These tests allow us to be sure that the new bitmap backends are
correctly implemented.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
st_bitmaps.c
st_bitmaps_cmd.ct
st_bitmaps_cmds
st_bitmaps_exp
67861e5bf3ae177b14d34846218fcdfdeee805a6 16-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: add default_bitmap_type to the ext2_filsys structure

This allows a program to control the bitmap backend implementation
that will get used without needing to change the current library API.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itmaps.c
xt2fs.h
xt2fsP.h
en_bitmap64.c
ba37bb704f4ab2631a39c32b35d6bb339e17b293 05-Dec-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: don't break when ext2fs_clear_generic_bmap() for 32-bit bitmaps

This is only an issue for programs compiled against e2fsprogs 1.41
that manipulate bitmaps directly. Fortunately there are very few
programs which do that, especially those that try to clear a bitmap.

Addresses-Sourceforge-Bugs: #3451486

Reported-by: robi6@users.sourceforge.net
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap64.c
499d5ec5582209279bb0cf86672770d77b047871 29-Nov-2011 Theodore Ts'o <tytso@mit.edu> Update Release Notes, Changelogs, version.h, etc. for 1.42 release

Also fixed depfix.sed

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
4e523bbe00cfa0240b4581eeca0c097b05c9fe3e 29-Nov-2011 Theodore Ts'o <tytso@mit.edu> e2fsck: speed up runs when using tdb for large atypical filesystems

Optimize how the tdb library so that running with [scratch_files] in
/etc/e2fsck.conf is more efficient. Use a better hash function,
supplied by Rogier Wolff, and supply an estimate of the size of the
hash table to tdb_open instead of using the default (which is way too
small in most cases). Also, disable the tdb locking and fsync calls,
since it's not necessary for our use in this case (which is
essentially as cheap swap space; the tdb files do not contain
persistent data.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
count.c
db.c
db40c20e3fd66d90d29a41bef9eb20d1e0745906 28-Nov-2011 Theodore Ts'o <tytso@mit.edu> configure: check for msync() for portability reasons

Turns out the Hurd defines MS_SYNC but doesn't define msync(). Go
figure. So check for both.

Reported by Svante Signell.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
db.c
5fff8636e54f762fcfe7312ec7c0428924ff7292 26-Nov-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: move mmp fields to preserve structure layout of ext2_filsys

This helps provide better ABI compatibility for e2fsprogs 1.42.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
930d7a7fb777c4558b5417ae00a4cf57b10169a2 26-Nov-2011 Theodore Ts'o <tytso@mit.edu> tst_fs_struct: add program to help check ABI compatibility of ext2fs_filsys

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
st_fs_struct.c
08ae93a2eda03817deabf08d4da9015a283ed56b 20-Nov-2011 Niu Yawei <niu@whamcloud.com> libext2fs: enforce a max nested link count in ext2fs_find_block_device()

Define EXT2FS_MAX_NESTED_LINKS as 8, and check the link count to make
sure we don't exceed it in ext2fs_find_block_device() and
follow_link(). This fixes a potential infinite loop in
ext2fs_find_block_device() if there are symbolic loop links in the
device directory.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fsP.h
inddev.c
amei.c
c4ab66c526c2f9bdff2e9abb817287b585e2e95d 17-Nov-2011 Theodore Ts'o <tytso@mit.edu> debugfs: add filefrag command

Add the ability to report on the fragmentation of a file on a file
system opened using debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
5e96c5721d58acfbf9d76b62214f6ae421fe4e6b 15-Nov-2011 Theodore Ts'o <tytso@mit.edu> debugfs: add the freefrag command

The freefrag command provides the functionality of e2freefrag on the
currently open file system in debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
7becb2065ffd5c4b403546d577c2421b4a840c3c 14-Nov-2011 Theodore Ts'o <tytso@mit.edu> Make quota support disabled by support

Quota support can be enabled using --enable-quota. There are still
some buglets that we need to fix up before it can be considered 100%
supported, so let's disable it for the 1.42 release.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
df7a86d404e293465b8e5f39859c0916e84ba35a 12-Nov-2011 Eric Sandeen <sandeen@redhat.com> libext2fs: fix write size in ext2fs_mmp_write

Without this change, we will write data past the end of the
mmp buf. Valgrind catches this:

==6373== Syscall param write(buf) points to unaddressable byte(s)
==6373== at 0x362260E470: __write_nocancel (in /lib64/libpthread-2.12.2.so)
==6373== by 0x41CF83: raw_write_blk (unix_io.c:255)
==6373== by 0x41D2BC: unix_write_blk64 (unix_io.c:757)
==6373== by 0x41A05D: ext2fs_mmp_write (mmp.c:130)
==6373== by 0x40B0C9: do_set_mmp_value (set_fields.c:806)
==6373== by 0x421B61: really_execute_command (execute_cmd.c:108)
==6373== by 0x421C54: ss_execute_line (execute_cmd.c:234)
==6373== by 0x403743: main (debugfs.c:2339)
==6373== Address 0x63f000 is not stack'd, malloc'd or (recently) free'd

and in my testing it led to silent failures while writing the mmp
block in debugfs:

write(3, "xV4\22PMM\342\325V\274N\0\0\0\0host.name."..., 4096) = -1 EFAULT (Bad address)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mp.c
a9f46078c4313a466c7014c733dc3a4daa8fdec4 10-Nov-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: use HAVE_FSTAT64 instead of HAVE_STAT64 for ext2fs_stat()

Commit 6b56f3d92d introduced the use of HAVE_STAT64 without arranging
that it be defined in configure.in. Previously ext4.h used
HAVE_OPEN64, but apparently there are (broken) platforms that have
open64() but not stat64(). Go figure.

We do need to consistently use a single test for ext2fs_stat(),
ext2fs_fstat(), and struct ext2fs_struct_stat, or we could end up
passing a struct stat64 to a fstat() system call, or some such. I've
elected to use HAVE_FSTAT64 because: (a) it's already defined in the
configure script, and (b) if we ever come across a really broken
platform that defines fstat64() but not stat64(), we can always
emulate stat64() using open64() followed by a fstat64().

This commit fixed a bug whose symptoms were that mke2fs would not work
if given a file > 2GB on 32-bit platforms.

Addresses-Debian-Bug: #647245

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
fc4fd955f705bdbdf5512b1c739191f17d483135 10-Nov-2011 Eric Sandeen <sandeen@redhat.com> libext2: advance group in ext2fs_open2 during swapping

Without this change, we go back to getting group descriptor
"0" each time we go around the "for i" loop. It must properly
advance through the filesystem.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
penfs.c
d1b75fd60c255ebc07209a5928dff497f58cd745 05-Nov-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: don't leak tdb_null out of the shared library namespace

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
db.c
db.h
7f21666a3da39fd335f5d4b27499d4ff76b53375 17-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: allow ext2fs_get_memalign() to compile w/o posix_memalign()

Addresses-Sourceforge-Bug: #3219173

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
nline.c
0c80c44bd08c60f3cd0ad87f12a71a75cac3bcaa 17-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flag

The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to
only check i_file_acl_high if the 64-bit flag is set. This is needed
because otherwise we will run into problems on Hurd systems which
actually use that field for h_i_mode_high.

This involves an ABI change since we need to pass ext2_filsys to these
functions. Fortunately these functions were first included in the
1.42-WIP series, so it's OK for us to change them now. (This is why
we have 1.42-WIP releases. :-)

Addresses-Sourceforge-Bug: #3379227

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lknum.c
move.c
xt2fs.h
alid_blk.c
3fcd8fe8acb269598390b35bbf6e4247d10bc64e 09-Oct-2011 Theodore Ts'o <tytso@mit.edu> Fix more spelling errors found by translators and add pluralization

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
c4012e5a7ace2e1f382c4d46f56e5749758c9a1a 06-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargs

Some architectures have narrow mode_t's which can cause some
portability warnings with varargs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
etsectsize.c
etsize.c
nix_io.c
fd7c37fec1aec297c883998e811ee339024edf6e 05-Oct-2011 Theodore Ts'o <tytso@mit.edu> Update for e2fsprogs 1.42-WIP-1005 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
edbfd75d8fb4a13eccc2cadb12a453c3425d17d1 04-Oct-2011 Theodore Ts'o <tytso@mit.edu> libquota: clean up some gcc -Wall warnings

Remove unused variables, places where 'return' was used with no value
in a non-void function, missing function declarations, etc. Don't
assume that all systems have quotactl(), and use <sys/quota.h> if it
exists to define the quotactl interfaces.

One of the unused variables also got rid of a non-portable use of
PATH_MAX.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
00ea586fb23f88da616c27d66faf210532c12b5a 04-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix bad cast which causes problems for file systems > 512EB

If the number of block groups exceeds 2**32, a bad cast would lead to
a bogus "Not enough space to build proposed filesystem while setting
up superblock" failure.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
bfbeec0c89d44d456003770d25c70735e45c5622 04-Oct-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: Fix thinko in ext2fs_initialize bigalloc case

Surely we should be setting s_clusters_per_group, not
s_blocks_per_group, to EXT2_MAX_CLUSTERS_PER_GROUP here.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
8232f2ddaece256afd323eb5a289a5ec1b7fbd1a 04-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: move #include "ext2fs.h" from crc32c_defs.h to crc32c.c

The byte swap functions which are defined in ext2fs.h are only needed
by crc32.c, and not by gen_crc32ctable.c. The gen_crc32ctable program
needs to be compiled on the host OS, where ext2fs.h may not be
present. So move the use of the header function to crc32c.c, to avoid
compilation problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
rc32c.c
rc32c_defs.h
756690a29e088946129bed95066ec146f79fab89 03-Oct-2011 Theodore Ts'o <tytso@mit.edu> libext2fs, libquota: fix some makefile dependency issues

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
e43bb12f402c7de72113a24701fcd17024e1f25c 03-Oct-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: include headers for open() in ext2fs.h

ext2fs.h now calls open() so it should include the headers needed
for this system call as well.

Addresses-Red-Hat-Bugzilla: #742147

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
9026b3db3af838983ed81aad2b4d5e09df1013e3 30-Sep-2011 Darrick J. Wong <djwong@us.ibm.com> libext2fs: Always swab the MMP block on big-endian systems machines

The MMP code in libext2fs tries to gate MMP block swab'ing with this
test:

if (fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))

However, EXT2FS_ENABLE_SWAPFS never seems to be defined anywhere (all
possible existed, the field fs->super->s_magic is always in host
byteorder, so the test always fails. So, we can change the #ifdef to
WORDS_BIGENDIAN (which is conditionally defined on BE platforms) and
get rid of the broken if test.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
mp.c
a7a63675af85b4b636e9df4961ca44ea03bf160b 30-Sep-2011 Darrick J. Wong <djwong@us.ibm.com> libext2fs: Fix various bugs from the metadata checksum integration

Fix several minor errors in structure definitions, the byteswap code,
and Makefiles that result from merging the crc32c and initial parts of
the metadata checksumming patchset.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2fs.h
wapfs.c
a378bd5a5a80656ad1782ee80fa301a5ecb10ecb 29-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: use ext2fs byte swap functions for portability

The functions htole32(), le32toh(), be32toh(), htobe32() aren't
defined in all environments. Use the ext2fs byte swap functions for
portability.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
rc32c_defs.h
0f5eba7501f467f757792ee449d16c9259b994fd 24-Sep-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: add multi-mount protection (INCOMPAT_MMP)

Multi-mount protection is feature that allows mke2fs, e2fsck, and
others to detect if the filesystem is mounted on a remote node (on
SAN disks) and avoid corrupting the filesystem. For e2fsprogs this
means that it checks the MMP block to see if the filesystem is in use,
and marks the filesystem busy while e2fsck is running on the system.

This is useful on SAN disks that are shared between high-availability
servers, or accessible by multiple nodes that aren't in HA pairs. MMP
isn't intended to serve as a primary HA exclusion mechanism, but as a
failsafe to protect against user, software, or hardware errors.

There is no requirement that e2fsck updates the MMP block at regular
intervals, but e2fsck does this occasionally to provide useful
information to the sysadmin in case of a detected conflict.

For the kernel (since Linux 3.0) MMP adds a "heartbeat" mechanism to
periodically write to disk (every few seconds by default) to notify
other nodes that the filesystem is still in use and unsafe to modify.

Originally-by: Kalpak Shah <kalpak@clusterfs.com>

Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
akefile.in
losefs.c
xt2_err.et.in
xt2_fs.h
xt2fs.h
reefs.c
mp.c
penfs.c
wapfs.c
st_super_size.c
6b56f3d92d08806ab415e8fd883480f7f9c148e8 24-Sep-2011 Andreas Dilger <adilger@whamcloud.com> misc: quiet minor compiler errors

Several compiler errors are quieted:
- zero-length gnu_printf format string
- unused variable
- uninitalized variable (though it isn't actually used for anything)
- fixed a bug in ext2fs_stat() if stat64() does not exist

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
rc32c.c
xt2fs.h
etsize.c
9d9a53e651fa877eb4f9df0bfd97fbcc5f514293 24-Sep-2011 Richard W.M. Jones <rjones@redhat.com> libext2fs: add flag to ext2fs_flush() and ext2fs_close() to avoid fsync

This adds new APIs: ext2fs_flush2 and ext2fs_close2 which take an
extra 'int flags' parameter.

This allows us to pass in an EXT2_FLAG_FLUSH_NO_SYNC flag which avoids
fsync'ing the filesystem when closing it. For the case we have in
mind where we are just constructing a throwaway ext2 filesystem in a
file in order to boot a VM, this saves over 5 seconds during the boot
process and avoids many unnecessary disk writes.

Existing code using ext2fs_flush and ext2fs_close remains unaffected
by this change.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
losefs.c
xt2fs.h
d1154eb460efe588eaed3d439c1caaca149fa362 18-Sep-2011 Theodore Ts'o <tytso@mit.edu> Shorten compile commands run by the build system

The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn. It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_compat.c
b_inode.c
itmaps.c
itops.c
lkmap64_ba.c
lknum.c
lock.c
map.c
move.c
rel_ma.c
heck_desc.c
losefs.c
rc16.c
rc32c.c
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
osio.c
upfs.c
xpanddir.c
xt_attr.c
xtent.c
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
en_bitmap64.c
et_pathname.c
etsectsize.c
etsize.c
_block.c
count.c
mager.c
nd_block.c
nitialize.c
nline.c
node.c
node_io.c
o_manager.c
rel_ma.c
smounted.c
ink.c
lseek.c
ookup.c
kdir.c
kjournal.c
amei.c
ative.c
ewdir.c
penfs.c
rogress.c
unch.c
cow2.c
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
parse.c
wapfs.c
db.c
dbtool.c
est_io.c
st_badblocks.c
st_bitops.c
st_byteswap.c
st_getsectsize.c
st_getsize.c
st_inode_size.c
st_iscan.c
st_super_size.c
st_types.c
ndo_io.c
nix_io.c
nlink.c
alid_blk.c
ersion.c
rite_bb_file.c
5ea3c825929b01739b9b876378c38846aa4b1f13 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> libext2: Fix leaks in write_bitmaps on error returns

block_buf and/or inode_buf may not be properly freed on an error
return.

Create a new errout: target to free them as needed in error conditions.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
w_bitmaps.c
624e8ebe3058bad9af6e719b7f9e7afab7d3fe30 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: Fix some error cleanup path bugs

In inode_open(), if the allocation of &io fails, we go to cleanup
and dereference io to test io->name, which is a bug.

Similarly in undo_open() if allocation of &data fails, we
go to cleanup and dereference data to test data->real.

In the test_open() case we explicitly set retval to the only
possible error return from ext2fs_get_mem(), so remove that
for tidiness.

The other changes just make make earlier returns go through
the error goto for consistency.

In many cases we returned directly from the first error, but
"goto cleanup" etc for every subsequent error. In some
cases this leads to "impossible" tests such as:

if (ptr)
ext2fs_free_mem(&ptr)

on paths where ptr cannot be null because we would have
returned directly earlier, and Coverity flags this.

This isn't really indicative of an error in most cases, but
I think it can be clearer to always exit through the error goto
if it's used later in the function.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
blist.c
node.c
node_io.c
est_io.c
ndo_io.c
nix_io.c
9e30fb23ef85d6b2a58527048cc9208405a38299 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: annotate intentional fallthroughs in case statements

Using the /* fallthrough */ comment lets Coverity (and humans)
know that we really do want to fall through in these case statements.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
irhash.c
xtent.c
665563b825ca697a2b4bdd340760a36f6263709e 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> libext2fs: Potential null ptr deref in undo_err_handler_init

In the !undo_io_backing_manager case, undo_err_handler_init
will be passed a null data->real, which will be dereferenced.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ndo_io.c
d0f196d867504d8461fb7c6958aa6a5d220d5825 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> libext2: move buf variable completely under ifdef

If !WORDS_BIGENDIAN, it is pointless to test whether buf
is NULL, because it is initialized to NULL and never changed.
This makes Coverity complain, so we can just move all handling
of "buf" under the #ifdef.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt_attr.c
bc28abc537ff49d708abd66cc70ee451fdd010fd 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> libext2: Fix EXT2_LIB_SOFTSUPP masking

EXT2_LIB_SOFTSUPP_INCOMPAT_* are supposed to be bitmasks
of features which can be opened even though they are
under development. The intent is that these are masked
out of the features list, so that they will be ignored
on open.

However, the code does a logical not vs. a bitwise not:

features &= !EXT2_LIB_SOFTSUPP_INCOMPAT;

which will not have the desired effect...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
penfs.c
ae96c678e15eda2a5d0eea7e1067b449f6604aff 16-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2s: fix swapfs.c so it builds on big endian systems

Also cleaned up ext2_fs.h, and improved the byte swapping code so the
extra fields in the large inode are properly byte swapped.

Addresses-Debian-Bug: #641838

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
wapfs.c
16c581d0e8d931f3cf0005de07481d7380ca4c0c 15-Sep-2011 Theodore Ts'o <tytso@mit.edu> debugfs: add 64-bit support to the set_field commands

The set_fields commands (set_super_value, set_inode_field,
set_block_group) now handle fields which store in split fields on
ext4's on-disk format. For example, the superblock fields
s_blocks_count and s_blocks_count_hi.

The user can either set the low or high part of the field via
"blocks_count_lo" or "blocks_count_hi", or both parts can be set via
"blocks_count".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
st_super_size.c
89efc88e65136ece22708cc28ec4124a33feeecd 15-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: add metadata checksum and snapshot feature flags

Reserve EXT4_FEATURE_RO_COMPAT_METADATA_CSUM and
EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP. Also reserve fields in the
superblock and the inode for the checksums. In the block group
descriptor, reserve the exclude bitmap field for the snapshot feature,
and checksums for the inode and block allocation bitmaps.

With this commit, the metadata checksum and exclude bitmap features
should have reserved all of the fields they need in ext4's on-disk
format.

This commit also fixes an a missing byte swap for s_overhead_blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Amir Goldstein <amir73il@gmail.com>
xt2_fs.h
wapfs.c
st_inode_size.c
st_super_size.c
f314bb0821473efcecedc450c18211e781d30a72 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> libext2fs: remove redundant last-group check in ext2fs_check_desc()

ext2fs_group_last_block2() already properly calculates
the last block in the last group, so there is no need
to special-case this after the call.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
heck_desc.c
98f4547198b369bef7e41eb7ce4a16855726c393 16-Sep-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: add ext2fs_group_blocks_count helper

Code to count the number of blocks in the last partial
group is cut and pasted around the e2fsprogs codebase
a few times.

Making this a helper function should improve matters.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lloc_sb.c
lknum.c
losefs.c
xt2fs.h
65b7a463da3b8f7ce0892be579f34ba4cf66456e 16-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix size check in tst_inode_size

Also add run tst_inode_size automaically from "make check"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
st_inode_size.c
75405ffde6f87f88c7172bfb431ec085c542ec1a 16-Sep-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
d2bfdc7ff15ce7b6b40c087021528ce190ef43c3 16-Sep-2011 Lukas Czerner <lczerner@redhat.com> e2fsprogs: Use punch hole as "discard" on regular files

If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of
on block device, we can use punch hole instead of regular discard
command which would not work on regular file anyway. This gives us
several advantages. First of all when e2fsck is run with '-E discard'
parameter it will punch out all ununsed space from the image, hence
trimming down the file system image. And secondly, when creating an
file system on regular file (with '-E discard' which is default), we
can use punch hole to clear the file content, hence we can skip inode
table initialization, because reads from sparse area returns zeros. This
will result in faster file system creation (without the need to specify
lazy_itable_init) and smaller images.

This commit also fixes some tests that would fail due to mke2fs showing
discard progress, hence the output would differ.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_io.h
nix_io.c
c859cb1de0d624caa0779fb17d1a53766143136e 16-Sep-2011 Lukas Czerner <lczerner@redhat.com> e2fsprogs: create open() and stat() helpers

In many places we are using #ifdef HAVE_OPEN64 to determine if we can
use open64() but that's ugly. This commit creates two new helpers
ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need
new typedef ext2fs_struct_stat for struct stat.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
etsectsize.c
etsize.c
nix_io.c
db8bbf27c9eeaa9c1803fb52a6cc7a60c5250c7e 16-Sep-2011 Darrick J. Wong <djwong@us.ibm.com> libext2fs: Add crc32c implementation for metadata checksumming

Add a slicing-by-8 CRC32c implementation for metadata checksumming.
Adapted from Bob Pearson's kernel patch.

Also added a self-test mechanism so we can verify that the crc32c
implementation is working correctly.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
akefile.in
rc32c.c
rc32c_defs.h
xt2fs.h
en_crc32ctable.c
15749d7da9b6242d477801a54164b3d04c2b4102 16-Sep-2011 Amir Goldstein <amir73il@users.sf.net> libext2fs: fix the range validation in bitmap_range2 funcs

The condition ((start+num) & ~0xffffffffULL) in bitmap_range2
and generic_bmap_range funcs in get_bitmap64.c was wrong and
inconsistent with the condition (start+num-1 > bmap->real_end)
in generic_bitmap_range funcs in get_bitmap.c.

I got the following error from tune2fs on a 16TB fs:
Illegal block number passed to ext2fs_unmark_block_bitmap #4294967295
for block bitmap for 16TB.img
tune2fs: Invalid argument while reading bitmaps

Fix to condition to ((start+num-1) & ~0xffffffffULL), because
the bit (start+num) is not going to be changed by the funcs.

Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
3fbfad558e01ffbacc14e5a536c4dfec0a0af4f5 15-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix binary and source compatibility with the dump program

The dump program relies on fs->frag_size and the
EXT2_FRAGS_PER_BLOCK() macro. Kind of silly for it to do so, but it's
part of the kludgy way the dump program (which was originally written
for the BSD FFS was ported over to support ext2/3.) Given how it
makes assumptions about the ext2/3/4 file system being similar to the
BSD FFS, it's a bit of a miracle it works for ext4 --- or at least
appears to work...

Addresses-Debian-Bug: #636418

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
xt2fs.h
nitialize.c
penfs.c
897fbaac7dfb2afe1eb67a76f3b003a8eca19199 14-Sep-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: add new test: tst_inode_size

This test makes sure the size of the ext2_inode is what we expect

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
st_inode_size.c
9f6ba888f027ba4daf57ac61a11a6dce98e42347 14-Sep-2011 Yongqiang Yang <xiaoqiangnk@gmail.com> resize2fs: add support for new in-kernel online resize ioctl

This is needed to support online resizing for > 32-bit file systems

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
624e4a6466dba9889f5f80dc168f2bb7c2a3f5d0 20-Jul-2011 Aditya Kali <adityakali@google.com> e2fsck: add support for checking the built-in quota files

This patch adds support for doing quota accounting during full
e2fsck scan if the 'quota' feature was set on the superblock.
If user-visible quota inodes are in use, they will be hidden
and converted to the reserved quota inodes.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
a4aff9ca5bcc3df76dcb3d49765674feba3d7654 31-Aug-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix binary search for the icount and badblocks stores

Remove the interpolation because there is a bug in icount which can
cause a core dump if calculated range gets turned into a NaN and then
do an out-of-bounds array access. We could fix this with some more
tests, but the complexity is such that nuking all of the interpolation
code will be faster than fixing the interpolation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
adblocks.c
count.c
9c79612f2186a8ee5d8a6f2c961e4e0f63df7228 10-Aug-2011 Eric Sandeen <sandeen@redhat.com> libext2fs: copy cluster_bits in ext2fs_copy_generic_bmap

The f_lotsbad regression test was failing on some systems
with:

Restarting e2fsck from the beginning...
Pass 1: Checking inodes, blocks, and sizes
+Illegal block number passed to ext2fs_test_block_bitmap #0 for in-use block map
Pass 2: Checking directory structure
Entry 'termcap' in / (2) has deleted/unused inode 12. Clear? yes

Running with valgrind (./test_script --valgrind f_lotsbad) we
see:

+==31409== Conditional jump or move depends on uninitialised value(s)
+==31409== at 0x42927A: ext2fs_test_generic_bmap (gen_bitmap64.c:378)

among others.

Looking at gen_bitmap64.c:
376: arg >>= bitmap->cluster_bits;
377:
378: if ((arg < bitmap->start) || (arg > bitmap->end)) {

A little more debugging showed that it was actually
bitmap->cluster_bits which was uninitialized, because it never
gets copied over in ext2fs_copy_generic_bmap()

Patch below resolves the issue.

Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
d8fae3cf421eb5ebc0cf8726885eb81aff0a5d1f 10-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix block iterator when the callback function modifies an extent

If the callback interator modifies a block in the middle of an extent
during a call to the block iterator, causing the extent to be split,
ext2_block_iterate3() will end up calling the callback function twice
for some number of blocks. Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
0bd0e5932046401049502ee99529b984d7cd316e 09-Jul-2011 Andreas Dilger <adilger@whamcloud.com> misc: use EXT2_I_SIZE() consistently to get size

Use the EXT2_I_SIZE() macro consistently to access the inode size.
The i_size/i_size_high combination is open coded in several places.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
ileio.c
81c6377d93106ccfae12b5b4f1953e97aa92b65e 08-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: don't hang in ext2fs_new_block2() on a full bigalloc file system

Prevent ext2fs_new_block2() from looping forever when a bigalloc file
system is full.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
8e8a190fa212ca28efb2e8a8b3318a24d7fc4b7a 08-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: teach ext2fs_bmap2() about bigalloc

This allows debugfs's write command to work correctly on bigalloc file
systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
551e2e46ee2fdf8cfa16e153d3c560203f0f9a5e 07-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: move ext2fs_bmap2()'s the extent handling to a separate function

Separate the extent handling to a separate function to make BMAP_ALLOC
processing more efficient.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
b98d3e8fadf32cc34b8231089a4da0a225697545 07-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: teach ext2fs_block_alloc_stats2() about bigalloc

Change ext2fs_block_alloc_stats2() so that when a cluster is
allocated, the free blocks counter in the superblock is appropriately
decremented by the cluster size.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_stats.c
c4d2d43e2dc831d5c209af3e42dffd7b5e65c1f6 07-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: replace missing flexbg initialization in flexbg_offset

Commit 25567a7b0fa9 accidentally removed the initialization for flexbg
and flexbg_size, which affected ext2fs_allocate_group_table() and
ext2fs_allocate_tables(). Replace them.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
d32c915abfb224f6f6659e9cada7e9f759b7e3d2 07-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix gcc -Wall warnings

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
heck_desc.c
sum.c
xt2_fs.h
xt2fs.h
ink.c
penfs.c
unch.c
nix_io.c
062cc472e6cae60a1fa43976bcc6ff39f8351ccb 06-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix 64-bit support in ext2fs_bmap2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
41e102a4d1be1aed9bdd002e03b4d244b5446036 06-Jul-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix 64-bit support in ext2fs_{read,write}_inode_full()

This fixes a problem where reading or writing inodes located after the
4GB boundary would fail.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
25567a7b0fa98b390fd1ff0d4702b29c23a75bbb 05-Jul-2011 Theodore Ts'o <tytso@mit.edu> e2fsck, libext2fs: support for bigalloc file systems with a blocksize of 1024

Filesystems with a blocksize of 1024 have the superblock starting at
block #1. However, the first data block in the superblock is 0 to
simplify the cluster calculations. So we must compensate for this in
a number of places, mostly in the ext2fs library, but also in e2fsck.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
lloc_tables.c
losefs.c
penfs.c
es_gdt.c
1ca87790b914a1958f3cbd8b5e1e7037f2cf30ed 20-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix makefile dependency problem

lib/ext2fs/Makefile.in had a buggy entry for blkmap64_ba.c in $(SRCS),
which caused this source file to not have a valid Makefile dependency
entry, so blkmap64_ba.o would not get rebuilt when it needed to be.

Also updated the Makefile dependency for the misc directory while
we're at it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
b2e6c86d61fccc39956c0cb8a8333f42d1569e8d 16-Jun-2011 Theodore Ts'o <tytso@mit.edu> mke2fs, e2fsck: fix i_blocks handling for bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xpanddir.c
_block.c
kjournal.c
fe75afbf33389f71f8588af388d0c01db0cbf753 16-Jun-2011 Theodore Ts'o <tytso@mit.edu> Fix superblock field s_blocks_count for bigalloc file systems

Treat the s_blocks_count field in the superblock as a free block count
(instead of the number of free clusters) for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
96367ad3bc849220651b20f41340b48e07e82b04 16-Jun-2011 Andreas Dilger <adilger@whamcloud.com> misc: quiet "unused variable" compiler warnings

Some of the newly-merged patches added "unused variable" compiler
warnings. Delete unused variables.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lloc.c
5f2e1a81d24ca2334547edd52690378d6eb763c7 16-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systems

Commit b0ecb787ef introduced a bug in check_block_uninit(), which is
used by ext2fs_new_block2(). This bug resulted in the block bitmap
for the block group in question not having space reserved for the file
system metadata blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
8f36e6925f817ed5086550c97796e09905fbb234 11-Jun-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
388b66f727e39474a2160aa0d35402f4821aa8ae 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: fix error handling in ext2fs_add_dir_block

In ext2fs_add_dir_block() the dblist allocation size was changed to
grow as the number of items in the dblist increases. However, the
error handling in case of allocation failure wasn't changed to match.

Fix the error case to revert to the old allocation size on failure.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
blist.c
6c54689fadc3fe0b0bcae2cc93946cb7a28b9f15 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> mke2fs: skip zeroing journal blocks

Add the ability to skip zeroing journal blocks on disk. This can
significantly speed up mke2fs with large journals. At worst the
uninitialized journal is only a very short-term risk (if at all),
because the journal will be overwritten on any new filesystem as
soon as any significant amount of data is written to disk, and
the new journal TID would need to match the offset/TID of an old
commit block still left on disk.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
kjournal.c
931b58e1cb2158c1f5218059cce92e94917ef485 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: Handle internal journal over 2^32 bytes

The write_journal_inode() code is only setting the low 32-bit i_size
for the journal size, even though it is possible to specify a journal
up to 10M blocks in size. Trying to create a journal larger than 2GB
will succeed, but an immediate e2fsck would fail. Store i_size_high
for the journal inode when creating it, and load it upon access.

Use s_jnl_blocks[15] to store the journal i_size_high backup. This
field is currently unused, as EXT2_N_BLOCKS is 15, so it is using
s_jnl_blocks[0..14], and i_size is in s_jnl_blocks[16].

Rename the "size" argument "num_blocks" for the journal creation functions
to clarify this parameter is in units of filesystem blocks and not bytes.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
kjournal.c
wapfs.c
534a4c3db58064caee4fc3e9e294251240d9d28a 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: don't use O_DIRECT if not available

O_DIRECT is not defined on OSX. Since direct IO is only a new
optimization and not needed for correct functionality, disable
it if O_DIRECT is unavailable.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nix_io.c
a1a769987b0604d8836541cefe89661ec8db02c7 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> misc: fix compile warnings on OSX

The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not
really have anything to do with __GNUC__ (which is also used on
OS/X and Solaris). Only print these warnings on Linux systems.

statfs64() is deprecated on OSX and generates a deliberate warning.
Fix some other warnings that show up on OSX builds.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lushb.c
etsize.c
65d05cec3d4ae02dec1b15dfec21e571cb83c9cf 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: fix ext2fs_warn_bitmap32() return warning

This was reported as "control reaches end of non-void function",
but comparing to other similar functions it should be a void
function. Since it is only declared in the "private" ext2fsP.h
header, it should be OK to change the function prototype.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fsP.h
en_bitmap64.c
1ac2aa23ef030863f51fc77b42715e173967c44d 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> ext2fs: fix undeclared posix_memalign() warning

Older distros do not define posix_memalign() by default in the
headers. If ext2fs.h is included early in the headers, it is
possible to "#define _XOPEN_SOURCE 600" so that the stdlib.h
header will define it, but if ext2fs.h is included after stdlib.h
there is no posix_memalign() declaration.

Add a posix_memalign() declaration if stdlib.h didn't do it. This
is a bit of a hack for GNU headers, but it works on Linux and OS/X
without problems.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
cf5301d7f2c3bbed3d26600335102414cbf0c4ba 11-Jun-2011 Andreas Dilger <adilger@whamcloud.com> misc: clean up compiler warnings

Fix several types of compiler warnings (unused variables/labels),
uninitialized variables, etc that are hit with gcc -Wall.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
ileio.c
penfs.c
rogress.c
es_gdt.c
nix_io.c
44fe08f1fa1e9a994ff304aa02022c53c9341519 11-Jun-2011 Theodore Ts'o <tytso@mit.edu> e2fsck: add basic bigalloc support to check (but not yet repair) file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
heck_desc.c
xt2fs.h
c6ed60cdeb1355a884f635ac8118c8f330e2ba68 11-Jun-2011 Theodore Ts'o <tytso@mit.edu> mke2fs: support creating bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
4a2a9b70c89891a146bcb9cee3f29572ca2e1370 11-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: allocate clusters to files in expand_dir.c and mkjournal.c

Teach ext2fs_expand_dir() and ext2fs_add_journal_inode() about
allocating blocks when clustered allocation is enabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xpanddir.c
kjournal.c
b0ecb787ef9fde414791b644fa074450b28d4060 11-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: teach block allocation functions about bigalloc/clusters

Optimize ext2fs_new_block2() and ext2fs_get_free_blocks2() when
bigalloc is enabled. Also fix the uninitialized block bitmap code so
that it correctly deals clustered allocation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
94968e749b224f01fbb9009ed0285e55f6441784 10-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: teach bitmap functions about bigalloc/cluster

This patch makes the following changes:

* ext2fs_allocate_block_bitmap() now allocates a bitmap with cluster
granularity for bigalloc file systems. For mke2fs and e2fsck, a
newly added function, ext2fs_allocate_subcluster_bitmap() allocates
a bitmap with block granularity (even for bigalloc file systems).
The newly added function ext2fs_get_bitmap_granularity() will return
the number of bits (log2) of the granularity used by the bitmap.

* The ext2fs_{mark,unmark,test}_block_bitmap2() functions will shift
their passed-in argument by log2(cluster_ganularity) bits right.
This means that the arguments for the single-argument bitmap
functions will be interpreted with block granluarity, since this
minimizes code changes in the rest of the code base.

* The ext2fs_{get,set}_block_bitmap_range() functions will interpret
their arguments in cluster granularity. This is a bit inconsistent,
but the caller of those functions will need to be taught about the
subtleties of clusters for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itmaps.c
map64.h
xt2fs.h
en_bitmap64.c
1afb468b9a80031b39eab37272709f45727fb221 10-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: create extent-based directories if the extents feature is enabled

This allows mke2fs to create the root and lost+found directories using
extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kdir.c
6a6337c3df7c982eb888764d585ec483a51af16e 05-Jun-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
lib/ext2fs/bitmaps.c
lib/ext2fs/rw_bitmaps.c
misc/dumpe2fs.c
b92fbed77875b447f930fdcb5ae660c16b2ec0db 05-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: Teach block bitmap read, write, and allocation funcs about clusters

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itmaps.c
w_bitmaps.c
1da5ef707904cf99300a0fb36b9ae3b29dbc8bde 04-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: change fs->clustersize to fs->cluster_ratio_bits

The log2 of the ratio of cluster size to block size is far more useful
than just storing the cluster size. So make this change, and then
define basic utility macros: EXT2FS_CLUSTER_RATIO(),
EXT2FS_CLUSTER_MASK(), EXT2FS_B2C(), EXT2FS_C2B(), and
EXT2FS_NUM_B2C().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
nitialize.c
penfs.c
ae9e37cd114385764864518057ff854b3f335440 04-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: change EXT2_MAX_BLOCKS_PER_GROUP() to be cluster size aware

Change the EXT2_MAX_BLOCKS_PER_GROUP so that it takes the cluster size
into account. This way we can open bigalloc file systems without
ext2fs_open() thinking that they are corrupt.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
6220b6715f4900bbcfa04ef3b81ccf48b2d21825 04-Jun-2011 Theodore Ts'o <tytso@mit.edu> libext2fs: require cluster size == block_size when opening a !bigalloc fs

In ext2fs_open() check to make sure the cluster size superblock field
is the same as the block size field when the bigalloc feature is not
set. This is necessary since we will start introducing calculations
based on the cluster size field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
bf0449b1a6547a566975cb32c18a2ba5972deace 18-May-2011 Lukas Czerner <lczerner@redhat.com> e2image: Add support for qcow2 format

This commit adds support for exporting filesystem into QCOW2 image
format. Like sparse format this saves space, by writing only necessary
(metadata blocks) into image. Unlike sparse image, QCOW2 image is NOT
sparse, hence does not change its size by copying with not-sparse-aware
tools.

New options '-Q' has been added to tell the e2image to use QCOW2 as an
output image format. QCOW2 supports encryption and compression, however
e2image so far does no support such features, however you can still
scramble filenames with '-s' option.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
akefile.in
itops.h
2image.h
cow2.c
cow2.h
ffec46fea48f1f05fbe2fb863b44fd2dd718c50f 18-May-2011 Lukas Czerner <lczerner@redhat.com> e2fsprogs: Add memory allocation and zero-out helpers

Add functions ext2fs_get_memzero() which will malloc() the memory
using ext2fs_get_mem(), but it will zero the allocated memory afterwards
with memset().

Add function ext2fs_get_arrayzero() which will use calloc() for
allocating and zero-out the array.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
598d20cc3c0f71561402e13c07aaf5880b85fa37 09-May-2011 Tao Ma <boyu.mt@taobao.com> mke2fs: make s_inodes_per_group >= 8 in ext2fs_initialize

current mkfs.ext4 fails if we tried with the following parameters:

mkfs.ext4 -m 0 -N 16 -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg -b 1024 /dev/sdb3

It will cause segfault, but it is caused by another issue. See my
patch "mke2fs: Avoid segmentation fault in
ext2fs_alloc_generic_bmap". And with that patch, the mkfs.ext4 will
fail with the error: /dev/sdb3: Memory allocation failed while setting
up superblock

The reason is that in ext2fs_initialize, we align s_inodes_per_group
to 8, but fails to consider the case that s_inodes_per_group < 8.
So make at least 8 inodes for s_inodes_per_group.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nitialize.c
5fff975431e02c2b746b023d3c5e6755e910eaa9 21-Mar-2011 Lukas Czerner <lczerner@redhat.com> e2fsprogs: fix memory leak in ext2fs_free_generic_bmap()

In ext2fs_free_generic_bmap() when we are freeing 64-bit bitmap, we do
call free_bmap() to free backend specific bitmap structures, however we
should also free ext2fs_generic_bitmap structure as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
ba7cb5d9d7a9415ccb611e781a3832be7259622f 21-Mar-2011 Lukas Czerner <lczerner@redhat.com> e2fsprogs: fix freeing bitmap in allocation error path

In ext2fs_alloc_generic_bmap() error path, when new bitmap allocation
fails ext2fs_generic_bitmap should be freed, however in current state it
first frees ext2fs_generic_bitmap and then
ext2fs_generic_bitmap->description which is wrong. This commit fix the
free ordering.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
5af9eeaa7d36dd6f3a434697747ba8db3434eced 18-Mar-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
lib/e2p/ls.c
4df1618250349dbe71f9474c42d52d7d03cc68a0 18-Mar-2011 Theodore Ts'o <tytso@mit.edu> add new superblock field: s_overhead_blocks

It turns out that it's very hard to calculate overheads in the face of
clustered allocation (bigalloc). This is because multiple metadata
blocks from different block groups can end up in the same allocation
cluster. Calculating the exact overhead requires O(all block bitmaps)
in memory, or O(number of block groups**2) in time. So we will
calculate this at mkfs time and stash it in the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
st_super_size.c
aa07cb79b0a38d9d8407c5631624ef8534bdde3f 28-Feb-2011 Theodore Ts'o <tytso@mit.edu> mke2fs: If the device supports discard, don't print an error message

Check to see if the device supports discard before starting the
progress bar, and then printing an error about inappropriate ioctl for
device (when creating a file system image to a file, for example).

Also, add a function signature in the ext2_io.h header file for
io_channel_discard() and fix an extra, uneeded argument in mke2fs's
call to that function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_io.h
829d9994880394e48c883510799b1536812d6efb 28-Feb-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
lib/ext2fs/initialize.c
412376efff3c0e0c2fea00666c2457e6f2ae1878 26-Feb-2011 Theodore Ts'o <tytso@mit.edu> Add basic BIGALLOC support for cluster-based allocation

This adds the superblock fields needed so that dumpe2fs works and the
code points and renames the superblock fields from describing
fragments to clusters.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
xt2fs.h
nitialize.c
penfs.c
wapfs.c
st_super_size.c
0edcc2702106ef8ea0d4ab60ef06c0c38b0b87ee 15-Feb-2011 Aditya Kali <adityakali@google.com> e2fsprogs: reserving code points for new ext4 quota feature

This patch adds support for detecting the new 'quota' feature in ext4.
The patch reserves code points for usr and group quota inodes and also
for the feature flag EXT4_FEATURE_RO_COMPAT_QUOTA.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_fs.h
wapfs.c
st_super_size.c
214580a339a18b0539b5998d3b47934956a30a1c 21-Feb-2011 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
misc/mke2fs.conf.5.in
6a426c97ec2de0968b4cde62e5eab3df605bde33 17-Feb-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: enable user namespace xattrs by default

User namespace xattrs are generally useful, and I think extN
is the only filesystem requiring a special mount option to
enable them, when xattrs are otherwise available. So this
change sets that mount option into the defaults, via a
mke2fs.conf option.

Note that if xattrs are config'd off, this will lead to a
mostly-harmless:

EXT4-fs (sdc1): (no)user_xattr options not supported

message at mount time...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nitialize.c
3daf592646b668133079e2200c1e776085f2ffaf 17-Feb-2011 Eric Sandeen <sandeen@redhat.com> e2fsprogs: turn off enforced fsck intervals by default

The forced fsck often comes at unexpected and inopportune moments,
and even enterprise customers are often caught by surprise when
this happens. Because a filesystem with an error condition will
be marked as requiring fsck anyway, I submit that the time-based
and mount-based checks are not particularly useful, and that
administrators can schedule fscks on their own time, or tune2fs
the enforced intervals if they so choose. This patch disables the
intervals by default, and I've added a new mkfs.conf option to
turn on the old behavior of random, unexpected, time-consuming
fscks at boot time. ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nitialize.c
da2a5a4baede2a227d2da587eb74ceae66778fbc 23-Dec-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
resize/resize2fs.c
a4fdf09414e04e9ecb995aa0af2f525d335987ae 22-Dec-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Don't use the extended rec_len encoding for standard file systems

If the file system has a blocksize less than 64k, then don't use the
extended rec_len encoding, to be consistent with what the kernel will
do.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ir_iterate.c
91dc3f0db0185503083f54c7b464900c851df0aa 29-Nov-2010 Namhyung Kim <namhyung@gmail.com> libext2fs: fix possible memory leak in write_journal_inode()

ext2fs_zero_block2() allocates static buffer if needed so it
should be freed at last (call it again with 0 args).

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
kjournal.c
58caabc37d696363330c390f77a901bbc81cda1e 22-Dec-2010 Theodore Ts'o <tytso@mit.edu> ext2fs: fix memory leak in an error case in inode_open()

Reported-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node_io.c
2150278fa25f3fe8b8f29835ccd3079b608bb825 20-Dec-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: fix potential free() of garbage in ext2fs_update_bb_inode()

There was a potential of freeing an uninitialized pointer in
rec.block_buf, which was pointed out by Namhyung Kim <namhyung@gmail.com>

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
b_inode.c
f57e64a851b417f7a8cf0ab2531ad9028ca75474 29-Nov-2010 Namhyung Kim <namhyung@gmail.com> libext2fs: fix dubious code in ext2fs_unmark_generic_bitmap()

Looks like a copy & paste problem to me.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap.c
877d1dc0ab643086bf2eafcde7d0ce2478c036ee 29-Nov-2010 Namhyung Kim <namhyung@gmail.com> libext2fs: remove unnecessary casts to ext2fs_generic_bitmap

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap64.c
3ece37ea0a4d01499568dbbacc115dfeeb8ccbbb 20-Dec-2010 Namhyung Kim <namhyung@gmail.com> libext2fs: fix dubious code in ext2fs_numeric_progress_init()

Looks like a copy & paste problem to me.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
rogress.c
beb4295ca417821977688465d014143fb5955968 20-Dec-2010 Namhyung Kim <namhyung@gmail.com> libext2fs: fix potential build failure with OMIT_COM_ERR

This fixes following build failure when OMIT_COM_ERR is defined:

lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_clear_generic_bitmap’:
lib/ext2fs/gen_bitmap.c:437: error: invalid storage class for function ‘ext2fs_test_clear_generic_bitmap_range’
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_get_generic_bitmap_end’:
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_get_generic_bitmap_start’:
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_unmark_generic_bitmap’:
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_mark_generic_bitmap’:
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
lib/ext2fs/gen_bitmap.c: In function ‘ext2fs_test_generic_bitmap’:
lib/ext2fs/gen_bitmap.c:559: error: expected declaration or statement at end of input
make[2]: *** [gen_bitmap.o] Error 1
make[2]: Leaving directory e2fsprogs/lib/ext2fs'
make[1]: *** [all-libs-recursive] Error 1
make[1]: Leaving directory e2fsprogs'
make: *** [all] Error 2

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
en_bitmap.c
562f264243f4d4385910b6f06872730214977736 20-Dec-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
lib/ext2fs/block.c
lib/ext2fs/csum.c
resize/main.c
9098c986b64bb65a2b7fcd2724a400ba1f451f6b 17-Dec-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix compile bug on big-endian architectures

Addresses-Sourceforge-Bug: #3138115

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
wapfs.c
94ded6c16bdcc77b43caaa151bd7afa55c5d3cf1 17-Dec-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: fix ref_offset callback with sparse files in ext2fs_block_iterate2()

Addresses-Sourceforge-Bug: 3081087

Reported-by: vmo@users.sourceforge.net
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
c816ecb204a32e67788738e050ff2b14a721672b 14-Dec-2010 Eric Sandeen <sandeen@redhat.com> e2fsprogs: fix type-punning warnings

Flags used during RHEL/Fedora builds lead to a couple type-punning
warnings:

recovery.c: In function 'do_one_pass':
recovery.c:539: warning: dereferencing type-punned pointer will break strict-aliasing rules
./csum.c: In function 'print_csum':
./csum.c:170: warning: dereferencing type-punned pointer will break strict-aliasing rules

The two changes below fix this up.

Note that the csum test binary output changes slightly, but this does
not break any tests.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
akefile.in
sum.c
efa1a355a1e4142b2d057be06931eb8fc0903ba3 18-Nov-2010 Lukas Czerner <lczerner@redhat.com> e2fsck: Discard free data and inode blocks.

In Pass 5 when we are checking block and inode bitmaps we have great
opportunity to discard free space and unused inodes on the device,
because bitmaps has just been verified as valid. This commit takes
advantage of this opportunity and discards both, all free space and
unused inodes.

I have added new set of options, 'nodiscard' and 'discard'. When the
underlying devices does not support discard, or discard ends with an
error, or when any kind of error occurs on the filesystem, no further
discard attempt will be made and the e2fsck will behave as it would
with nodiscard option provided.

As an addition, when there is any not-yet-zeroed inode table and
discard zeroes data, then inode table is marked as zeroed.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
est_io.c
d866599ab4955858b1541f0891b1b165ba66493a 18-Nov-2010 Lukas Czerner <lczerner@redhat.com> e2fsprogs: Add CHANNEL_FLAGS_DISCARD_ZEROES flag for io_manager

When the device have discard support and simultaneously discard zeroes
data (and it is properly advertised), then we can take advantage of such
behavior in several e2fsprogs tools.

Add new flag CHANNEL_FLAGS_DISCARD_ZEROES for struct_io_channel so
each io_manager can take advantage of this. The flag is properly set
according to BLKDISCARDZEROES ioctl in unix_open.

Also remove old mke2fs_discard_zeroes_data() function and substitute it
with helper which test this flag.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_io.h
nix_io.c
e90a59ed434d6c5e38dd148aa4ba5b22b8f7eb24 18-Nov-2010 Lukas Czerner <lczerner@redhat.com> e2fsprogs: Add discard function into struct_io_manager

In order to provide generic "discard" function for all e2fsprogs tools
add a discard function prototype into struct_io_manager. Specific
function for specific io managers can be crated that way.

This commit also creates unix_discard function which uses BLKDISCARD
ioctl to discard data blocks on the block device and bind it into
unit_io_manager structure to be available for all e2fsprogs tools.
Note that BLKDISCARD is still Linux specific ioctl, however other
unix systems may provide similar functionality. So far the
unix_discard() remains linux specific hence is embedded in #ifdef
__linux__ macro.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_io.h
o_manager.c
est_io.c
nix_io.c
4fca2b9c07981abca16d337b2e57f78569cbbe05 22-Nov-2010 Justin Maggard <jmaggard10@gmail.com> 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>
lknum.c
9d92a201deec7bbb1911e6e5ee98abf3c83882d4 25-Sep-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
configure
configure.in
lib/ext2fs/ext2fs.h
misc/mke2fs.c
73fbe2323af6a2b4d807c80069657bf1449b3bff 25-Sep-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Change EXT2_FLAG_DIRECT_IO to avoid conflict with devel branch

The development branch of e2fsprogs already has a code point assigned
in conflict with EXT2_FLAG_DIRECT_IO. Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
00f0b1411838db56e1e04816e4d369be332fd2b6 24-Sep-2010 Theodore Ts'o <tytso@mit.edu> ext2fs: Optimize for Direct I/O

Allocate various memory structures to be properly aligned to avoid
needing to use a bounce buffer when doing direct I/O read/writes.
This should also help on FreeBSD systems which require aligned buffers
unconditionally.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
penfs.c
w_bitmaps.c
7f1a1fbf850f6b73b5c9c82365f01029fb250a1c 24-Sep-2010 Theodore Ts'o <tytso@mit.edu> ext2fs: Add Direct I/O support to the ext2fs library

This adds the basic support for Direct I/O to unix_io.c, and adds a
new flag EXT_FLAG_DIRECT_IO which can be passed to ext2fs_open() or
ext2fs_open2() to request Direct I/O support.

Note that device mapper devices in Linux don't support Direct I/O, and
in some circumstances using Direct I/O can actually make performance
*worse*!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2_io.h
xt2fs.h
penfs.c
nix_io.c
faafdb765b4ed2bb33070d998426bec0cf774344 23-Sep-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix memory leak in the Unix I/O layer when changing block size

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nix_io.c
023a1df091f9d42f826ee3737190db5de9c823b0 23-Sep-2010 Theodore Ts'o <tytso@mit.edu> ext2fs: add ext2fs_get_memalign() function

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
9345f02671fd39cad69338080b62e12e8b86671d 19-Sep-2010 Theodore Ts'o <tytso@mit.edu> tune2fs, debugfs, libext2fs: Add support for ext4 default mount options

Add support for 2.6.35's new default mount options which can be
specified in the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
st_super_size.c
ccc7cf032852dd5c84b227bafb481b1d158e2b5e 31-Jul-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: fix obvious big-endian bugs introduced by 64-bit changes

These patches fix obvious bone-headed mistakes, so e2fsprogs will now
build and mostly work on powerpc. The m_meta_bg, u_mke2fs, and
u_tune2fs tests are still failing, however, so there's still work to do...

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
wapfs.c
27a0e958e619c3ca105e575670416a964fa2678f 22-Jul-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Add ext2fs_file_size_size2() and truncate the file if necessary

This adds a 64-bit interface for ext2fs_file_size_size() and enhances
it to trunate the file if necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
ileio.c
6dc058bd126ba2f631e38233d899f58a04e0c74f 10-Jul-2010 Renzo Davoli <renzo@cs.unibo.it> libext2fs: Add new function ext2fs_file_get_inode()

This patch adds a very simple function:

struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);

which is useful for fuse-ext2 when it needs to read the inode of an
open file.

Signed-off-by: renzo davoli <renzo@cs.unibo.it>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
ileio.c
3adb9374fb92736e393ad64f751073b19927ec0e 22-Jul-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Add new function ext2fs_punch()

This function deallocates a range of blocks from a passed-in file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2fs.h
unch.c
f03bb73ceb55791f7a59dbb72cfdbe121c5d204e 22-Jul-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Don't make a copy of the inode in ext2fs_extent_open2()

Previously, ext2fs_extent_open2() copied the passed-in inode structure
into the extent handle, and the extent functions modified the copy of
the inode structure if necessary due to extent splits, etc. Change
ext2fs_extent_open2() so that the extent functions use the inode
structure passed into ext2fs_extent_open2(). Otherwise the passed-in
inode structure could become out of date due to changes made by the
extent functions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
47e155df575be3664493903507ac40d56c9b4e7d 21-Jul-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix ext2fs_iblk_{add,sub}_blocks() when the i_blocks_hi is non-zero

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
_block.c
92e2d79cfbe67244eff8ded095491cba16e98dcc 20-Jul-2010 Theodore Ts'o <tytso@mit.edu> tst_extents: Fix 64-bit bugs in do_goto_block()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
db0bdb49f49fc3dd14c12439d934a3403a3be9f1 19-Jul-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
resize/extent.c
c5726f1ad7efedcdb24b3b362c84f0d0b402b337 05-Jul-2010 Theodore Ts'o <tytso@mit.edu> Enhance tst_super_size so that it checks the superblock fields as well

The test now checks to make sure the superblock fields are correctly
aligned and prints them out so they can be manually checked to make
sure they are where we expect them to be.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
st_super_size.c
993988f65527e5665181b3e4a6161f317e396489 25-Jun-2010 Theodore Ts'o <tytso@mit.edu> Add superblock fields which track first and most recent fs errors

Add superblock fields which track where and when the first and most
recent file system errors occured. These fields are displayed by
dumpe2fs and cleared by e2fsck.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
8c084167ee5ea4ae28359b0d67d583eb1068465c 25-Jun-2010 Theodore Ts'o <tytso@mit.edu> Fix Makefile dependencies for test programs in lib/ext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
f5448c19acda0bae0673d17e97b8a0590c99c944 25-Jun-2010 Theodore Ts'o <tytso@mit.edu> Add support for Next3 snapshot superblock fields to dumpe2fs and debugfs

We also support for byte-swapping the Next3 fields, although the
current Next3 implementation doesn't support big-endian systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
wapfs.c
efe0b401465a3ee836180614b5b435acbb84fc27 14-Jun-2010 Eric Sandeen <sandeen@redhat.com> 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>
lknum.c
xt2fs.h
02d6f47e9647d3155a38c8676c2da6ea773d9b68 13-Jun-2010 Jose R. Santos <jrs@us.ibm.com> mke2fs: Fix up mke2fs to be able to make 64-bit file systems

Use 64-bit interfaces in mke2fs. This should be most most of whats
needed to support creating a 64-bit filesystem.

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>
xt2fs.h
6d8b37fa7661484ca50a4951cffbf531ab1bccbb 13-Jun-2010 Valerie Aurora Henson <vaurora@redhat.com> libext2fs: More random 64-bit fixes, lots of block_iterate3

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
move.c
heck_desc.c
xpanddir.c
xt2fs.h
xtent.c
mager.c
kdir.c
kjournal.c
amei.c
penfs.c
ead_bb.c
ead_bb_file.c
es_gdt.c
ab13b5a9795a8c20f1d6da8fe1da340f545ec0e0 13-Jun-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Create 64-bit dblist functions

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
blist.c
blist_dir.c
ir_iterate.c
xt2fs.h
xt2fsP.h
da3fc25bce5880c5d036d97727299ab09b415219 13-Jun-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Teach *_initialize and *_allocate_group to be 64-bit safe

This is needed to enable 64-bit mke2fs to work correctly.

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>
lloc_tables.c
nitialize.c
97d26ce9e3589e9f5fa17014467a9730a884d158 07-Jun-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
e2fsck/journal.c
e2fsck/pass1.c
e2fsck/pass2.c
misc/mke2fs.c
6d0ed6780285e79360353d4b06b339c00712d754 02-Jun-2010 Theodore Ts'o <tytso@mit.edu> Reserve feature flags and fields needed for the Next3 snapshot feature

The documentation is not (as of this writing) fully complete, but
there is some documentation here:

http://sourceforge.net/apps/mediawiki/next3/index.php?title=Code_documentation
http://sourceforge.net/apps/mediawiki/next3/index.php?title=On-disk_format
http://sourceforge.net/projects/next3/files/Next3_Snapshots.pdf/download

... which will hopefully be updated soon to be fully up to date with
these assignments and more details about how things work.

For now, the assignments should avoid collisions with other new work
that people might want to do on ext3/4.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
30a7610edfc0c22cb6b5ad9f76f65700fb6ffe98 02-Jun-2010 Andreas Dilger <adilger@sun.com> Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flag

Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flag for adding
extra file data in ext2_dir_entry_2 entries.

This changes the on-disk layout in the following way.

Firstly, the ext2_dir_entry_2 file_type field now has a mask: that
limits the "filetype" information to the low 4 bits of this field.
Since these values are sequentially assigned, this allows for up to 7
more filetypes to be assigned. When reading the "filetype" field, the
high 4 bits should be masked off when converting to DT_* filetypes for
userspace.

The high 4 bits of "filetype" are used as a bitmask to register up to
4 different "extended" directory entry fields. Extended data fields
are packed without alignment into the directory entry after the "name"
field in order of increasing bitmask value, for each field where bit
is set. In order to avoid the need to "understand" each of the
extended fields, the first byte of each extended data field holds the
size of that data field (including the size itself), so they can be
skipped if not understood. For fields that change the semantics of
the filesystem it is expected that a separate ROCOMPAT or INCOMPAT
field is registered.

There is a single dirent data type defined currently, for Lustre:
which holds a 128-bit file identifier. It is expected that if there
are 64-bit inode values that this will be assigned the 0x20 value.

Should a need ever arise to use all 4 of the extended dirent data
fields, it would be possible to keep the last bit (0x80) for use as a
multiplexor that stores a 1-byte aggregate data size, then a series of
"<u8_size><u8_type><data>" records in the last extended data record.
It is not expected that this will actually be needed in the lifetime
of ext4.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
cff9690f4e114d95c9031a7468c99fda0ddcb3ec 02-Jun-2010 Andreas Dilger <adilger@sun.com> Reserve the EXT4_INCOMPAT_EA_INODE feature flag

Reserve the EXT4_INCOMPAT_EA_INODE feature flag for use with
large extended attributes that are stored in a separate inode.
This changes the on-disk format in several ways:

First, replace the e_value_block field with e_value_inum, so that
an xattr entry can reference an external inode. This field is
currently unused, as all of the entries live in the same block.

struct ext2_ext_attr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* attribute name index */
__le16 e_value_offs; /* offset in disk block of value */
> __le32 e_value_inum; /* inode in which the value is stored */
__le32 e_value_size; /* size of attribute value */
__le32 e_hash; /* hash value of name and value */
char e_name[0]; /* attribute name */
}

Second, add a flag to the inode that indicates it is using a large
(external) extended attribute. This is needed so that when unlinking
an inode the xattrs will be scanned to unlink the xattr inodes
referenced by the main inode.

Third, for inodes that have a number of xattrs that are larger than
a single block, but not large enough to justify an external inode
(less than 64kB total xattr size, due to e_value_offs limitation)
the ext2_ext_attr_header->h_blocks field can grow beyond a single
block to represent a contiguous allocation of blocks for the xattr.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
effb3442419e50b6352fb13cfc8eea03bebf442e 01-Jun-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Remove #include of <linux/types.h> from fiemap.h

The system header file can end up causing type conflicts, and
including kernel header files is always dodgy/dangerous (and this case
not needed).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
iemap.h
bb1158b92ed8a12ab9e9317ca6ddd97bc12447d3 18-May-2010 Theodore Ts'o <tytso@mit.edu> mke2fs: account for physical as well as logical sector size

Some devices, notably 4k sector drives, may have a 512 logical
sector size, mapped onto a 4k physical sector size.

When mke2fs is ratcheting down the blocksize for small filesystems,
or when a blocksize is specified on the commandline, we should not
willingly go below the physical sector size of the device.

When a blocksize is specified, we -must- not go below
the logical sector size of the device.

Add a new library function, ext2fs_get_device_phys_sectsize()
to get the physical sector size if possible, and adjust the
logic in mke2fs to enforce the above rules.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
etsectsize.c
st_getsectsize.c
543547a52a20cb7e69d74921b2f691078fd55d83 18-May-2010 Theodore Ts'o <tytso@mit.edu> libe2p, libext2fs: Update file copyright permission states to match COPYING

The top-level COPYING file states that the e2p and ext2fs libraries
are available under the LGPLv2. The files were incorrectly labelled.
Alex Thomas/Luster has been consulted wrt to the ext3_extents.h file;
the rest of the files were primarily authored by Theodore Ts'o.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_compat.c
b_inode.c
itmaps.c
itops.c
itops.h
lock.c
map.c
move.c
rel.h
rel_ma.c
heck_desc.c
losefs.c
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
osio.c
osio.h
upfs.c
2image.h
xpanddir.c
xt2_io.h
xt2fs.h
xt2fsP.h
xt3_extents.h
xt_attr.c
xtent.c
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
et_pathname.c
etsectsize.c
etsize.c
_block.c
count.c
mager.c
nd_block.c
nitialize.c
nline.c
node.c
node_io.c
rel.h
rel_ma.c
smounted.c
ink.c
lseek.c
ookup.c
kdir.c
kjournal.c
amei.c
ative.c
ewdir.c
t_io.c
penfs.c
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
parse.c
wapfs.c
est_io.c
st_badblocks.c
st_bitops.c
st_byteswap.c
st_getsectsize.c
st_getsize.c
st_iscan.c
st_super_size.c
st_types.c
ndo_io.c
nix_io.c
nlink.c
alid_blk.c
ersion.c
rite_bb_file.c
4d452afe4757fdac1bd92fd6fcc09091eff181bd 18-May-2010 Theodore Ts'o <tytso@mit.edu> Always build namei.o so that building with "configure --disable-debugfs" works

namei.o is also needed by e2initrd_helper.

Long term, if we care about reduced e2fsprogs builds, we need a more
general solution for deciding what .o files are needed for a
particular build. Given that install floppies are going (gone?) the
way the dodo bird, we probably don't care, though.

Addresses-Sourceforge-Bug: #2911433

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
c5b23f6c0e17503630455fb16d1b2035f844acc9 15-Mar-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
8e2399d57ac2bec1830e27deeeac66002d81001c 11-Mar-2010 Theodore Ts'o <tytso@mit.edu> ext2fs: Optimize extending an extent-mapped file using ext2fs_block_iterate2()

When ext2fs_block_iterate2() is called on an extent-mapped file with a
depth > 1, it will erroneously calling the callback function starting
all over again with an offset of logical block 0. It shouldn't do
this, and it cases mke2fs to become very slow when creating files with
very large journals.

Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
4ffafee26cf791c0c651c08d3dcefcdd363bf127 24-Feb-2010 Eric Sandeen <sandeen@redhat.com> e2fsck: don't complain about i_size for known blocks past EOF

This is the userspace side of Jiaying's EOFBLOCKS patch. With
Aneesh's patches for .33, Jiaying's patch, and this one, xfstests
013/fsstress (even with direct IO enabled) has held up through many
runs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
1d18a55c528adf997d8edee60bd8003c822c55e8 15-Feb-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix byte swapping bugs

The 64-bit patches broke compiles on big endian systems. In addition
the block group checksum test was failing, due to bugs in both the
test case and the checksum code itself. This commit addresses these
problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
sum.c
2d07b3ad98bfe1db5fb1071f53a5338ab6c35522 31-Jan-2010 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
configure
lib/ext2fs/alloc_tables.c
misc/mke2fs.c
c21cde9986e69756254b65b7a48974222f358a2e 31-Jan-2010 Theodore Ts'o <tytso@mit.edu> libext2fs: Add some fail-safe checks to the 32-bit bitmap code

If a 64-bit bitmap is passed to a 32-bit bitmap function, add some
checks to make sure that we print a useful error message so we can
better catch potential problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fsP.h
en_bitmap.c
en_bitmap64.c
bbb60e4fefdd404d8d696369804b556b404bb0c1 30-Nov-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Improve flex_bg inode table placement algorithm

When trying to find the best place for the inode table in the last
flex block group, use the true size for the flex_bg's portion of the
inode table instead of the worst case required size of the inode table
fragment if the file system is resized. This fixes a corner case
where if the size of the filesystem is just big enough that there is
only room for a single block group in the last flex_bg, and that
partial block group is too small for the full portion of the inode
table, the inode table is placed in the very first block group:

Group 64: (Blocks 2097152-2099199) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xd305, unused inodes 8080
Block bitmap at 2097152 (+0), Inode bitmap at 2097168 (+16)
Inode table at 8626-9130 (+4292878770)
^^^^^^^^^

Thanks to Vyacheslav Dubeyko for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
9c9e1d5fe507d08309e9815eee50ca73e21bd2bd 29-Nov-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix SET_BMAP bugs in ext2fs_bmap() and ext2fs_bmap2()

Don't byte-swap the block number when setting i_block[x], since the
write_inode function will take of byte swapping the inode.

The phys_blk parameter contains an input parameter in the SET_BMAP
case, so it must be passed to ext2fs_bmap2() from the legacy function
ext2fs_bmap().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
4486af5b4c1b117ac88a92cd2336cb41c15107d3 16-Nov-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
misc/mke2fs.c
5f91561ae7e08d79b6a5feca167259fd7634713f 13-Oct-2009 Karel Zak <kzak@redhat.com> libext2fs: handle <=linux-2.6.19 bug in /proc/swaps

Linux <= 2.6.19 contained a bug in the /proc/swaps code where the
header would not be displayed (the first line).

This issue has been reported by Mike Frysinger for swapon(8).

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
smounted.c
6eb229dc5d212ac5897ff626b839318f4e0c57ca 10-Nov-2009 Eric Sandeen <sandeen@redhat.com> libext2fs: don't swap extent-based journal backup

The f_illitable_flexbg test was failing on ppc, because
e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
s_jnl_blocks, and failing.

This is because we don't swap extent data on read from disk; rather
we do it when we access the extents. However, ext2fs_swap_super
was swapping s_jnl_blocks unconditionally, so these didn't match.

Looks like we need to treat s_jnl_blocks the same as i_block, and
swap it on access, not on read. Except for the last i_size bit...

Reviewed-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
wapfs.c
054e5a9ccf8d65e015f2af85bfddd3fda3a0472f 26-Oct-2009 Valerie Aurora Henson <vaurora@redhat.com> Add 64bit option to known incompatible file system options

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ernel-jbd.h
b49f78fe6e19fe63b6f989d5e1afb04f59069197 26-Oct-2009 Theodore Ts'o <tytso@mit.edu> Convert ext2fs_group_{first,last}_block() to *block2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
heck_desc.c
6493f8e85defc568a4ca8cdb4a53361f36fb94ba 26-Oct-2009 Theodore Ts'o <tytso@mit.edu> Convert ext2fs_group_of_blk() to ext2fs_group_of_blk2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
kjournal.c
48f23054bb8ad0506c0baa9f06ba182acc2aa88b 26-Oct-2009 Valerie Aurora Henson <vaurora@redhat.com> Convert ext2fs_block_alloc_stats() calls to block_alloc_stats2()

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
b_inode.c
xpanddir.c
xtent.c
kdir.c
kjournal.c
cf828f1a72ec1eb0c1e819307137879447c909b7 26-Oct-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Byte-swap 64-bit block group descriptors

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
sum.c
xt2fs.h
penfs.c
wapfs.c
d7cca6b06f366f998ed43346f9b6fca9e163692f 26-Oct-2009 Valerie Aurora Henson <vaurora@redhat.com> Convert to use block group accessor functions

Convert direct accesses to use the following block group accessor
functions: ext2fs_block_bitmap_loc(), ext2fs_inode_bitmap_loc(),
ext2fs_inode_table_loc(), ext2fs_bg_itable_unused(),
ext2fs_block_bitmap_loc_set(), ext2fs_inode_bitmap_loc_set(),
ext2fs_inode_table_loc_set(), ext2fs_bg_free_inodes_count(),
ext2fs_ext2fs_bg_used_dirs_count(), ext2fs_bg_free_inodes_count_set(),
ext2fs_bg_free_blocks_count_set(), ext2fs_bg_used_dirs_count_set()

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>
lloc.c
lloc_stats.c
lloc_tables.c
heck_desc.c
losefs.c
sum.c
blist.c
mager.c
nitialize.c
node.c
kjournal.c
penfs.c
w_bitmaps.c
st_iscan.c
cd65a24e756b8f6770a5961fd94c67eb00dd7baa 26-Oct-2009 Theodore Ts'o <tytso@mit.edu> 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>
lloc.c
lknum.c
xt2fs.h
node.c
w_bitmaps.c
e633b58ac75f2f544b7d6572e37d4b63da31e59c 26-Oct-2009 Eric Sandeen <sandeen@redhat.com> 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>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
lknum.c
sum.c
xt2fs.h
nitialize.c
penfs.c
72a729dbf962e8fba58a06ee0a11a01b15e743fc 24-Oct-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
configure
configure.in
5d10807070ae13a89c2a0cc217e30af6f061d60e 21-Oct-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix FEATURE_RO_COMPAT_HUGE_FILE && !HUGE_FILE_FL

If the RO compat HUGE_FILE feature flag is set, but the inode's
HUGE_FILE_FL flag is not set, we should still pay attention to the
high 32 bits of the i_blocks filed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
_block.c
95bcea9fc149e349865f9eb30988ad1b4e1c1342 05-Oct-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
configure
configure.in
misc/mke2fs.c
f790bc33b20e5c1a9d357c41cb2c1b7ea486f98c 04-Oct-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Always build file_io.c

Commit 1d9b818: dumpe2fs: Print more information about the inline journal
caused dumpe2fs to use ext2fs_file_open2(). Previously the file_io
functions were only used by debugfs, so if debugfs was disabled,
file_io was not built. Now that dumpe2fs is also using file_io, we
need to build it unconditionally.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
04f13d6685b57c29974e4ce2d9074679123bf8a9 09-Sep-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add error table initialization to test programs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
smounted.c
st_badblocks.c
st_getsize.c
4efbac6fed75c29d3d5f1b676b932754653a2ac5 08-Sep-2009 Valerie Aurora Henson <vaurora@redhat.com> Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
b_inode.c
lock.c
move.c
heck_desc.c
losefs.c
sum.c
xt_attr.c
count.c
nitialize.c
kjournal.c
penfs.c
w_bitmaps.c
st_badblocks.c
a63745e81cbb476b90c75ca3ca60b9ba4be95cae 08-Sep-2009 Valerie Aurora Henson <vaurora@redhat.com> Use ext2fs_file_acl_block() instead of using .i_file_acl directly

This provides support for 48-bit file acl blocks.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
alid_blk.c
c5b7b6babe658a2037af6c9d2b7a3c23208f98f1 08-Sep-2009 Valerie Aurora Henson <vaurora@redhat.com> Fix overflow in calculation of total file system blocks

Blocks per group and group desc count are both 32-bit; multiplied they
produce a 32-bit quantity which overflowed.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itmaps.c
w_bitmaps.c
51e64594919c986f87267b895504322a38ec4fac 07-Sep-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Round up the bitmap size when allocating a new bitmap

The x86 BT assembly instructure can overshoot the end of a bit array
when testing a bit at the end of the bit array, even if it never needs
to look at those memory locations. This can cause a spurious
segmentation fault. If we allocate a little extra memory, it avoids
this problem. See:

http://faydoc.tripod.com/cpu/bt.htm

This doesn't happen on Linux, probably because of the glibc's malloc()
function works, but apparently it's a major problem on the *BSD
operating systems.

Addresses-Sourceforge-Bug: #2328708

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
en_bitmap.c
8bafedbf4a6889b20e119a667fc243909d283f85 25-Aug-2009 Theodore Ts'o <tytso@mit.edu> tune2fs: Fix "tune2fs -j <dev>" for extent-enabled filesystems

For filesystms that have the extent feature enabled, we need to grab
the use EXT2_IOC_GETFLAGS so that we don't accidentally end up trying
to request clearing the EXT2_EXTENT_FL, which is not supported and
causes the tune2fs -j error out.

Also fix the error returning in ext2fs_add_journal_inode() so it
returns a proper error code if the fstat() or ioctl() calls fail.

Addresses-Launchpad-bug: #416648

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kjournal.c
95fd65bb7fcf84e8d1e207f84b9d5a9f99626a38 24-Aug-2009 Valerie Aurora Henson <vaurora@redhat.com> libext2fs: create generic numeric progress meters and use them

With 64-bit file systems, mke2fs can take a long time to do things
other than write inode tables. I exported the mke2fs numeric progress
meter and used it for allocating group tables and the final file
system flush.

Signed-off-by: Valerie Aurora (Henson) <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
lloc_tables.c
losefs.c
xt2fs.h
xt2fsP.h
rogress.c
732c8cd58ff30ffae0d3276c411a08920717a46c 08-Sep-2009 Theodore Ts'o <tytso@mit.edu> Use accessor functions fields for bg_flags in the block group descriptors

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
nitialize.c
node.c
penfs.c
w_bitmaps.c
24a117abd0340d247befbf7687ffb70547fdf218 08-Sep-2009 Valerie Aurora Henson <vaurora@redhat.com> Convert to use io_channel_read_blk64() and io_channel_write_blk64()

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
b_inode.c
move.c
losefs.c
irblock.c
xpanddir.c
xtent.c
mager.c
node.c
kjournal.c
penfs.c
w_bitmaps.c
ndo_io.c
d62d218f118863322742093ceb938bcac6093f80 08-Sep-2009 Nick Dokos <nicholas.dokos@hp.com> 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>
lknum.c
xt2fs.h
dc615a21c3c43cd9071926df2633d5b23e2e726b 07-Sep-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
f4240c8d56520b95f0a8f956ba31e204e105467e 10-Aug-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Treat uninitialized parts of bitmaps as unallocated

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
w_bitmaps.c
8f82ef9860339039b54a324be137fbc09b762358 05-Aug-2009 Valerie Aurora Henson <vaurora@redhat.com> Convert libext2fs to 64-bit bitmap interface

(Includes fixes from Nick Dokos)

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>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
b_inode.c
itmaps.c
move.c
heck_desc.c
sum.c
xt2_err.et.in
xt2_io.h
xt2fs.h
count.c
mager.c
w_bitmaps.c
st_iscan.c
69365c689b7164014e539b40ef62fc8eb804a05c 22-Aug-2009 Theodore Ts'o <tytso@mit.edu> Add support for 64-bit bitmaps

Initial design was done by Theodore Ts'o; implementation was fleshed
out by Valerie Aurora Henson. Also includes some fixes from Nick Dokos.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
akefile.in
itops.h
lkmap64_ba.c
map64.h
xt2_err.et.in
xt2fs.h
xt2fsP.h
en_bitmap.c
en_bitmap64.c
1d72214658d339bd4725fe74aa42397df419e914 22-Aug-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
88fca201aca752cbb7a981e1fe1b2a875cc29833 22-Aug-2009 Theodore Ts'o <tytso@mit.edu> Move declaration of FS_IOC_FIEMAP ioctl to fiemap.h

This helps e4defrag compile on systems where the system header files
don't yet define FS_IOC_FIEMAP.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
iemap.h
baa8dbeb4e4acef9563d8aac61c01ec7c3a8c8ea 02-Aug-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:
misc/Makefile.in
1451c20109608ef4925f103090dee3771aa44570 22-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Use blk_t instead of int in ext2fs_allocate_group_table

We are using a signed int to store a block number in
ext2fs_allocate_group_table. We don't actually do any computation or
comparisons using it, so it shouldn't cause any bugs, but it's
technically incorrect, and it's possible an overly clever compiler
might do something wrong with it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
8b5ed492de2584ce255cc87f054e987bf4e9c5f3 20-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Avoid creating unneeded new extents in ext2fs_extent_set_bmap()

Avoiding inserting a new extent if it is possible to merge the new
block to the beginning or the end of the previous or next extent.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
64cb68b3eab55f532a1b07e3778b75631e85f44a 20-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Improve debugging printf's in extent.c

Comment out less common debugging printf's, and fix some type
warnings. Add high-level debugging printf's for ext2fs_extent_goto(),
ext2fs_extent_insert(), ext2fs_extent_delete(), ext2fs_extent_replace()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
16e470e65010ba3f0516cf9cdf1bd6c98f064e3f 20-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix regression in ext2fs_extent_set_bmap()

Commit 0dc291611 introduced a regression when unmapping the first
block in an extent. This caused e2fsck -fD to corrupt large
directories if the directory has to shrink by more than one block.
The problem was set_bmap should only go to a next leaf when setting a
first block in an extent, and not when it is unmapping the first block
in an extent.

Addresses-Debian-Bug: #537510

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
9922c53a4df10e660a1b425629a1f4db2b4fc03f 18-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: fix memory leak in error path in ext2fs_block_iterate2()

Reported-by: Nic Case <number9652@yahoo.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
25c7e0c3042cb92a71d25cb3c2709a55b9f120a6 12-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix minor gcc -Wall warnings

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ir_iterate.c
xtent.c
en_bitmap.c
cf268fd4849693e13b993bab53c85b6422d0aee4 11-Jul-2009 Theodore Ts'o <tytso@mit.edu> Remove tst_csum.c from lib/ext2fs/Makefile.in's SRCS list

The tst_csum test is now part of csum.c, so there isn't a separate
tst_csum.c file that should be listed as one of the source files in
lib/ext2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
0dc29161125fa4650e4b8832fc0f570435ef0fe3 10-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Make ext2fs_extent_set_bmap() more robust against ENOSPC

In the case where we ext2fs_extent_set_bmap() is replacing the block
mapping at the beginning of an already-existing extent, insert a new
extent if necessary before shrinking an existing extent, to avoid data
loss if the disk is full.

This mostly addresses the problem described in Red Hat Bugzilla's
statistics are still wrong, but at least the files on the filesystem
are not corrupted. If there is a failure during the
inode_scan_and_fix pass, the simplest thing to do may be to tell the
user to run e2fsck -fy.

Addresses-Red-Hat-Bug: #510379

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
ef1a526dfbe663bb80ab75c2e7985ae8d9021b76 09-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add new function ext2fs_test_inode_bitmap_range()

Optimize ext2fs_test_block_bitmap_range() and add a new function,
ext2fs_test_inode_bitmap_range(), which works the same way as
ext2fs_block_bitmap_range() but for inode bitmaps. It's needed for
some code in the development branch, so let's drop it into the maint
branch to make life easier in the future.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
en_bitmap.c
4bd87f22906188b6dba36d4b9ba5fc7acd337699 07-Jul-2009 Eric Sandeen <sandeen@redhat.com> libext2fs: reset handle after inserting new extent

Commit 53422e moved the new extent insertion in
ext2fs_extent_set_bmap() prior to the modification of the original
extent, but the insert function left the handle pointing to the new
extent. This left us modifying the -new- extent, instead of the
original one, and winding up with a corrupt extent tree something
like:

BLOCKS:
(0-1):588791-588792, (0):588791

We need to move back to the previous extent prior
to modification, if we inserted a new one.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
c13351f6c53f175696044c0203bb3009af606c64 02-Jul-2009 Theodore Ts'o <tytso@mit.edu> Add support for configure --enable-verbose-makecmds

Some people don't want to see the concise "kernel-style" make output.
This configure option allows build engines that want to see the full
set of commands executed by the makefile to get what they want. Most
people will find this more distracting than useful, unless they need
to debug the Makefiles.

(It is not necessary to rerun configure to enable this verbose make
output temprarily; if a developer wants to do a quick debug of a
directory's makefile, he or she can simply edit the definition of the
$(E) and $(Q) variables in the Makefile; instructions can be found in
the MCONFIG file which is included in at the beginning of every
Makefile.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
a6a1c0815c045fd12f65546e16d495338097f32a 02-Jul-2009 Theodore Ts'o <tytso@mit.edu> Fix Makefile dependencies for libcom_err

The e2fsprogs makefiles were using the same Makefile variable
LIBCOM_ERR for the link-line arguments as well as the dependencies.
Since LIBCOM_ERR can now include non-file arguments such as
"-lpthread", we need to use a separate DEPLIBCOM_ERR variable that
only has build file dependencies.

Do the same thing for STATIC_LIBCOM_ERR and PROFILED_LIBCOM_ERR.

Addresses-Sourceforge-Patches: #2813809

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
6a8da46d284721e95f893d4f229a2bec473797e1 29-Jun-2009 Nic Case <number9652@yahoo.com> libext2fs: ensure validate_entry doesn't read beyond blocksize

ext2fs_validate_entry would read beyond the end of the block to get
dirent->rec_len for certain arguments (like if blocksize ==
final_offset). This patch adds a check so that doesn't happen, and
changes the types of the arguments to avoid a compiler warning.

Signed-off-by: Nic Case <number9652@yahoo.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ir_iterate.c
8a480350952f6f0fdbce54326b6d847e66368897 22-Jun-2009 Theodore Ts'o <tytso@mit.edu> Fix encoding for rec_len in directories for >= 64k blocksize file systems

Previously e2fsprogs interpreted 0 for a rec_len of 65536 (which could
occur if the directory block is completely empty in 64k blocksize
filesystems), while the kernel interpreted 65535 to mean 65536. The
kernel will accept both to mean 65536, and encodes 65535 to be 65536.
This commit changes e2fsprogs to match.

We add the encoding agreed upon for 128k and 256k filesystems, but we
don't enable support for these larger block sizes, since they haven't
been fully tested.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ir_iterate.c
irblock.c
xt2fs.h
ink.c
ewdir.c
827c1887118eb68a64f8455d0b7cbbbed65e714a 17-Jun-2009 Eric Sandeen <sandeen@redhat.com> libext2fs: initialize large inodes for journal & resize

I noticed that neither the journal nor resize inodes have
i_extra_isize set post-mkfs; while this isn't likely
to be a big problem, I think the below patch tidies
it up.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
kjournal.c
es_gdt.c
125a36780626cdb0fc4d62fd529486baa8bce54c 18-Jun-2009 Eric Sandeen <sandeen@redhat.com> libext2fs: write only core inode in update_path()

The ext2_extent_handle only has a struct ext2_inode allocated on
it, and the same amount copied into it in that same function,
but in update_path() we're possibly writing out more than that -
for example 256 bytes, from that address. This causes uninitialized
memory to get written to disk, overwriting the parts of the
inode past the osd2 member (the end of the smaller structure).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
7b59b4a8ee4a65ef14eb364cde574d34ec8c014f 15-Jun-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix memory leak in the extents handling function

Each time an extent handle is opened and closed, if the inode has an
extent tree which does not fit in the inode's i_block structure, a
filesystem block buffer was not getting released. Since e2fsck opens
an extent handle for every inode using extents, this can translate to
a very large amount of memory getting lost.

Thanks to Henrik 'Mauritz' Johnson for discovering and pointing out
this leak, which he ran into while running the "rdump" command in
debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
272631e4baa9f3a87813690d2e79161c8dc4b387 01-Jun-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add ext2fs_block_iterate3()

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
xt2fs.h
8717c3a8f31dea3b31ddaeccf74ea3b34ca72c04 01-Jun-2009 Valerie Aurora Henson <vaurora@redhat.com> libext2fs: Add 64-bit bitops

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.c
itops.h
st_bitops.c
5635e75c918866849746cf50d1a9a301c241fed4 21-Jul-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
6a0ee32dcb0984b50c3afb9234706e69b3e6b9d3 12-Jul-2009 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
73d0c4cce5cc6de9525e8a3c9ee690f066d8c0ba 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit mkjournal.c interface

Added 64-bit mkjournal.c interface. Needed to zero inode tables.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
kjournal.c
743011fbac672c488e54b843bf8a759bef10862e 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add ext2fs_div64_ceil()

Add a new div_cell routine able to handle 64bit values

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
4f8d6ab222beea3557e26aba9eefedb81db956ab 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit openfs interface

Add new ext2fs_descriptor_block_loc2() routine that takes blk64_t as
an input.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
penfs.c
20f2ccb3262b11d3a7b892cb9a11ea1c8c2ddd3b 12-Jul-2009 Jose R. Santos <jrs@us.ibm.com> Use new ext2fs_super_and_bgd_loc2 call in libext2fs

The new ext2fs_super_and_bgd_loc2() function has some changes aside
from just blk64_t support. Lets make sure that the interfaces are
sane by adding libext2fs support early to get the new API tested here.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_sb.c
losefs.c
71300f35de9b7fd0ab4252500ec5a4da1d9a1424 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit closefs interface

Add new ext2fs_super_and_bgd_loc2() that returns blk64_t pointers.
The function now returns the number of blocks used by super block and
group descriptors since with flex_bg, it can no longer be assumed that
bitmaps and inode tables still resided within the block group.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2fs.h
b91f14b870d5b4a4d71b62d81b078f2eb40878ae 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit ext_attr interface

Add ext2fs_read_ext_attr2(), ext2fs_write_ext_attr2() and
ext2fs_adjust_ea_refcount2() that take blk64_t as an input.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
xt_attr.c
8a5e1812ae21d3d847a4df1067a105f284eb187c 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit alloc interface

Add new ext2fs_new_block2(), ext2fs_get_free_blocks2() and
ext2fs_alloc_block2() that take and return blk64_t.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
xt2fs.h
e8328e31a98a92b39611314612a40b6113921fe2 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit alloc_stats interface

Add new ext2fs_block_alloc_stats2() routine that takes blk64_t as an
input.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_stats.c
xt2fs.h
57e2467d6211b2ff0dbcc23f705afd3b95fb917f 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Add 64-bit dirblock interface

Add new ext2fs_(read|write)_dir_block3() routines that take blk64_t as
an input.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
irblock.c
xt2fs.h
319158f9bd1d49ae0f697cfa9910d67ba5be8627 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> Use blk64_t for blocks in struct ext2_file

The ext2_file structure is never exposed through the libext2fs API so
it is safe to use 64-bit blocks for blockno and physclock without
breaking the ABI.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ileio.c
e3854b3b7c7c499a663d752f9196a0d74eb5ec98 06-Jun-2009 Jose R. Santos <jrs@us.ibm.com> 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>
akefile.in
lknum.c
xt2fs.h
f6b4c27562837e5964726c1b6b86497c989dd03d 01-Jun-2009 Jose R. Santos <jrs@us.ibm.com> libext2fs: Add ext2_off64_t type

The ext2_off_t type is u32. Create a new 64-bit ext2_off64_t for
64bit offsets.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
1adc384bc559da2a2fd3d65e563a89bb7d296094 12-Jul-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add 64-bit support to the undo manager

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ndo_io.c
3c4d4d7459f46adbd10b97b37fe0def2313d1d21 06-Jun-2009 Valerie Aurora Henson <vaurora@redhat.com> libext2fs: Define bg_itable_unused_hi in the ext4_group_desc structure

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
337079375e418c48516e75879d4341bead185619 30-May-2009 Theodore Ts'o <tytso@mit.edu> Update lib/xt2fs/Makefile.in using "make depend"
akefile.in
470e737a872918afd9067de1ce92d571d5671d40 29-May-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Move test code for csum.c inline instead of in a separate file

Move the test code which is used to build the tst_csum progam from
tst_csum into csum.c under an #ifdef DEBUG to simplify things and to
avoid compile problems caused by not having a prototype for
ext2fs_group_desc_csum().

Addresses-Sourceforge-Bug: #2484331

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
sum.c
st_csum.c
86522281f8be6e5fca0b3ed552786db4979a45a4 29-May-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add an explicit error code for missing mtab file

To reduce user confusion, if the /etc/mtab file is missing
ext2fs_check_mount_point and ext2fs_check_if_mounted will return a
new, explicit error code to indicate this case.

Addresses-Debian-Bug: #527859

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
smounted.c
84b239aea4da04c7a569b428d3abf6c720e82645 19-May-2009 number9652 <number9652@yahoo.com> libext2fs: add ext2fs_extent_open2

The patch below adds a function, ext2fs_extent_open2(), that behaves
as ext2fs_extent_open(), but will use the user-supplied inode
structure when opening an extent instead of reading the inode from
disk. It also changes several of the calls to extent_open() to use
this enhancement.

Signed-off-by: Nic Case <number9652@yahoo.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
map.c
xt2fs.h
xtent.c
53422e8a5644e22ea3f6e0efba82a765b72e4308 20-May-2009 Eric Sandeen <sandeen@redhat.com> resize2fs: fix ENOSPC corruption case

http://people.redhat.com/esandeen/livecd-creator-imagefile.bz2
contains an image (for now) which, when resized to 578639, corrupts
the filesystem.

This is a bit crazy, I guess, because the fs currently has only
1 free block, but still, we should be graceful about the failure.
Perhaps it would make sense to check the requested valuea against
the minimum value resize2fs would compute for "-P" and fail (at
least without a force).

But in any case, this exposed 2 bugs when moving that one block
required an extent split, which is what hit the ENOSPC.

For starters, ext2fs_extent_set_bmap() in the "(re/un)mapping last
block in extent" case was replacing the old extent before the
new one was created; when the new extent creation failed, it
left us in an inconsistent state. Simply changing the order of
the two should fix this problem.

Next, ext2fs_extent_insert was calling ext2fs_extent_delete()
on *any* error, including one caused by failure to allocate a new
block to split the node to hold that extent ... the handle was left
unchanged, and we deleted the -original- extent.

As a quick fix for this, just don't do the delete if we fail the split,
though this may need to be smarter. I don't think we have terribly
consistent behavior about where a handle is left on various errors.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
5fdb89e30e96db74ab035524dded4a809aef441c 04-May-2009 Theodore Ts'o <tytso@mit.edu> Add missing file: lib/ext2fs/fiemap.h

This file is needed so the updated filefrag program will compile. I
missed a "git add"; oops.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
iemap.h
6d67ee305cdfff7131a4105551409d1603dba81d 03-May-2009 Theodore Ts'o <tytso@mit.edu> Avoid unneeded updates of block group descriptors in ext2fs_closefs()

If the superblock is clean, and we only need to update
s_kbytes_written, then we only need to update the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
41aeae11a657eb64c47f733850fc78350cd48cde 24-Apr-2009 Theodore Ts'o <tytso@mit.edu> Update lib/ext2fs/Makefile.in using "make depend"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
8203fe506a06524587c18940b6cd19a0592a4bd2 23-Apr-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: read the block group descriptors more efficiently

When opening a filesystem, make ext2fs_open2() much more efficient by
reading the normal block group descriptors all at once, instead of one
block at a time.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
f9110f4480eade2d849c4cc08efa49bf0f7f5148 23-Apr-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Skip relative pathnames in /etc/mtab in ismounted.c

The functions which test to see if a device is mounted can get
confused by entries in /etc/mtab for virtual filesystems:

rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

If the device name doesn't start with a slash, ignore the /etc/mtab
entry, so that relative pathnames passed into functions such as
ext2fs_check_mount_point() or ext2fs_check_if_mounted() don't return
false positives.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
smounted.c
46d6f84ebe3cfdd703f40a56f9904c04d10cc138 22-Apr-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix format string type warnings in alloc_stats.c

Fix gcc warnings caused by wrong types passed com_err() in
ext2fs_inode_alloc_stats2 and in ext2fs_block_alloc_stats().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_stats.c
341b52dfa8c2afc11d8410de9bd381b03e75c6af 17-Mar-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: external journal devices should not cause ext2fs_open2 to fail

This fixes a regression introduced in commit 79a9ab14 which caused
attempts to open external journals to fail due to overly strict
filesystem consistency checks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
4e711be8d04cb6da9e3e3628f82ee66bfbda23f2 23-Feb-2009 Jim Meyering <jim@meyering.net> libext2fs: don't leak strdup'd dev name in dosio.c upon error

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
osio.c
45e338f5332a54295893dba2e32cc093d1316f60 23-Feb-2009 Jim Meyering <jim@meyering.net> remove useless if-before-free tests

In case you're wondering about whether this change is safe from a
portability standpoint, fear not. This has been beaten to death
in other forums. Here are a few threads:

http://thread.gmane.org/gmane.comp.version-control.git/74187
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
http://thread.gmane.org/gmane.emacs.devel/98144
http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092

There has been debate about whether it's a good idea from a
performance standpoint, too, but imho you'll have a hard time
finding an instance where this sort of change induces a
measurable performance penalty. If you do, please let me know.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
osio.c
xtent.c
nitialize.c
t_io.c
b7c5b4030870b31d73019d9d9ec55d550772590b 06-Mar-2009 Theodore Ts'o <tytso@mit.edu> Add support for a new superblock field: s_kbytes_written

This field tracks the lifetime amount of writes to the filesystem. It
will be updated by the kernel as well as by e2fsprogs programs which
write to the filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2_fs.h
wapfs.c
cf4e06d665e53ec7a5af67c9104e7278777a8488 22-Jan-2009 Theodore Ts'o <tytso@mit.edu> libext2fs: Add sanity checks to ext2fs_{block,inode}_alloc_stats

If ext2fs_inode_alloc_stats2() or ext2fs_block_alloc_stats() is passed
an insanely large inode or block number, it's possible for these
functions to overrun an array boundary and cause the calling program
to crash with a memory error.

Detect this case, and since these functions don't return an error
code, print a warning message, much like we do in ext2fs_warn_bitmap2().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_stats.c
a93d40696073076b26bc11052f7cc99588d74dae 22-Jan-2009 Theodore Ts'o <tytso@mit.edu> ext2fs_new_inode(): Add sanity check to assure a valid inode number

Add a sanity check to makesure that even if the superblock field
s_first_inode is insane, that we won't return an invalid inode number.
(The function will return the error EXT2_ET_INODE_ALLOC_FAIL in that
case.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
9f7a1fc936497d5ab1ebe88baa704e91880849cc 20-Jan-2009 Theodore Ts'o <tytso@mit.edu> ext2fs_get_device_size: Fix error handling

The previous patch would return EFBIG for any failure called from
ext2fs_get_device_size2(). (I didn't merge this fix with the
preceeding commit to allow merges to happen more easily.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
etsize.c
beab8de477110970785077fb3204f171d3fcc485 20-Aug-2008 Jose R. Santos <jrs@us.ibm.com> Add 64-bit getsize interface.

Added interface capable of opening 64-bit block device.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
etsize.c
79a9ab145467b95b96a885e6ac0b2cdd22cde516 20-Jan-2009 Thiemo Nagel <thiemo.nagel@ph.tum.de> ext2fs_open2: Add more checks for filesystem consistency

Add more checks to assure the filesystem is sane to avoid later
division by zero errors.

Patch adds consistency checks on superblock to fix serveral crashes:
* require EXT2_INODES_PER_GROUP != 0
* require EXT2_DESC_PER_BLOCK != 0
* require s_first_data_block < s_blocks_count
* require group_desc_count * EXT2_INODES_PER_GROUP == s_inodes_count

Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
a7843581f5c862db79286c7e73f5ca76d59dccea 20-Jan-2009 Theodore Ts'o <tytso@mit.edu> ext2fs_read_inode_full: Add safety check to avoid SEGV's on corrupted fs's

Thanks to Thiemo Nagel for suggesting this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
07f1a070ff45c8381c3ddf8552c726525104e1ee 20-Jan-2009 Theodore Ts'o <tytso@mit.edu> ext2fs_block_iterate2: Preserve the uninit flag in extents

When modifying a block via the block_iterate interface, preserve the
uninit flag in the extent. Resize2fs uses this interface, so we have
to preserve the uninit status when relocating a block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
d3a8fc5ae68477118e32813230518bf4ccc73bf9 19-Jan-2009 Theodore Ts'o <tytso@mit.edu> ext2fs_block_iterate2: Reflect errors from ext2fs_extent_set_bmap to caller

If the callback function tries to change a block, and
ext2fs_extent_set_bmap() fails for some reason (for example, there
isn't enough disk space to split a node and expand the extent tree,
make sure that error is reflected back up to the caller.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
7518c176867099eb529502103106501861a71280 26-Dec-2008 Theodore Ts'o <tytso@mit.edu> e2fsck: Fix an unhandled corruption case in scan_extent_node()

A corrupted interior node in an extent tree would cause e2fsck to
crash with the error message:

Error1: Corrupt extent header on inode 107192
Aborted (core dumped)

Handle this and related failures when scanning an inode's extent tree
more robustly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
03fa6f8ae28a87018325c892f731097cc97d9eac 16-Nov-2008 Theodore Ts'o <tytso@mit.edu> Fix various signed/unsigned gcc warnings

Some of these could affect filesystems between 2^31 and 2^32-1 blocks.

Thanks to Valerie Aurora Henson for pointing out the problems in
lib/ext2fs/alloc_tables.c, which led me to do a "make gcc-wall" scan
over the source tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_tables.c
node.c
7ed7a4b6ed8b2fce891874a0eafdc8f77c3ffc34 11-Oct-2008 Eric Sandeen <sandeen@redhat.com> unix_io: check for read-only devices when opening R/W

When we open a device on linux, test whether it is writable
right away, rather than trying to proceed and clean up when
writes start failing.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
nix_io.c
d58d8320e881a751cc40e3f2ab00c6e16c8447db 02-Oct-2008 Theodore Ts'o <tytso@mit.edu> Update Makefile depend information for crc16.o

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
0eeec8ac61bf1eaa31533b2be825cd75580829c9 12-Sep-2008 Theodore Ts'o <tytso@mit.edu> 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>
rc16.c
rc16.h
sum.c
st_csum.c
97be89b60bd57272ece637bc2f300a5288b78831 03-Sep-2008 Theodore Ts'o <tytso@mit.edu> 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>
xt2fs.pc.in
e01f9be336274e527cdb794cca2b0c1501e8b0d7 02-Sep-2008 Theodore Ts'o <tytso@mit.edu> 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>
itops.h
5c0255e8ad02f4046c77a860506b6907c533ef7b 02-Sep-2008 Theodore Ts'o <tytso@mit.edu> 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>
itops.h
af773654b2faf1d001fa2fa6b929a67ce7c7ca00 01-Sep-2008 Theodore Ts'o <tytso@mit.edu> 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>
akefile.in
b55d73985cc7a33e2b57161e5ea1a5a2ad1bff9c 28-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
kjournal.c
efc6f628e15de95bcd13e4f0ee223cb42115d520 28-Aug-2008 Theodore Ts'o <tytso@mit.edu> Remove trailing whitespace for the entire source tree

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_sb.c
lloc_stats.c
lloc_tables.c
adblocks.c
b_compat.c
b_inode.c
itmaps.c
itops.c
itops.h
lock.c
map.c
move.c
rel.h
rel_ma.c
heck_desc.c
losefs.c
sum.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
irhash.c
osio.c
upfs.c
2image.h
xpanddir.c
xt2_fs.h
xt2_io.h
xt2fs.h
xt2fsP.h
xt_attr.c
xtent.c
ileio.c
inddev.c
lushb.c
reefs.c
en_bitmap.c
et_pathname.c
etsectsize.c
etsize.c
mager.c
nd_block.c
nitialize.c
nline.c
node.c
node_io.c
o_manager.c
rel.h
rel_ma.c
smounted.c
fs_dat.h
ernel-jbd.h
ernel-list.h
ink.c
lseek.c
ookup.c
kdir.c
kjournal.c
amei.c
ative.c
ewdir.c
penfs.c
ead_bb.c
ead_bb_file.c
es_gdt.c
w_bitmaps.c
wapfs.c
db.c
db.h
dbtool.c
est_io.c
st_badblocks.c
st_bitops.c
st_byteswap.c
st_getsectsize.c
st_getsize.c
st_iscan.c
st_super_size.c
st_types.c
nix_io.c
nlink.c
alid_blk.c
4690e621acd4579dae60b6f55f58284ee805e86d 28-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
xt2_err.et.in
xt2_io.h
o_manager.c
9033faf5257be85aab4baffa53e0bef96ab9c0f5 28-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
map.c
xtent.c
64987c052c235d60373995d36b5c01291c464b74 27-Aug-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_block_iterate2: Fix memory leak on error paths

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
961306d31ad36a9eef4e515343c9e355afc6e19c 27-Aug-2008 Theodore Ts'o <tytso@mit.edu> If the filesystem supports extents create an extent-based journal inode

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kjournal.c
685d544effc774de1580fec047629cd814bad660 27-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
lock.c
1af01e94cc020ab989cc97cec1b755bf2a476508 27-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
kjournal.c
674c0cc4cb137c6362cb1ae71b6db5cbccbad83a 27-Aug-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_mkjournal(): Don't allocate an extra block to the journal

Addresses-Sourceforge-Bug: 1483791

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kjournal.c
5dd77dbe5a0ac6d78c1c6441fae4087be56d9088 26-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
ir_iterate.c
irblock.c
ink.c
ewdir.c
c4dcb1c10ae5e3d523823fe0a2c84d0841ca2ea1 25-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
rc16.c
rc16.h
sum.c
st_csum.c
9f9e5c3aea024c92c50e8bb834a3ea33d9e1f55d 24-Aug-2008 Andreas Dilger <adilger@sun.com> 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>
blist.c
baf8ab980e73e6600ac1ec45e6058796fc9dc0b0 23-Aug-2008 Manish Katiyar <mkatiyar@gmail.com> 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>
nitialize.c
2d40a91e171ec1cfb6bb80a0e788e0740bb1d747 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
nitialize.c
w_bitmaps.c
c71d781370c29f283fdaea01783b5257e508df0f 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
lloc.c
213fe9288bbebe6566f554996660a7c242a910dd 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
lock.c
da994e9c11749fc9a427e742273b27853b74fe1d 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
xtent.c
2047e0a1eec1d128523e116f38b279f9cb8fe06b 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
xtent.c
a9ea7285e6d97fba4fa4af059db73f0413acfcab 22-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
xtent.c
57fd39e94339f6a60f3c1df0818e5305cdbb7569 21-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
w_bitmaps.c
f93d9f653c0a617556727a9cafb60486b58ae6a8 15-Aug-2008 Manish Katiyar <mkatiyar@gmail.com> 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>
xtent.c
3bcc6276a0c229791ca4a4fee4cf6d8d48ebe824 14-Aug-2008 Theodore Ts'o <tytso@mit.edu> 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>
node.c
kdir.c
ac24e62c4e51f63a570a86519e0dcd09d1458ebb 18-Jul-2008 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 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>
xtent.c
b5264593993145fa17a1758f064443075ebea072 17-Jul-2008 Frederic Bohe <frederic.bohe@bull.net> 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>
lloc_tables.c
8eb3b8a0a0d6a4213dc1ad2c7bbae60f076b04d7 15-Jul-2008 Manish Katiyar <mkatiyar@gmail.com> 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>
node.c
4729455f0a68f2fa0a83ec8460d1d4bccba9dcfa 14-Jul-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Don't check the group checksum when !GDT_CSUM

ext2fs_group_desc_csum_verify() is always checking the bg_checksum (to
make sure it is zero) even when the GDT_CSUM feature is not present.
This is normally OK, but apparently there are filesystems in the wild
where this field has not be initialized to zero.

Addresses-Debian-Bug: #490637

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
ebabf2ad6d19af5c674b624bafe619dedbc94403 13-Jul-2008 Theodore Ts'o <tytso@mit.edu> Define _XOPEN_SOURCE to 600 consistently for Solaris C99 support

Solaris's header files are very picky about which C compiler can be
used for SUSv3 conformance. Use of C99 is not compatible with SUSv2
(_XOPEN_SOURCE=500), and C89 is not compatible with SUSv3
(_XOPEN_SOURCE=600). Since we need some SUSv3 functions, consistently
use SUSv3 so that e2fsprogs will build on Solaris using c99.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
db.c
5a299b56857c20273a43add86ecdaf9a6db0e2b8 13-Jul-2008 Theodore Ts'o <tytso@mit.edu> Remove gcc-specific varargs macro in extent.c

Use "#ifdef DEBUG // printf... // #endif" instead of dbg_printf().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
f926a7006de647132fff634b9fd9c1fa8f41abd4 13-Jul-2008 Theodore Ts'o <tytso@mit.edu> Remove vararg macro which causes portability problems from ext3_extent.h

Also remove other unneeded kernel-only cruft for ext3_extent.h.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt3_extents.h
5c3e1b917caf780943695da3e5d772688ca7ab91 13-Jul-2008 Theodore Ts'o <tytso@mit.edu> Use K&R style comments instead of C99 comments for portability

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt3_extents.h
49b4670e5c794f3c0f6f5df61dfa199d6cc7de65 11-Jul-2008 Manish Katiyar <mkatiyar@gmail.com> libext2fs: Add stricter/earlier tests for blocksize in ext2fs_open()

Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
adc4e77d89d9a423c3fbe6457676b020c9ad3a64 11-Jul-2008 Manish Katiyar <mkatiyar@gmail.com> libext2fs: fix potential memory leak in ext2fs_initialize()

If we fail doing ext2fs_allocate_block_bitmap() or
ext2fs_allocate_inode_bitmap() we directly goto cleanup and don't free
the memory allocated to buf.

Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
3da77aab976ce1b93673be9c5c63b253664d11da 10-Jul-2008 Theodore Ts'o <tytso@mit.edu> Update dependencies in the Makefile for lib/ext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
009c02baf90a55b4b2d9c9e3d0a4cfc3e2531640 10-Jul-2008 Theodore Ts'o <tytso@mit.edu> Make ext2fs_check_desc() more stringent to force use of backup superbocks

E2fsck could to do more damage to a filesystem by trying to relocate
inode tables due to corrupted block group descriptors, and the
relocation could seriously damage the filesystem.

This patch enhances ext2fs_check_desk() so it detects more
self-inconsistent block group descriptors, including the cases where
e2sck might be tempted to relocate the inode table, and reports the
block group descriptors as invalid; this will cause e2fsck to attempt
to use the backup superblocks, which hopefully have not been trashed.

Addresses-Sourceforge-Bug: #1840291

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
heck_desc.c
2be8fe43976537b75a6ee154ff3ba47e538b55fb 10-Jul-2008 Theodore Ts'o <tytso@mit.edu> mke2fs,tune2fs: Enable huge_file, dir_nlink, and extra_isize features

Also change mke2fs.conf to enable huge_file,dir_nlink,extra_isize, and
uninit_bg by default for ext4 filesystems, and enable extra_isize in
the library as well.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
ba4a021009d84682690f10e452dc81f99fe2ffdd 07-Jul-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix FLEX_BG offset used by ext2fs_allocate_group_table

The offset for both inode bitmaps and inode tables is overshot by one
block causing a hole between the group of bitmaps and inode tables
when initializing a filesystem using mke2fs.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
79e62409b3a247e258d9e9206484ed8f193a183e 07-Jul-2008 Eric Sandeen <sandeen@redhat.com> Clean up some trivial build warnings

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
st_csum.c
92e94afe4cc52deeef120941e6ac4d8ca4cda55e 23-Jun-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Don't include ss/ss.h except when debugging

extent.c should only try to include ss/ssh.h when it is compiled with
-DDEBUG. Otherwise it's not necessary and it breaks the Debian MIPS
build (and the Debian MIPS build only) because it tries to build
libext2fs without building libss as part of a MIPS-specific build
rule.

Addresses-Debian-Bug: #487675

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
bc507e31ad8a890232dc2b3aec9ee9d68e95622a 17-Jun-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_zero_blocks: Avoid clearing more blocks than requested

This could cause certain mke2fs feature combinations to result in the
initial blocks of the inode table getting wiped out when the journal
is created.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
kjournal.c
9d99416ea38f159e61aef10f76a1e417e8cb3090 08-Jun-2008 Theodore Ts'o <tytso@mit.edu> Fix dependency for $(LIBSS) when an explicit dlopen() library is needed

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
5c4f8d674845095050f94ea95f3c73072cbe34b5 07-Jun-2008 Theodore Ts'o <tytso@mit.edu> resize2fs: Add support to use the ext4 online resize ioctl's

First try the ext3 ioctl, but if we get an error, try using the ext4
ioctl.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
dabfa68f81207f3ec5e9cc3215f3eb9e891294e7 07-Jun-2008 Theodore Ts'o <tytso@mit.edu> Update Makefile dependencies for lib/ext2fs
akefile.in
8895f43a60269464f654e9d87c28768875cd703a 07-Jun-2008 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall warnings in libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_tables.c
sum.c
xtent.c
ndo_io.c
dc9345a0bddcbbe2dbdc6df3afdb97a9bb470f55 07-Jun-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint'

Conflicts:

configure
488c75a6a62acb07b82bcfab327d30eb5ea54703 07-Jun-2008 Theodore Ts'o <tytso@mit.edu> Fix ext2fs_swap{16,32,64} for external applications on big-endian machines

The public header files depend on the the autoconf defines
WORDS_BIGENDIAN and HAVE_SYS_TYPES_H, so we add them to ext2_types.h
so that external programs which try to use ext2fs_swap*() will work
correctly on big-endian systems. Fortunately, few if any programs
need to use this libext2's byte-swap functions directly.

Addresses-Debian-Bug: #484879

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_types.h.in
185c4aeaf23d48375e3506218305031663203d0f 23-May-2008 Theodore Ts'o <tytso@mit.edu> e2fsck: Add support to check journal checksums

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs_compat.h
ernel-jbd.h
69fbde418b1a197bf793e51b12e23f528b967093 24-May-2008 Theodore Ts'o <tytso@mit.edu> Re-enable byte-swapping functions for use by journal checksums

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
2ea504bd64dc391530c0eb33904afa27f4156c0e 04-Jun-2008 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> libext2fs: Fix build failure on powerpc in ext2fs_swap_inode_full()

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
wapfs.c
f5c562e2324a8950d659ebfc8db4356121d6104e 02-Jun-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Add callback functions for _alloc_block() and _block_alloc_stats()

Add callback functions for ext2fs_alloc_block() and
ext2fs_block_alloc_stats(). This is needed so e2fsck can be informed
when the extent_set_bmap() function needs to allocate or deallocate
blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc.c
lloc_stats.c
xt2fs.h
ec9d6dd3203e8a4d548c0b6c943033ab5518a423 27-May-2008 Theodore Ts'o <tytso@mit.edu> Wire ext2fs_bmap2() to use ext2fs_extent_set_bmap()

This commit enables read/write access via the ext2fs_bmap2() interface
for extent-based inodes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
d7b92206ba7f987a68ba42971c930039729831e1 27-May-2008 Theodore Ts'o <tytso@mit.edu> Wire ext2fs_block_iterate2() to use ext2fs_extent_set_bmap()

This commit enables read/write access via the block iterator for
extent-based inodes.

Also fixed some bugs regarding the handling on non-leaf extent nodes
when iterating over extents in a file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
c802ad9ed6c6756dfb65d31f0f559e90df3825d5 20-May-2008 Eric Sandeen <sandeen@redhat.com> Teach ext2fs_extent_delete() to remove an empty extent node from the tree

ext2fs_extent_delete() will also update the parent node and decrement
the inode block count.

Passing in the EXT2_EXTENT_DELETE_KEEP_EMPTY flag will allow the empty
node to remain.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
xtent.c
f4e9963c0966734d8dc16877753698193b83cd65 20-May-2008 Eric Sandeen <sandeen@redhat.com> libext2fs: add new function ext2fs_extent_set_bmap()

Allows unmapping or remapping single mapped logical blocks,
and mapping currently unmapped blocks.

Also implements ext2fs_extent_fix_parents() to fix parent
index logical starts, if the first index of a node changes
its logical start block.

Currently this can result in unnecessary new single-block extents; I
think perhaps ext2fs_extent_insert should grow a flag to request
merging with a nearby extent?

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
xtent.c
xtent_dbg.ct
01229db57ee71518f81d87d6bf900c62fe1de100 20-May-2008 Eric Sandeen <sandeen@redhat.com> Teach ext2fs_extent_insert() to split the current node if necessary

If ext2fs_extent_insert finds that the requested node
for insertion is full, it will currently fail.

With this patch it will split as necessary to make room, unless an
EXT2_EXTENT_INSERT_NOSPLIT flag is passed to it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2fs.h
xtent.c
9fd6a96d9bf089d8d0ece3bba23b0ef19d03c102 20-May-2008 Eric Sandeen <sandeen@redhat.com> libext2fs: Teach extent.c how to split nodes

When called for a given handle, the new function extent_node_split()
will split the current node such that half of the node's entries will
be moved to a new tree block. The parent will then be updated to
point to the (now smaller) original node as well as the new node.

If the root node is requested to be split, it will move all
entries out to a new node, and leave a single entry in the
root pointing to that new node.

If the reqested split node's parent is full it will recursively
split up to the root to make room for the new node's insertion.

If you ask to split a non-root node with only one entry,
it will refuse (we'd have an empty node otherwise).

It also updates the i_blocks count when a new block has
successfully been connected to the tree.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_err.et.in
xtent.c
xtent_dbg.ct
aa8e2f1c31374bfc6e479aea008896d179b100b4 02-Jun-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_extent_open: If the inode is empty, initialize the extent tree

If the inode's i_block[] array is completely empty, create an empty
extent tree in the in-core inode and set the EXT4_EXTENT_FL inode
flag. This makes it easy to create a new inode using extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
05a32de263228ce8f78746143384e5ebe2677d14 02-Jun-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_extent_replace: Support uninit extents and check validity of e_len

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_err.et.in
xtent.c
c7015e491fbd1aefde15faf9b30d086d9fc9d35e 25-May-2008 Theodore Ts'o <tytso@mit.edu> Add 64-bit support to the test_io manager

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
est_io.c
bb767b2fc3b4420f566df6f563574fd8e5c856b1 16-May-2008 Theodore Ts'o <tytso@mit.edu> ext2fs.h: Add l_i_file_acl_high and l_version_hi to on-disk inode structure

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
9817a2ba2d408077dab12090b4b4250d0d9a282a 13-May-2008 Eric Sandeen <sandeen@redhat.com> fix extent_goto for non-0 leaf levels

The logic for stopping at the right level in extent_goto was wrong,
so if you asked it to go to any level other than 0 (the leaf
level) it would fail.

Also add this argument to the tst_extents goto command to test it.

(I thought this was a failure in my split code but it was this
helper that was causing problems...)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
faa08e4c92eedef72b1e477cea6bda08ecf99311 28-Apr-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'next' into tt/flex-bg
c86085044195c8b721fe9ee327d790316399781e 27-Apr-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_add_journal_inode: Optimize writing the journal data blocks

Add a new function ext2fs_zero_blocks(), and use it so that journal
data blocks is written in larger chunks to speed up the creation of
the journal.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
kjournal.c
72a168b59cbabdcfb1fe9db30f3d63f6f9731324 13-Aug-2007 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> libext2fs: Add undo I/O manager

This I/O manager saves the contents of the location being overwritten
to a tdb database. This helps in undoing the changes done to the
file system.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2_io.h
ndo_io.c
9ba400027fb00ce43d14673346bbfb6f5719985a 22-Apr-2008 Theodore Ts'o <tytso@mit.edu> mke2fs: New bitmap and inode table allocation for FLEX_BG

Change the way we allocate bitmaps and inode tables if the FLEX_BG
feature is used at mke2fs time. It places calculates a new offset for
bitmaps and inode table base on the number of groups that the user
wishes to pack together using the new "-G" option. Creating a
filesystem with 64 block groups in a flex group can be done by:

mke2fs -j -I 256 -O flex_bg -G 32 /dev/sdX

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lloc_tables.c
nitialize.c
494a1daad37a8098e7db166d558aab3e9e37ac48 22-Apr-2008 Theodore Ts'o <tytso@mit.edu> Basic flexible block group support

Add superblock definition, and dumpe2fs and debugfs support.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xt2_fs.h
d11736c6ddcd6e687d857bd902ed772311cd66bc 23-Apr-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_open_inode_scan: Handle an non-zero bg_itable_used in block group 0

Previously, the portion of the inode table for block group 0 was
always completely zero'ed out, so the ext2fs_open_inode_scan() didn't
handle a non-zero bg_itable_used value for the first block group. Fix
this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
0f2794c020b34de391f7a42e3b155ccb0ed2830f 23-Apr-2008 Theodore Ts'o <tytso@mit.edu> mke2fs/libext2fs: Fix lazy inode table initialization

This fixes some bugs which I introduced recently while revamping the
uninit_bg code. Since mke2fs is no longer calling
ext2fs_set_gdt_csum(), it's important that ext2fs_initialize()
correctly initialize bg_itable_unused for all block group descriptors.
In addition, mke2fs needs to zero out the the reserved inodes based on
the values of bg_itable_unused set by ext2fs_initialize().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
5711ed297b1a3d94086256b5b3b891d4f77b21ca 21-Apr-2008 Theodore Ts'o <tytso@mit.edu> Transfer responsibility of setting the *_UNINIT flags to libext2fs

Mke2fs used to have special case, ugly code in
setup_lazy_bg/setup_uninit_bg flag which set the flags based on all
sorts of special cases. Change it so that it is done in libext2fs,
and fix mke2fs to use alloc_stats functions which will take care of
clearing the *_UNINIT flags automatically as needed.

This is preparatory work to make the flex_bg allocation patch much
cleaner.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
lloc_stats.c
sum.c
nitialize.c
16b851cdae98244e117fe91d93b267fcad1102b3 21-Apr-2008 Theodore Ts'o <tytso@mit.edu> Remove LAZY_BG feature

This simplifies the code, and using the uninit_bg with the inode table
lazily initialized is just as good.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
xt2fs.h
node.c
w_bitmaps.c
4a568505ab904d39d9553e9c1d1c565615a5c6ca 21-Apr-2008 Theodore Ts'o <tytso@mit.edu> Add comments documenting ext2fs_[reserve_]super_and_bgd_loc()

Add an explanation of exactly what ext2fs_super_and_bgd_loc() and
ext2fs_reserve_super_and_bgd_loc() do, and more importantly, exactly
what they return. Note that most callers should *not* rely on the
return value since it's rarely useful, especially once the flex_bg
feature is enabled and inode table and allocation bitmap blocks may
not be in the block group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lloc_sb.c
losefs.c
456e9892707c2f88b951c67113b265e45a1b2556 19-Apr-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_set_gdt_csum: Remove setting of BLOCK_UNINIT

This function tried to set BLOCK_UNINIT based on the return value of
ext2fs_super_and_bgd_loc. That's not something that works once we
start allowing flex_bg since the block group metadata might not be
located in the blockgroup itself.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
3c5556ed4a6da11d65fe7dd4992291a500da819c 19-Apr-2008 Theodore Ts'o <tytso@mit.edu> ext2fs_set_gdt_csum: Remove bogus setting of ITABLE_ZEROED

It used to be the case that ext2fs_set_gdt_csum set the ITABLE_ZEROED
flag if the INODE_UNINIT is not set. This assumed that the only
caller of ext2fs_set_gdt_csum was e2fsck (which was not true), and
that e2fsck would take care of zeroing the inode table (whic was also
not true).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
sum.c
00a92841c28123e67e3d10646f9d87d754337f9a 20-Apr-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Initialize s_min_extra_isize and s_wanted_extra_isize

Set the s_min_extra_isize and s_wanted_extra_isize superblock fields
to reasonable defaults in ext2fs_initialize().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
c21ed7705be908a5697095e597849804302edd21 08-Apr-2008 Eric Sandeen <sandeen@redhat.com> Make extent_goto() deterministic when logical block not found

Make sure that extent_goto() leaves us at the last extent
prior to the requested logical block, if the logical block
requested lands in a hole.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
5e057d5cad3e0f3bd9faa3c1124a3a592cb32919 08-Apr-2008 Eric Sandeen <sandeen@redhat.com> Fix ext2fs_extent_insert when at last extent in node

ext2fs_extent_insert() only did a memmove if path->left
was > 0, but if we are at the last extent in the node,
path->left == 0, and this node must be moved before the
current extent is replaced with the newly inserted node.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
xtent.c
108e62e3162fddd423e877dda8faebe8bd96ead5 08-Apr-2008 Eric Sandeen <sandeen@redhat.com> print a bit more info for the tst_extents info command

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
daf7a6e5d1621d4d84feabedb286e23dc5ad7dbb 17-Apr-2008 Theodore Ts'o <tytso@mit.edu> Fix tst_extents build when building w/o dynamic libraries

$(LIBSS) should automatically include @DLOPEN_LIB@ so the right thing
happens for programs that need to use the ss library.

Reorder the library link order for tst_extents since the blkid library
uses libuuid functions.

Thanks to Eric Sandeen for pointing this problem out!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
1ca1059fd0126fd2c065f272a566c18f14bab16d 09-Apr-2008 Theodore Ts'o <tytso@mit.edu> Add support for the HUGE_FILE feature

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
b_inode.c
map.c
xpanddir.c
xt2_fs.h
xt2fs.h
_block.c
kdir.c
kjournal.c
ead_bb.c
es_gdt.c
01c196b4f121cb77f50b9af2c54838aa4c6e06a0 30-Mar-2008 Eric Sandeen <sandeen@redhat.com> Fix a couple of implicit function declarations

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>
itops.h
ae389208e974c97d69640c5cbb020de0f337e0f7 06-Apr-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
52bb0b050ab7001f92f8110c0167cedec53bdcb5 06-Apr-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix resize inode creation with non-standard s_first_data_block

Thanks to Max Lindner (lokimuh) for pointing this out.

I'm playing around a bit with ext2 and multi-user encryption and I
need space for my key management. So I set s_first_data_block to 4000
or something like that.

This way mke2fs segfaults when executing
ext2fs_create_resize_inode() because

blk_t goal = 3 + sb->s_reserved_gdt_blocks + fs->desc_blocks +
fs->inode_blocks_per_group;

will produce a integer underrun later and segfault then in the
ext2fs_test_bit assembler inline function.

when exchanging 3 with 2 + sb->s_first_data_block, mke2fs does not
segfault.

I'm not 100% sure if thats the correct way dealing with this issue
but I think its a proper solution.

Addresses-Sourceforge-Bug: #1935847

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
es_gdt.c
3541698f038aafe838dcb8154fac62237981052a 01-Apr-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix big-endian bug in tst_csum.c

It's not necessary to byte-swap the checksum.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
st_csum.c
4b57781f504a2dd3873eafdcd4e4a962825eed6b 01-Apr-2008 Theodore Ts'o <tytso@mit.edu> libext2fs: Make all test programs link only against the static library

This is needed so that all of the test programs compile correctly on
big-endian systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
6f19f44a4c180079b402070efa6733da02eaac3e 31-Mar-2008 Andreas Dilger <adilger@dilger.ca> libext2fs: Micro-optimization in inode scan code

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
node.c
f628acea2671dda839fc086f1017718e41e34eca 31-Mar-2008 Andreas Dilger <adilger@dilger.ca> 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>
sum.c
xt2fs.h
d78ea441a2e52f776cc192cc7d1d8b3be2abd971 31-Mar-2008 Andreas Dilger <adilger@dilger.ca> 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>
sum.c
80fc4e698a308de22ace6179f45e0bb67befa74b 31-Mar-2008 Andreas Dilger <adilger@dilger.ca> 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>
sum.c
02a73f12df0dbc3636e6fe1b952e438737937669 30-Mar-2008 Andreas Dilger <adilger@dilger.ca> 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>
st_csum.c
d89ad0aefd5a38b401d945998a5b65de75d828f6 25-Mar-2008 Eric Sandeen <sandeen@redhat.com> 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>
akefile.in
fb6627a3fb4fbcb6904716c7a59e5ef9eb5dfafb 24-Mar-2008 Eric Sandeen <sandeen@redhat.com> 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>
wapfs.c
85b59c40f4b37e43e58aef188b07a3b6678ce782 19-Mar-2008 Eric Sandeen <sandeen@redhat.com> 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>
xtent.c
d4f34d41be97e23db07d5ed606fcc1a26f5a3c76 22-Oct-2007 Jose R. Santos <jrs@us.ibm.com> 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>
akefile.in
lloc_stats.c
lloc_tables.c
xt2fs.h
nitialize.c
node.c
penfs.c
w_bitmaps.c
ca2634a46ab9da85a3a015a7772770d9dbe5848e 22-Oct-2007 Jose R. Santos <jrs@us.ibm.com> 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>
akefile.in
rc16.c
rc16.h
sum.c
xt2_fs.h
xt2fs.h
st_csum.c
2d328bb76d2d63bdfdba923b54c28bd686bd8fec 18-Mar-2008 Theodore Ts'o <tytso@mit.edu> Fix miscellaneous gcc -Wall warnings

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
map.c
losefs.c
blist.c
xt2fs.h
xtent.c
nd_block.c
penfs.c
a7c9cb7d0dc464eda26958595b728a6c3a4cacbc 02-Feb-2008 Andreas Dilger <adilger@sun.com> 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>
xt2_fs.h
xt2fs.h
60bbd1af533daf8c726d6e5e4f17b293494bd939 13-Mar-2008 Theodore Ts'o <tytso@mit.edu> 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>
count.c
6567e5a684610832962a951a50712574eff59808 15-Mar-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint'
a80f3694a7b99756e747683f01ab8a5bca022251 15-Mar-2008 Theodore Ts'o <tytso@mit.edu> 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>
xt2_fs.h
82e541885ea912bc6764b97e2545f851cf7e3ff3 29-Feb-2008 Eric Sandeen <sandeen@redhat.com> 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>
wapfs.c
252b7363690e71bfd01517d6b348a5996d98ac7f 14-Mar-2008 Theodore Ts'o <tytso@mit.edu> 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>
xtent.c
83d9be1d5daf170066dd0e74afdd8e7063c1855e 14-Mar-2008 Theodore Ts'o <tytso@mit.edu> 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>
xtent.c
51b263e3690ba3136fe63e5c722e0593772620e2 03-Mar-2008 Jose R. Santos <jrs@us.ibm.com> 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>
node_io.c
59ecd32dcb1d890bd52444c7cdeaabf8d9b2dbd1 03-Mar-2008 Jose R. Santos <jrs@us.ibm.com> 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>
nix_io.c
3154e1cceb9f49bd3898e9a91723141af55cdd36 03-Mar-2008 Jose R. Santos <jrs@us.ibm.com> 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>
xt2_io.h
a040a99b6cc4bf9f10d39747ca6947f0462a2eb2 13-Mar-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint'

Conflicts:

lib/ext2fs/ext2_err.et.in
52b1dd5e496c199e9cbcc238f26fd2264a07a2cf 13-Mar-2008 Theodore Ts'o <tytso@mit.edu> 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>
blist.c
xt2_err.et.in
xt2fs.h
a49670e64e28ac3b15e36cb6bd0a8135d3ecdbbb 28-Feb-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint'

Conflicts:

lib/blkid/devname.c
lib/blkid/probe.c
misc/mke2fs.c
misc/tune2fs.c
ab52e12a904b4a31fc3416f0ef7d959f0c38e773 27-Feb-2008 Theodore Ts'o <tytso@mit.edu> 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>
xt2fs.h
penfs.c
e6bbc002c5a3d30df156d4f23bc93a7f2dbde3a1 21-Feb-2008 Valerie Clement <valerie.clement@bull.net> Add missing shift for ei_leaf_hi

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xtent.c
d46d67a84530e203e8bfa659370b720b17e3f30c 21-Feb-2008 Valerie Clement <valerie.clement@bull.net> 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>
xtent.c
7a3e1b7bff8c6734921ca80401a6377e070a7cb1 19-Feb-2008 Theodore Ts'o <tytso@mit.edu> 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>
lloc.c
0157e7c635c845c0e636576206718d8abaf70e08 19-Feb-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
0c17cb25f24730dca138a976a390f105d2191736 19-Feb-2008 Theodore Ts'o <tytso@mit.edu> 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>
nitialize.c
fefaef39e046781ddc75d15a8f12369f17dbd17d 02-Feb-2008 Andreas Dilger <adilger@sun.com> 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>
xt2fs.h
xt_attr.c
wapfs.c
15d482ba6e46b6979d8d9e9b3b28e0942b626c2e 21-Aug-2007 Theodore Ts'o <tytso@mit.edu> e2fsck: Add support for extents

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
cc9bf5d246fc23267e14cc328728f146aee142e2 18-Feb-2008 Theodore Ts'o <tytso@mit.edu> Add read/only support for extents to ext2fs_bmap()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
xt2fs.h
206fea69f8624843c2ffd32bab171059ec137780 04-Feb-2008 Theodore Ts'o <tytso@mit.edu> Add read-only extents support to ext2fs_block_iterate2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lock.c
xt2_err.et.in
3eb07f649350acfd9e145584d57aac3c1b65d0ba 15-Oct-2007 Theodore Ts'o <tytso@mit.edu> Add support for extents to libext2fs

Initial implemenation of extents support in libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
xt2_err.et.in
xt2fs.h
xt3_extents.h
xtent.c
xtent_dbg.ct
4ce3b77480496a20cf380bd18a8ae4a414b7d4a0 01-Sep-2007 Theodore Ts'o <tytso@mit.edu> 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>
wapfs.c
bbf54adb034dbf589d40c4b28c9bb7fe492b87ed 17-Feb-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next
3eed36b25409dea0cc41c001766456026b5504c8 17-Feb-2008 Theodore Ts'o <tytso@mit.edu> 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>
db.c
db.h
db/build-tdb
db/patches/copyright
db/patches/ext2tdb-rename
db/patches/replace-includes
db/patches/static-functions
db/patches/static-prototypes
db/patches/tdbtool-includes
e7cc6f7d0b86d76963058ef099ca553da29d2c3f 16-Feb-2008 Christophe GRENIER <grenier@cgsecurity.org> 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>
db.c
357d1863d64ce807c2904e101fc87d3f6be2f3ca 03-Feb-2008 Theodore Ts'o <tytso@mit.edu> 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>
lock.c
ir_iterate.c
xt2_err.et.in
xt2fs.h
ead_bb.c
428f6b32a9029e1f0bc2559233954955a6aae64c 28-Jan-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:

configure
lib/ext2fs/ext2_fs.h
misc/e2image.c
c2dbc18a9425815b6e93eb8b95d05a1168fb6e23 27-Jan-2008 Theodore Ts'o <tytso@mit.edu> Use lseek() instead of llseek() of sizeof(long) == sizeof(long long)

Previously we used a hard-coded test where for the Alpha and the IA64,
we used lseek instead of llseek(). Generalize this to whenver
sizeof(long) is the same as sizeof(long long).

It turns out this fixes a FTBFS problem on the x86_64 for Debian,
since dietlibc doesn't provide llseek() on that architecture.

Addresses-Debian-Bug: #459614

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lseek.c
6cb27404f51f97e2665fa0e0c4c0f7bc47e698ec 27-Jan-2008 Theodore Ts'o <tytso@mit.edu> Add support for the test_fs flag

The test_fs flag is an "ok to be used with test kernel code" flag. It
makes it easier for us to determine whether a filesystem should be
mounted using ext4 or not.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
nitialize.c
153439222e6a16e40be324408d8d19361bc1e65e 21-Jan-2008 Theodore Ts'o <tytso@mit.edu> Define helper functions ext2fs_set_i_{u,g}id_high() for MacOS compatibility

This is needed for all non-Linux/Hurd/Masix systems...

Addresses-Sourceforge-Bug: #1863819

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
fef2b38d8e5b475655771f8208265a8fa9246601 01-Jan-2008 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:

configure
debian/rules
e2fsck/swapfs.c
lib/ext2fs/ext2_fs.h
7132d48d83f79992773b6d9f1cace8d96366f08b 01-Jan-2008 Theodore Ts'o <tytso@mit.edu> Fix build failure on non-Linux/non-Hurd/non-Masix systems

The previous fix didn't quite work, but this one should!

Addresses-Sourceforge-Bug: #1861633

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
3306861158a1ca27b7ec83bb33fb8fbbf043d24c 30-Dec-2007 Theodore Ts'o <tytso@mit.edu> Fix build failure on non-Linux/non-Hurd/non-Masix systems

inode_uid() and inode_gid() weren't getting defined on systems that
were not Linux, Hurd, or Masix.

Addresses-Sourceforge-Bug: #1859778

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
e5aace908e9d1161a594944d9360f9f0cdd18099 27-Dec-2007 Theodore Ts'o <tytso@mit.edu> Convert use of ext2fs_get_mem to ext2fs_get_array for overflow detection

Add some additional checks, primarily in resize2fs and in the rarely
used (and soon to-be-deprecated) e2fsck byte-swap filesystem function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
3166c58dc0e2be55c9414e019607902c85485e83 18-Dec-2007 Theodore Ts'o <tytso@mit.edu> Add #define needed for Hurd ioctl definitions

Addresses-Debian-Bug: #437720

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_fs.h
b689b8dd14e69c652d2c8211bdef3effe81cfd65 17-Dec-2007 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:

lib/ext2fs/closefs.c
9a083af71a2388ae47252f8af2b796f9055f4af7 16-Dec-2007 Theodore Ts'o <tytso@mit.edu> ext2fs_flushfs: Remove the NEEDS_RECOVERY from the backup superblocks

Now that e2fsck tries to backup the primary superblock to the backups
when the feature sets ar different, it's important when tune2fs writes
out a changed superblock, that we filter out the
EXT3_FEATURE_INCOMPAT_RECOVER feature to the backup superblocks, since
it will be removed from the primary superblock either when the
filesystem is mounted uncleanly or when journal is replayed.

Addresses-Debian-Bug: #454926

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
e6a4571eec5ce0e75fb8a5a41c30bf0e68d90efe 09-Dec-2007 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint' into next

Conflicts:

lib/ext2fs/closefs.c
ee01079a17bfecd17292ccd60058056fb3a8ba6c 10-Nov-2007 Theodore Ts'o <tytso@mit.edu> libext2fs: Add checks to prevent integer overflows passed to malloc()

This addresses a potential security vulnerability where an untrusted
filesystem can be corrupted in such a way that a program using
libext2fs will allocate a buffer which is far too small. This can
lead to either a crash or potentially a heap-based buffer overflow
crash. No known exploits exist, but main concern is where an
untrusted user who possesses privileged access in a guest Xen
environment could corrupt a filesystem which is then accessed by the
pygrub program, running as root in the dom0 host environment, thus
allowing the untrusted user to gain privileged access in the host OS.

Thanks to the McAfee AVERT Research group for reporting this issue.

Addresses CVE-2007-5497.

Signed-off-by: Rafal Wojtczuk <rafal_wojtczuk@mcafee.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
adblocks.c
b_inode.c
lock.c
map.c
move.c
rel_ma.c
losefs.c
blist.c
upfs.c
xt2fs.h
ileio.c
count.c
nitialize.c
node.c
rel_ma.c
penfs.c
es_gdt.c
7e5a86a66044c4bf4021d1e2900a8748011f17b5 01-Dec-2007 Theodore Ts'o <tytso@mit.edu> libext2fs: Fix a corner case bug in ext2fs_unlink

We cannot merge a removed directory entry to just arbitrary previous
directory entry. The previous entry must be in the same block. So
really bad things can happen when are deleting the first directory
entry in a block where the last directory entry in the previous
directory block is not in use. We fix this bug by checking to see if
the current entry is not the first one in the block before trying to
merge it to the previous entry.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nlink.c
8cdd6a6f34a66806fb200f2a55c8fa4142d79511 09-Nov-2007 Andreas Dilger <adilger@sun.com> fix check_mntent_file() to pass mode for open(O_CREAT)

On my FC8 install, ismounted.c fails to build because open(O_CREAT) is
used without passing a mode. The following trivial patch fixes it.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
smounted.c
5ea565fd37821b2708c2b7f1e49fe6fc94587794 04-Nov-2007 Theodore Ts'o <tytso@mit.edu> Merge basic FLEX_BG support

Merge commit 'c2d4300b8a4a13d8a78b86c386f76259f23feec2' into next
c2d4300b8a4a13d8a78b86c386f76259f23feec2 14-Aug-2007 Jose R. Santos <jrs@us.ibm.com> Enable FLEX_BG feature support

Add FLEX_BG as a supported feature bit.

Add support to mke2fs to create filesystems with FLEX_BG.

Add support to tune2fs to add (and remove, if it won't break
filesystem consistency) the FLEX_BG feature.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
--

lib/e2p/feature.c | 2 ++
lib/ext2fs/ext2fs.h | 6 ++++--
misc/mke2fs.c | 7 ++++++-
3 files changed, 12 insertions(+), 3 deletions(-)
xt2fs.h
88b34b1f87c2d7c3dfc9be7ff6e5d916f06d960a 14-Aug-2007 Jose R. Santos <jrs@us.ibm.com> Relax group descriptor checking for FLEX_BG

The FLEX_BG feature allows the inode table, block bitmap, and inode
bitmaps to be located anywhere in the filesystem. Update e2fsck and
libext2fs's checking code to recognize this.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
--

e2fsck/super.c | 14 ++++++++++++--
lib/ext2fs/check_desc.c | 15 +++++++++++++--
2 files changed, 25 insertions(+), 4 deletions(-)
heck_desc.c
4d5cb2ac91a79e491c1b01ea58d1a5bf1ad98f22 22-Oct-2007 Jose R. Santos <jrs@us.ibm.com> lib/ext2fs/Makefile.in: Reorder some of the $(SRCS) in alphabetical order.

All files under $(OBJS) and $(SRCS) should be in alphabetical order
but this is not always the case. Let fix some some of these before
applying new files to the list of $(SRCS).

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
--

lib/ext2fs/Makefile.in | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
akefile.in
cf0eeec0159b1af67fad9bccce220402cf08dff0 14-Aug-2007 Jose R. Santos <jrs@us.ibm.com> Reserve the INCOMPAT feature number for FLEX_BG.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
--

lib/ext2fs/ext2_fs.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
xt2_fs.h
d9099eec8e8f801932f01b707513b330908080d7 01-Nov-2007 Theodore Ts'o <tytso@mit.edu> Merge branch 'cl/remove-masix' into next
c9548bc37e5d0f55308ebbb74b1e19ce7f88ada1 23-Aug-2007 Coly Li <coyli@suse.de> libext2fs: remove masix support

This patch remove masix support from lib/ext2fs.

Signed-off-by: Coly Li <coyli@suse.de>
xt2_fs.h
wapfs.c
d9039ae0ff3f7929ede576058b3ad3e9c62a47c4 20-Oct-2007 Dmitry V. Levin <ldv@altlinux.org> Check fgets(3) return value

When fgets() function fails, contents of the buffer is undefined. That
is, fgets() return value needs to be checked, to avoid undefined behavior.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
smounted.c
f2de1d38d0819b17895977fabc52d81d0ea6ec00 30-Aug-2007 Valerie Clement <valerie.clement@bull.net> libext2fs: Add EXT2_DESC_SIZE and EXT2_DESC_PER_BLOCK macros

Add macros to support variable-length group descriptors for ext4.

Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2_fs.h
nitialize.c
penfs.c
5d38ef1d049bf56d1c1e88b8b4d287c0f9470e61 30-Aug-2007 Valerie Clement <valerie.clement@bull.net> libext2fs: cleanup usage of unsigned int or __u32 and replace it with blk_t

Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
xt2fs.h
3bfca9a499af9f72a2b22ff0d92bcc8686904e8e 30-Aug-2007 Valerie Clement <valerie.clement@bull.net> libext2fs: use ext2fs_group_first_block() instead of open-coded equivalent

Use ext2fs_group_first_block() instead of the open-coded equivalent in
ext2fs_super_and_bgd_loc() and ext2fs_descriptor_block_loc().

Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
losefs.c
penfs.c
eac91b35372c9affff6953165f34fe246272bef9 14-Oct-2007 Theodore Ts'o <tytso@mit.edu> Add blk64_t type definition

This will be used for all new functions so we can gradually move
e2fsprogs to support 64 bit blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
2628a1d3e1e581512d136486768685542d2649b1 06-Oct-2007 Theodore Ts'o <tytso@mit.edu> Merge branch 'maint'
f6341e9c70eb4e0ded51ca96aeaa79a72222c069 23-Sep-2007 Theodore Ts'o <tytso@mit.edu> ext2fs_dblist_dir_iterate: Fix ABORT propagation logic

ext2fs_dblist_dir_iterate() calls ext2fs_dblist_iterate(), which calls
ext2fs_process_dir_block(), which in turn calls the helper function
db_dir_proc() which calls callback function passed into
ext2fs_dblist_dir_iterate(). At each stage the conventions for
signalling requests to abort the iteration or to signal errors
changes, db_dir_proc() was not properly mapping the abort request back
to ext2fs_dblist_iterate().

Currently db_dir_proc() is ignoring errors (i/o errors or directory
block corrupt errors) from ext2fs_process_dir_block(), since the main
user of ext2fs_dblist_dir_iterate() is e2fsck, for which this is the
correct behavior. In the future ext2fs_dblist_dir_iterate() could
take a flag which would cause it to abort if
ext2fs_process_dir_block() returns an error; however, it's not clear
how useful this would be since we don't have a way of signalling the
exact nature of which block had the error, and the caller wouldn't
have a good way of knowing what percentage of the directory block list
had been processed. Ultimately this may not be the best interface for
applications that need that level of error reporting.

Thanks to Vladimir V. Saveliev <vs@clusterfs.com> for pointing out
this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
blist_dir.c
ba9d929d914654f8dba36c634bb537ecf0f0bb04 07-Sep-2007 Theodore Ts'o <tytso@mit.edu> Don't crash if s_inode_size is zero

Any attempt to open a filesystem with s_inode_size set to zero causes
a floating point exception. This is true for e2fsck, dumpe2fs,
e2image, etc. Fix ext2fs_open2() so that it returns the error code
EXT2_ET_CORRUPT_SUPERBLOCK instead of crashing.

Thanks to Dean Bender for reporting this bug.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
penfs.c
a5dda0542283d0674f42a0d1b04d33888f512eab 11-Aug-2007 Theodore Ts'o <tytso@mit.edu> Remove configure --enable-swapfs and associated support #defines

This removes the last vestiges of support for the legacy PowerPC
big-endian filesystem format.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
itops.h
xt2fs.h
wapfs.c
126a291c768b523bc228b276d3bea82675a86d09 11-Aug-2007 Theodore Ts'o <tytso@mit.edu> Clean up libext2fs by byte swapping iff WORDS_BIGENDIAN

We don't need byte swapping to be a run-time option; it can just be a
compile-time option instead.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
map.c
losefs.c
irblock.c
xt_attr.c
nd_block.c
node.c
penfs.c
ccbcc40e3b90ea142766d1fec75a68c47228c087 11-Aug-2007 Theodore Ts'o <tytso@mit.edu> Remove PowerPC bitmap hackery since it's not been needed since Linux 2.1

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
w_bitmaps.c
6d96b00d57d236e2746f8245df6c8ea64abc64c1 04-Aug-2007 Theodore Ts'o <tytso@mit.edu> Add I/O statistics to e2fsck

This patch instruments the libext2fs unix I/O manager and adds bytes
read/written and data rate to e2fsck -tt pass/overall timing output.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2_io.h
est_io.c
nix_io.c
f1f115a78f5ea599fc5f8815a741d43fedd5840d 23-Jul-2007 Theodore Ts'o <tytso@mit.edu> libext2fs: 32-bit bitmap refactorization, part 3

Create new functions ext2fs_{set,get}_{inode,block}_bitmap_range()
which allow programs like e2fsck, dumpe2fs, etc. to get and set chunks
of the bitmap at a time.

Move the representation details of the 32-bit old-style bitmaps into
gen_bitmap.c.

Change calls in dumpe2fs, mke2s, et. al to use the new abstractions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itmaps.c
xt2fs.h
en_bitmap.c
mager.c
w_bitmaps.c
50448d3dffc66f86592ee0d4b16e4bbe9d08449e 23-Jul-2007 Theodore Ts'o <tytso@mit.edu> libext2fs: 32-bit bitmap refactorization, part 2

Move the contents of rs_bitmap.c and cmp_bitmaps.c into gen_bitmap.c
and bitmaps.c.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
itmaps.c
mp_bitmaps.c
xt2fs.h
en_bitmap.c
s_bitmap.c
a0553c9d6e8dd6f538f18ae447c45e52f3c40eb6 23-Jul-2007 Theodore Ts'o <tytso@mit.edu> libext2fs: 32-bit bitmap refactorization, part 1

Move the 32-bit specific bitmap code into gen_bitmap.c, and the
high-level interfaces into bitmaps.c. Eventually we'll move the
new-style bitmap code into gen_bitmap64.c, but first we need to
isolate the code with knowledge of the bitmap internals in one place
first.

In this patch we move allocation, free, copy, clear, set_padding, and
fudge_end function into gen_bitmap.c, and make sure that the bitmaps.c
and bitops.c no longer have any knowledge of the bitmap internals.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
akefile.in
itmaps.c
itops.c
xt2fs.h
reefs.c
en_bitmap.c
271a375b596240866b4a2967e3b6f38ff7cecdf8 23-Jul-2007 Theodore Ts'o <tytso@mit.edu> Move ext2fs_get_{block,inode}_bitmap_{start,end}() to generic functions

Create ext2fs_get_generic_bitmap_{start,end}() and use them for inline
functions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
en_bitmap.c
8df1827b55f11321bfe508c89b94591bdb97c3a6 23-Jul-2007 Theodore Ts'o <tytso@mit.edu> Uninline ext2fs_{mark,unmark,test}_block_bitmap_range() to gen_bitmap.c

Also uninline ext2fs_fast_{mark,unmark,test}_block_bitmap_range() and
use the generic routines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
en_bitmap.c
7bf257a9a07d6067fba43ba05f25b3de0436d59c 22-Jul-2007 Theodore Ts'o <tytso@mit.edu> Change fast ext2fs bitmap functions to use the generic bitmap functions

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>
itops.h
b15beaaf386a13d9fbaf716aac2df44748261af1 22-Jul-2007 Theodore Ts'o <tytso@mit.edu> Move ext2fs_test_generic_bitmap() to gen_bitmap.c

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
itops.h
en_bitmap.c
bd828a27e2cfec9f14837d9a693e2a414f44bf91 20-Jul-2007 Eric Sandeen <sandeen@redhat.com> Fix test in ext2fs_check_desc() for inode table within block group

The test in ext2fs_check_desc() is off by one; if the inode table
goes all the way to the last block of the block group, it will
falsely assert that it has extended past it. The last block
of a range is start + len -1, not start + len.

You can create (valid) filesystems that will cause e2fsck to complain
via one of the following mkfs commands:

mkfs.ext3 -F -b 1024 /dev/sdb1 2046000000
mke2fs -j -F -b 4096 -m 0 -N 5217280 /mnt/test/fsfile2 327680
mkfs.ext2 -F -b 1024 -m 0 -g 256 -N 3744 fsfile 1024

Addresses-Red-Hat-Bugzilla: #214765

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
heck_desc.c
5a92a627f1e067ecfaa2478cfafeca2817cdc69f 22-Jul-2007 Theodore Ts'o <tytso@mit.edu> Properly calculate overhead in ext2fs_initialize()

For some odd geometries*, mkfs will try to allocate inode tables off
the end of the block group and fail, rather than warning that too
many inodes have been requested.

This is because when ext2fs_initialize calculates metadata overhead,
it is only adding in group descriptor blocks and the superblock
if the *last* bg contains them - but the first bg also has all of
the various metadata bits taking up space.

We need to calculate the overhead both for the first block group and
the last block groups separately, since the two different tests need
to know what the overheads are for those two cases, which may be
different.

*for example "mke2fs -b 1024 -m 0 -g 256 -N 3745 fsfile 1024"

(Note, the test here is a little funky; the expected output is
actually a mkfs failure - but a proper failure instead of the
allocator catching the problem at the last minute)

Addresses-Red-Hat-Bugzilla: #241767

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
nitialize.c
db9097caca17401313c0dc840b4ae683e5b5c1df 18-Jul-2007 Eric Sandeen <sandeen@redhat.com> Fix big-endian byte-swapping bug in ext2fs_swap_inode_full()

We need to set t->i_file_acl before we test it in
ext2fs_inode_data_blocks()

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
wapfs.c
a2df22f1e938bbce844b75801106806b56c778b5 08-Jul-2007 Theodore Ts'o <tytso@mit.edu> Stop after the second '.' when parsing version numbers

Now that we are moving to x.y.z version number scheme for maintenance
releases, we ned to change ext2fs_parse_version_string and
blkid_parse_version_string to ignore the second period so we don't
have maintenance releases with a substantially bigger verison number
than the initial x.y release.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ersion.c
424a3e4a2367f582edeb062ab12f3f95fdf9e31b 08-Jul-2007 Theodore Ts'o <tytso@mit.edu> Remove Changelog files since they're not used after the git migration

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
becc39103749f73876108d3e1025f2354a22b613 30-Jun-2007 Theodore Ts'o <tytso@mit.edu> Release of e2fsprogs version 1.40

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
1ed49d2c2ab7fdb02158d5feeb86288ece7eb17c 30-Jun-2007 Kalpak Shah <kalpak@clusterfs.com> Fix byte swapping bug in get_next_inode_full()

On big-endian systems, while swapping, ext2fs_swap_inode_full() swaps
only 128+extra_isize bytes and the EAs if they are present. Now if inode
N has EAs, (and this is the inode in the "scratch inode") then inode N+1
also carries seems to have them since the "scratch inode" was never
zeroed.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
node.c
d7b64725eecb06b2bbc5e90dc338d8d08152a932 24-Jun-2007 Theodore Ts'o <tytso@mit.edu> Update Release Notes, Changelogs, version.h, etc. for 1.40 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
915a2669ef3b886bfe848108d237fef6f9fbe1bf 23-Jun-2007 Kalpak Shah <kalpak@clusterfs.com> Fix ext2fs_read_inode_full() so that the whole inode is byte-swapped

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
node.c
c844010cc41e4c293b652d252145df12448e22c6 23-Jun-2007 Theodore Ts'o <tytso@mit.edu> Fix byte-swapping issues for the i_extra_size field

Thanks to Andreas Dilger and Kalpak Shah for spotting this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
wapfs.c
56d1236726d8e4624d2f3a2f4713864c1e66bb40 21-Jun-2007 Theodore Ts'o <tytso@mit.edu> Add default journal size function

Factor out the code which sets the default journal size and move it
into libext2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
xt2fs.h
kjournal.c
058ad1c70c9a097d282270c6f76d3c3493e15fe2 19-Jun-2007 Theodore Ts'o <tytso@mit.edu> Don't write changes to the backup superblocks by default

This patch changes ext2fs_open() to set EXT2_FLAG_MASTER_SB_ONLY by
default. This avoids some problems in e2fsck (reported by Jim Garlick)
where a corrupt journal can end up writing the bad superblock to the
backups. In general, only e2fsck (after the filesystem is clean),
tune2fs, and resize2fs should change the backup superblocks by default.
Most callers of ext2fs_open() should not be touching anything where the
backups should be touched. So let's change the defaults to avoid
potential problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
penfs.c
a2b2ff61c88ac7583f288a1723d8195a0b7f2f83 31-May-2007 Theodore Ts'o <tytso@mit.edu> Add test to make sure the ext2 superblock structure is 1024 bytes

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
st_super_size.c
decb2a5b3a1e346ddb725a3ba01b759d8c9ee4e6 31-May-2007 Theodore Ts'o <tytso@mit.edu> Reserve superblock field for the raid stripe width.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
b62e88af6a1be97b224a3e5c1fea43fa173567ea 31-May-2007 Andreas Dilger <adilger@clusterfs.com> Reserve superblock fields for multiple mount protection feature

There have been reported instances of a filesystem having been mounted
at 2 places at the same time causing a lot of damage to the
filesystem. This patch reserves superblock fields and an INCOMPAT flag
for adding multiple mount protection(MMP) support within the ext4
filesystem itself. The superblock will have a block number
(s_mmp_block) which will hold a MMP structure which has a sequence
number which will be periodically updated every 5 seconds by a mounted
filesystem. Whenever a filesystem will be mounted it will wait for
s_mmp_interval seconds to make sure that the MMP sequence does not
change. To further make sure, we write a random sequence number into
the MMP block and wait for another s_mmp_interval secs. If the
sequence no. doesn't change then the mount will succeed. In case of
failure, the nodename, bdevname and the time at which the MMP block
was last updated will be displayed. tune2fs can be used to set
s_mmp_interval as desired.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
hangeLog
xt2_fs.h
de8f3a76218255e443ba57dec5d74850180fa75d 25-May-2007 Andreas Dilger <adilger@clusterfs.com> Fix gcc -Wall warnings, especially on 64-bit systems

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
count.c
st_bitops.c
st_types.c
96c6a3acd377698cb99ffd9925bec9b20ca4f6f9 19-May-2007 Theodore Ts'o <tytso@mit.edu> Store the RAID stride value in the superblock and take advantage of it

Store the RAID stride value when a filesystem is created with a requested
RAID stride, and then use it automatically in resize2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
penfs.c
5113a6e32b298671c86ae7da097bcd24540cebc9 08-May-2007 Eric Sandeen <sandeen@redhat.com> Fix mke2fs and debugfs to support large (> 16 bit) uid's and gid's

Mke2fs is supposed to set the uid/gid ownership of the root directory when
a non-rooot user creates the filesystem. This wasn't working correctly
if the uid/gid was > 16 bits. In additional, debugfs wasn't displaying
large uid/gid's correctly. This patch fixes these two programs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
d362a3fb7ec1a2b46601f55f4dbae83563c27717 19-Apr-2007 Theodore Ts'o <tytso@mit.edu> Define the l_i_iversion field in ext2_inode

The l_i_version field is now defined from the old l_i_reserved1 field in
the ext2 inode. This field will be used to store high 32 bits of the
64-bit inode version number.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
wapfs.c
d22c15a43efa348170c8425c5f6490686c6e9e43 19-Apr-2007 Theodore Ts'o <tytso@mit.edu> ext2fs_get_device_size(): Fix potential fd descriptor leak in an error case

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
etsize.c
3f4c46e3f9871011a3d4dffbf7a0beb35bd27d08 14-Apr-2007 Bryn M. Reeves <breeves@redhat.com> Correct byteswapping for fast symlinks with xattrs

Fix a problem byte-swapping fast symlinks inodes that contain extended
attributes.

Addresses Red Hat Bugzilla: #232663
Addresses LTC Bugzilla: #27634

Signed-off-by: "Bryn M. Reeves" <breeves@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
wapfs.c
a1f642728fe6fd2c361343fec349808ea8a524f4 07-Apr-2007 Theodore Ts'o <tytso@mit.edu> Fix memory leaks from using the tdb library

We weren't freeing allocated memory from calls to tdb_fetch, tdb_firstkey,
and tdb_nextkey. Oops.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
count.c
1b9d8cb7057387afae106ffa662613205f07e131 06-Apr-2007 Theodore Ts'o <tytso@mit.edu> Add support for using TDB to libext2fs's icount abstraction

Add support for using TDB to store the icount data, so we don't run out
of memory when checking really large filesystems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
count.c
47e90ebd348661ff0d3970ce0d57e6822e403f9f 06-Apr-2007 Theodore Ts'o <tytso@mit.edu> Add new TDB error codes

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_err.et.in
1cb78d8433af774864c9d62a246e5edbc612b123 06-Apr-2007 Theodore Ts'o <tytso@mit.edu> Add a regression test suite for libext2fs's icount abstraction

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
count.c
cc37e0d3ae12f47e77da25dea4d6a9439f489f67 06-Apr-2007 Jim Garlick <garlick@llnl.gov> Fix memory leak in ext2fs_write_new_inode()

The following patch addresses a memory leak in libext2fs
that occurs when using ext2fs_write_new_inode() on a file system
configured with large inodes.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
node.c
106ad96daee151064aa44a857f82ba10c8258b40 05-Apr-2007 Theodore Ts'o <tytso@mit.edu> Add tdb from Samba into libext2fs library.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
db.c
db.h
db/build-tdb
db/patches/copyright
db/patches/ext2tdb-rename
db/patches/replace-includes
db/patches/series
db/patches/static-functions
db/patches/static-prototypes
db/patches/tdbtool-includes
dbtool.c
4aec958561923bcfd138534d6ff64273b7427a9c 05-Apr-2007 Theodore Ts'o <tytso@mit.edu> Add #include's to avoid compiler warnings in lib/ext2fs/tst_types

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
st_types.c
641b66bc7ee0a880b0eb0125dff5f8ed8dd5a160 03-Apr-2007 Theodore Ts'o <tytso@mit.edu> Fix potential infinite loop in e2fsck on really big filesystems

Prevent floating point precision errors on really big filesystems from
causing the search interpolation algorithm in the icount abstraction
from looping forever.

Addresses Debian Bug: #411838

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
count.c
f93625b292e69e03755fd63cf3fa6f2cce14a344 21-Mar-2007 Brian Behlendorf <behlendorf1@llnl.gov> [COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_image_inode_write)

Use pre-existing early exit label in function to handle proper
error code return and local memory allocation cleanup.

Coverity ID: 23: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
hangeLog
mager.c
e649be9daaa1190258c7d5f6521f7be19b0bed28 21-Mar-2007 Brian Behlendorf <behlendorf1@llnl.gov> [COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_write_inode_full)

Need to free w_inode on early exit if w_inode != &temp_inode.

Coverity ID: 22: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
hangeLog
node.c
d2a3bf2ccc2df5167289e9fc084fec3cea78c950 30-Nov-2006 Theodore Ts'o <tytso@mit.edu> Fix (as yet unused) struct ext4_group_desc to add a missing bg_pad field

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
dec5cd13fff821d1d3f6a922fbd986b3a86abb77 15-Nov-2006 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall complaints in libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
itops.h
xt2_ext_attr.h
ernel-jbd.h
amei.c
2694f31946f0c168cc8d098f3970f0ae08d94e7b 14-Nov-2006 Theodore Ts'o <tytso@mit.edu> Fix type punning bugs in ext2fs_get_mem() and ext2fs_free_mem()

This was causing dumpe2fs to crash on the ARM platform when examining
the badblocks list.

Also reverts an incorrect fix made by changeset 38078f692c20

Addresses Debian Bug: #397044
hangeLog
adblocks.c
xt2fs.h
cf8272e1081f69d898d5182ed516e28807135dea 13-Nov-2006 Theodore Ts'o <tytso@mit.edu> Allow debugfs and dumpe2fs to support fs features under development

Add support for the new flag EXT2_FLAG_SOFTSUPP_FEATURES flag to
ext2fs_open() , which allows application to open filesystes with features
which are currently only partially supported by e2fsprogs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
penfs.c
89dd65704f4397c49d40ae8c171928831e6a74bf 13-Nov-2006 Theodore Ts'o <tytso@mit.edu> Check in ext4 extent headers into the source tree

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
xt2fs.h
xt3_extents.h
413a78f657d0f095037ea60eb0236a28da1f7e7f 13-Nov-2006 Theodore Ts'o <tytso@mit.edu> Work around GCC bug on the Arm platform

Addresses Debian Bug: #397044

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
adblocks.c
2aee23f325037fce1db32d556e6cf9adaa97ce04 12-Nov-2006 Theodore Ts'o <tytso@mit.edu> Allow unix_io offsets greater than 2G

Addresses SourceForge Bug: #1547922

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
nix_io.c
f77704e416fca7dbe4cc91abba674d2ae3c14f6f 12-Nov-2006 Theodore Ts'o <tytso@mit.edu> Add directory hashed signed/unsigned hint to superblock

The e2fsprogs and kernel implementation of directory hash tree has a
bug which causes the implementation to be dependent on whether
characters are signed or unsigned. Platforms such as the PowerPC,
Arm, and S/390 have signed characters by default, which means that
hash directories on those systems are incompatible with hash
directories on other systems, such as the x86.

To fix this we add a new flags field to the superblock, and define two
new bits in that field to indicate whether or not the directory should
be signed or unsigned. If the bits are not set, e2fsck and fixed
kernels will set them to the signed/unsigned value of the currently
running platform, and then respect those bits when calculating the
directory hash. This allows compatibility with current filesystems,
as well as allowing cross-architectural compatibility.

Addresses Debian Bug: #389772

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
irhash.c
xt2_fs.h
nitialize.c
wapfs.c
6b3ce9871c3424d0b41e0c7227ddc116d2e0de1a 11-Nov-2006 Theodore Ts'o <tytso@mit.edu> On-disk format for controlling the inode size

- EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE (0x0040?) - add s_min_extra_isize and
s_want_extra_isize fields to superblock, which allow specifying
the minimum and desired i_extra_isize fields in large inodes
(for nsec+epoch timestamps, potential other uses). Needs RO_COMPAT
flag handling, needs e2fsck support, patch complete, little testing.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
wapfs.c
8061d2c144bf22ce3e170e40a194932da4baf8fb 11-Nov-2006 Theodore Ts'o <tytso@mit.edu> On-disk format definition for 64-bit support

- EXT4_FEATURE_INCOMPAT_64BIT (0x0080) - support for 64-bit block count
fields in the superblock (s_blocks_count_hi, s_free_blocks_count_hi),
large group descriptors (s_desc_size), extents with high 16 bits
(ee_start_hi, ei_leaf_hi), inode ACL (i_file_acl_hi). May also grow
to encompass the previously proposed BIG_BG.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
wapfs.c
bec6f49a46ec78a4c5928a22214848a7ea654704 11-Nov-2006 Theodore Ts'o <tytso@mit.edu> On-disk format for large number of subdirectories

- EXT4_FEATURE_RO_COMPAT_DIR_NLINK (0x0020?) - allow directories to have
> 65000 subdirectories (i_nlinks) by setting i_nlinks = 1 for such
directories. RO_COMPAT protects old filesystems from unlinking such
directories incorrectly and losing all files therein.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
8815fb8a00f5a441eb62f035353db9e0cca90b38 11-Nov-2006 Theodore Ts'o <tytso@mit.edu> On-disk format definition for group descriptor checksums

- EXT4_FEATURE_RO_COMPAT_GDT_CSUM (0x0010?) - store a crc16 checksum in
the group descriptor (s_uuid[16] | __u32 group | ext3_group_desc
(excluding gd_checksum itself)). This allows the kernel to more safely
manage UNINIT groups.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
wapfs.c
5d17119d14fe1276936c85d7986695a4543b1aa1 11-Nov-2006 Theodore Ts'o <tytso@mit.edu> On-disk format definition for huge files

- EXT4_FEATURE_RO_COMPAT_HUGE_FILE (0x0008) - change i_blocks to be
in units of s_blocksize units instead of 512-byte sectors, use
l_i_frag and l_i_fsize as i_blocks_hi (could also be part of 64BIT).

E2fsck and debugfs changed to support i_blocks_hi instead of l_i_frag and
l_i_fsize.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
wapfs.c
3efc3a04fc77bf53d5d1ad433144b82b441e0806 02-Oct-2006 Eric Sandeen <esandeen@sandeen.net> Check for potential 64-bit overflow in ext2fs_get_device_size()

Check for potential overflow for filesystems contained in regular files
where the filesystem image size is returned by stat64().

Signed-off-by: Eric Sandeen <esandeen@sandeen.net>
hangeLog
etsize.c
fa2d516fb353d3dba3a6b0dad309d8ea76a2e15c 02-Oct-2006 Theodore Ts'o <tytso@mit.edu> Fix build problem if byte swapping has been disabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
itops.h
f335864338a6fbce8134a445ffdd0cdeb3f3f1bc 12-Sep-2006 Eric Sandeen <esandeen@redhat.com> Add checks to make sure inode counts don't overflow a 32-bit value

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
nitialize.c
abf23439d51a3ddbca475b931abebd381ff7ceea 12-Sep-2006 Eric Sandeen <esandeen@redhat.com> Create new ext2fs library inlines: ext2fs_group_{first,last}_block()

Create new ext2fs library inline functions in order to calculate
the starting and ending blocks in a block group.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
lloc_tables.c
heck_desc.c
xt2fs.h
d0ff90d5202428583c78a60c3042e7b60d88bc45 12-Sep-2006 Eric Sandeen <esandeen@redhat.com> Fix signed vs unsigned printf format strings for block and inode numbers

There were still some %d's lurking when we print blocks & inodes; also
many of the counters in the e2fsck_struct were signed, and probably
need to be unsigned to avoid overflows.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
move.c
etsize.c
count.c
st_badblocks.c
st_getsize.c
st_iscan.c
nix_io.c
rite_bb_file.c
62c6d1403ea00dd72890862c761a41baa10a7ad4 12-Sep-2006 Eric Sandeen <esandeen@redhat.com> Remove unused variables

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
losefs.c
nitialize.c
bb1a46a430a99f73ddaf7cf74e380dd5cf36382f 12-Sep-2006 Eric Sandeen <esandeen@redhat.com> Fix loops over group descriptors to prevent 2**32-1 block number overflows

For loops iterating over all group descriptors, consistently define
first_block and last_block in a way that they are inclusive of the
range, and do not overflow.

Previously on the last block group we did a test of <= first +
dec_blocks; this would actually wrap back to 0 for a total block count
of 2^32-1

Also add handling of last block group which may be smaller.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
heck_desc.c
5830d6be9c33e23bb20c339036083e6e4fa6795e 30-Aug-2006 Eric Sandeen <esandeen@redhat.com> Detect overflows in loop counters

For loops such as:

for (i=1; i <= fs->super->s_blocks_count; i++) {
<do_stuff>
}

if i is an int and s_blocks_count is (2^32-1), the condition is never false.
Change these loops to:

for (i=1; i <= fs->super->s_blocks_count && i > 0; i++) {
<do_stuff>
}

to stop the loop when we overflow i

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
itmaps.c
69022e029f3273b3b860bf701219cd3fe615f76b 30-Aug-2006 Theodore Ts'o <tytso@mit.edu> Fix potential 2**32-1 overflow problems by ext2fs_div_ceil()

Add a new function, ext2fs_div_ceil(), which correctly calculates a division
of two unsigned integer where the result is always rounded up the next
largest integer. This is used everywhere where we might have
previously caused an overflow when the number of blocks
or inodes is too close to 2**32-1.

Based on patches from Eric Sandeen, but generalized to use this new function

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
hangeLog
xt2fs.h
nitialize.c
penfs.c
a62e3f0378d2a9b861fc4809a810980c1c3bde35 06-Aug-2006 Andreas Dilger <adilger@clusterfs.com> Add 64-bit byte swapping functions

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
hangeLog
itops.h
8fe81a3d53fbaa1670ece5fb7fd11dd5ae45b8da 06-Aug-2006 Andreas Dilger <adilger@clusterfs.com> Rename EXT3_EXTENTS_FL to EXT4_EXTENTS_FL and make it visible to the user

lsattr will display the EXT4_EXTENTS_FL flag

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
067911ae734bb5fef7c5780a639533847b5b578c 16-Jul-2006 Andreas Dilger <adilger@clusterfs.com> Allow default inode_size to be specified in mke2fs.conf and document mke2fs -I

This patch allows "inode_size" to be specified in the mke2fs.conf file,
and always compiles in the "-I" option. In addition, it disallows
specifying the inode size on rev 0 filesystems, though I don't think
this was much of a danger anyways.

Clean up dead lines in ext2fs.h.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
347e52de90c736e113fc4e4aff5190e10d327606 28-Jun-2006 Andreas Dilger <adilger@clusterfs.com> Protect ext2_ext_attr.h from multiple inclusion

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
xt2_ext_attr.h
df3e159870beae4b02f1f59bf2a28e3e0fdd6519 30-May-2006 Matthias Andree <matthias.andree@gmx.de> Add missing #include <ctype.h>.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
etsize.c
406ba674fe33469c600a4dd7ed5853cac34ca4e7 30-May-2006 Matthias Andree <matthias.andree@gmx.de> Fix non-Linux compiler warning (missing return statement).

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
smounted.c
85f93ffdc48f19bed280931b00e41039ee696637 22-May-2006 Theodore Ts'o <tytso@mit.edu> Fix type warning problem with sizeof() in ext2fs_open2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
penfs.c
bc2699f018586f21825e056eb6053686c23804fe 13-May-2006 Theodore Ts'o <tytso@mit.edu> Change mke2fs's layout of RAID-optimized filesystems to be more optimal

When allocating space for the RAID filesystems with the stride parameter,
place each portion of the group's inode table right up after the superblock
(if present) in order to minimize fragmentation of the freespace.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
lloc_tables.c
f5fa20078bfc05b554294fe9c5505375d7913e8c 09-May-2006 Theodore Ts'o <tytso@mit.edu> Add support for EXT2_FEATURE_COMPAT_LAZY_BG

This feature is initially intended for testing purposes; it allows an
ext2/ext3 developer to create very large filesystems using sparse files
where most of the block groups are not initialized and so do not require
much disk space. Eventually it could be used as a way of speeding up
mke2fs and e2fsck for large filesystem, but that would be best done by
adding an RO_COMPAT extension to the filesystem to allow the inode table
to be lazily initialized on a per-block basis, instead of being entirely initialized
or entirely unused on a per-blockgroup basis.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
xt2fs.h
node.c
w_bitmaps.c
wapfs.c
1f2da2c01108544b7ee7020bc6e3da1e58f29a3e 23-Apr-2006 Theodore Ts'o <tytso@mit.edu> Speed up mke2fs and e2fsck by writing bitmaps more efficiently

Reduce disk seeks by writing the inode and block bitmaps in an interleaved fashion.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
w_bitmaps.c
4ea7ea007bb227727ee1d4dca997c4f5b21d3a30 09-Apr-2006 Theodore Ts'o <tytso@mit.edu> Fix asm_types.h type conflicts

This caused FTBFS bugs on AMD64 platforms, since it uses a different
64-bit type when compared with IA64, so we need to make our
autoconfiguration system more intelligent.

Addresses Debian Bugs: #360661, #360317

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
xt2_types.h.in
st_types.c
cef2ac104d45c351344cd10ac1419ad5f6422d8b 05-Apr-2006 Theodore Ts'o <tytso@mit.edu> Fix ext2fs_add_journal_inode() when filesystem is opened in exclusive mode

If the filesystem is opened in exclusive mode, then device will be
busy by definition, so don't return -EBUSY. This caused mke2fs -j to
fail on the 1.39-WIP (29-Mar-2006) release. (Addresses Debian Bug:
#360652)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
kjournal.c
8ad26b08fac068f0c50d44a5072fb49ab7bedc78 29-Mar-2006 Theodore Ts'o <tytso@mit.edu> Fix the x86 asm constraints for ext2fs_set/clear_bit.

The assembly function reads/writes the data files, so make sure we
tell gcc that.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
itops.h
f9bcce3be04b554004a82d4fe10edaf6077241be 25-Mar-2006 Theodore Ts'o <tytso@mit.edu> Fix the i386 bitmap operations so they are 32-bit clean

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>
hangeLog
akefile.in
itops.h
st_bitops.c
39c47ce6417b81aa74596fd0d4d98d542525a444 19-Mar-2006 Theodore Ts'o <tytso@mit.edu> Add EXT2_FLAG_EXCLUSIVE to the ext2fs library.

This flag when specified to ext2fs_open or ext2fs_initialize indicates
that the application wants the io_channel to be opened in exclusive mode.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
nitialize.c
penfs.c
fa6c653ec3117dd689c8adb4ea2ebfc10f8cdd4a 19-Mar-2006 Theodore Ts'o <tytso@mit.edu> Add IO_FLAG_EXCLUSIVE flag to io_channel abstraction

Add a new io_channel open flag, IO_FLAG_EXCLUSIVE,which requests that
the device be opened in exclusive (O_EXCL) mode. Add support to the unix_io
implementation for this flag.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_io.h
nix_io.c
7447921dff38ef06a78355c0a7a23df9392102a4 18-Mar-2006 Theodore Ts'o <tytso@mit.edu> Fix documentation: BLOCK_FLAG_TRAVERSE should be BLOCK_FLAG_DEPTH_TRAVERSE

Addresses Debian Bug #351268

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
a612f3432eec6b3adcae3e6b62713173147f34a4 18-Mar-2006 Theodore Ts'o <tytso@mit.edu> Fix a signed vs unsigned bug in calc_reserved_gdt_blocks()

This fixes mke2fs -O resize_inode for very large filesystems (i.e., 20GB).
Addresses Debian Bug #346580

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
nitialize.c
bf69235ad0073c80386b70caba0e1b58e5f85697 18-Mar-2006 Theodore Ts'o <tytso@mit.edu> Add support for on-line resizing to resize2fs

If the filesystem is mounted, attempt to use the on-line resizing
ioctls to resize the filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2_fs.h
3ded50b37cfb3d3864792dfed7793029a061267e 11-Dec-2005 Theodore Ts'o <tytso@mit.edu> Address parallel build problem in the library Makefiles

Add a dependency to make sure that the subdirectories are created before
creating all of the object files.

Addresses Sourceforge Bug: #1261553

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
akefile.in
9b9a780f5a5823865f62f0c9fd194d262f63a06f 11-Dec-2005 Theodore Ts'o <tytso@mit.edu> Fix various gcc -Wall complaints.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
itops.h
xt2fs.h
nitialize.c
kjournal.c
ead_bb_file.c
es_gdt.c
bc47952f10ff5ed2c61536f2713d54b6807795cd 10-Dec-2005 Theodore Ts'o <tytso@mit.edu> Add ext2fs_read_bb_FILE test to confirm proper detection of invalid block #'s

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
st_badblocks.c
125e084cef02fe865a34181ccfa7f258ccf8ab34 21-Nov-2005 Theodore Ts'o <tytso@mit.edu> Fix gcc compilation on sparc architectures in bitops.h

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>
hangeLog
itops.h
a82a57025c4368de330ecac9a430d84137ae2268 14-Nov-2005 Theodore Ts'o <tytso@mit.edu> Add missing #include for string.h to ext2fs.h to fix GCC 4.01 complaints

#include <string.h> is needed since the inline functions use memcpy().
(Addresses Sourceforge Bug #1251062)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
0d961040fe9ad927254b5a0e1a4de7bedadd8579 13-Nov-2005 Theodore Ts'o <tytso@mit.edu> Fix writing external journals on big-endian machines

Fix a bug when writing an external journal device on an big
endian machine (such as a S/390), where when the number of
block groups is zero, we never end up writing out the
primary superblock at all.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
losefs.c
32138187f08d1f1dc03feb269f987982db76f3db 25-Sep-2005 Theodore Ts'o <tytso@mit.edu> Add fs->now to override time(0) in libext2fs

If fs->now is non-zero, use that as the time instead of the system
time when setting various filesystem fields (last modified time, last
write time, etc.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
b_inode.c
losefs.c
xt2fs.h
nitialize.c
kdir.c
kjournal.c
es_gdt.c
68a7f959c0af3d6e32cf9339433667f04b8a1c56 06-Sep-2005 Matthias Andree <matthias.andree@gmx.de> Fix compiler warnings about missing memcpy prototypes.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
xt2fs.h
583d1f83284ddfe126d97e6db0020739a1609b5a 25-Jul-2005 Theodore Ts'o <tytso@mit.edu> Fix false positives from valgrind: prctl(PR_GET_DUMPABLE)

Pass in zero to the unusued arguments of prctl(PR_GET_DUMPABLE) to
avoid false positives from valgrind.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
est_io.c
29af314d3fd4cb907a4f474645e04bd26ba66f5f 19-Jul-2005 Theodore Ts'o <tytso@mit.edu> Check for a busy device when creating a journal.

In ext2fs_add_journal_inode() check for the case where the filesystem
appears to be unmounted, but the device is still apparently busy.
This can happen when the luser doesn't bother to mount /proc and has a
bogus /etc/mtab, but still wants to mount the filesystem before using
tune2fs(?!?). Add a safety check to save him from his own stupidity,
at least on 2.6 kernels. (Addresses Debian Bug #319002)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
hangeLog
kjournal.c
9b7d811ddad946e728d9348a78cb06dee159df96 10-Jul-2005 Andreas Dilger <adilger@clusterfs.com> This patch adds a check to use fstat or fstat64 in getsize.c if the
target is a regular file, instead of doing binary searching. It also
fixes a couple of cases where a file descriptor is leaked in the
ext2fs_getsize() routine on error.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
hangeLog
etsize.c
1f965c8d961ec88a8917b2e99cfb43c4ccdfb19b 01-Jul-2005 Theodore Ts'o <tytso@mit.edu> Update for e2fsprogs 1.38 release.
hangeLog
80af12e180bdea9ed391a0aee58e31cee7641709 01-Jul-2005 Theodore Ts'o <tytso@mit.edu> Change the function prototypes of ext2fs_set_bit, ext2fs_clear_bit, and
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.
hangeLog
itops.c
itops.h
39c191f5b3bffc5aee56d6335fe54041c582e05d 27-Jun-2005 Stephen Tweedie <sct@redhat.com> ext2fs_resize_mem() is suffering from C99 strict type aliasing problems.
The trouble is that it is modifying pointers in place, but doing so via
"void *" types which alias the pointers passed in (which are typically
pointers to a struct.) The inline ext2fs_resize_mem() code may update
the pointer, but the caller is not required to reload the old value it
may have cached in a register, according to the type aliasing rules.

This is causing the caller to dereference the old pointer when compiled
with -O2, resulting in reproducible SEGV, on at least one ia64
configuration.

The compiler *is* required to reload if it sees an update to a dereferenced
char value, though, as chars are defined to alias anything; and memcpy()
is defined to operate on chars. So using memcpy() to copy the pointer
values is guaranteed to force the caller to reload. This has been
verified to fix the problem in practice.

Fixes Red Hat bug #161183.
hangeLog
xt2fs.h
e37fbf1c19ca255cb5349b159ff7d5288e8cf9a3 20-Jun-2005 Theodore Ts'o <tytso@mit.edu> getsectsize.c (BLKSSZGET): Clean up test for when to manually
define the BLKSSZGET ioctl.
hangeLog
etsectsize.c
2fa8f37ffff4687228d9f204062f2d27b0e5b919 05-Jun-2005 Theodore Ts'o <tytso@mit.edu> On Linux 2.6 systems, mke2fs and badblocks will check to see whether
the filesystem appears to be busy; if so, the programs will print an
error message and abort. (Addresses Debian Bug #308594).
hangeLog
xt2fs.h
smounted.c
3af0a45628c0984d298a885f8381498cdf866221 08-May-2005 Theodore Ts'o <tytso@mit.edu> Fix bug in the secure getenv function so that the ss library will corrently
honor the PAGER and SS_READLINE_PATH environtment variables, and the
test_io io_manager in the ext2fs library honors the TEST_IO_LOGFILE,
TEST_IO_FLAGS, TEST_IO_BLOCK, and TEST_IO_READ_ABORT environment variables.
hangeLog
est_io.c
75e93ab0975f042edc25dde6f5d9496360207a94 06-May-2005 Theodore Ts'o <tytso@mit.edu> Update "make depend" information. Fixes SMP parallel build problem.
(Addresses Sourceforge Bug: #1157933)
akefile.in
09f3eba28a4d3c050a548eab571b73352b131021 16-Apr-2005 Theodore Ts'o <tytso@mit.edu> Fix typo so that we actually ignore environment variables when gid != egid.
est_io.c
b1ae1197298633de6ac72c933b542eb1c3c93841 09-Apr-2005 Theodore Ts'o <tytso@mit.edu> Add missing return values in error return cases in the ext2fs library.
(Otherwise we return garbage instead of the error code.)
hangeLog
nd_block.c
node.c
762c7c65103615d976beeb4c8e2d1d9a79c87d86 06-Apr-2005 Theodore Ts'o <tytso@mit.edu> Add paranoia checks into the blkid, ext2fs, and ss libraries to ignore
environment variables if the libraries are called from setuid or setguid
programs, or if kernel believes that the process is not eligible to create
a core dump. In addition, if the libc has __secure_getenv(), use it so that
the libc can also do any additional limitations regarding when libraries can
trust environment variables (i.e., to integrate with systems like SELinux
and Posix capabilities).
hangeLog
est_io.c
fd4b28efd311e58811fcb652af003197d019ae29 22-Mar-2005 Theodore Ts'o <tytso@mit.edu> Update for the e2fsprogs 1.37 release.
hangeLog
cebe48a1ece8b9f61271c73ead83b59c8b36233e 21-Mar-2005 Theodore Ts'o <tytso@mit.edu> Integrate code from Alex Thomas at Clusterfs to check extended attributes
stored in inodes into e2fsck.

There are a number of bug fixes and enhancements over the original lustre fsck
BK repository. The biggest one is that this extended attribute values must
be aligned on 4-byte boundaries.
hangeLog
xt2_ext_attr.h
e27b45639aeef964035c1fa78790f761ed31c175 21-Mar-2005 Theodore Ts'o <tytso@mit.edu> Fix mke2fs so that it writes the root directory
using ext2fs_write_new_inode(), and fix ext2fs_write_new_inode()
so that it initializes i_extra_isize properly.
hangeLog
node.c
030970ed750b6a169c32ffb8b19bce3150198629 21-Mar-2005 Theodore Ts'o <tytso@mit.edu> Fix e2fsck, debugfs, and the ext2fs_mkdir function so that when we create
a new inode we make sure that the extra information in the inode (any extra
fields in a large inode and any ea-in-inode information) is cleared. This
can happen when e2fsck creates a new root inode or a new lost+found directory,
or when the user uses the debugfs write, mknod, or mkdir commands. Otherwise,
the newly create inode could inherit garbage (or old EA information) from
a previously deleted inode.
hangeLog
xt2fs.h
node.c
kdir.c
ea822eeba373bd0bed6e58a35ce123a9f2768113 21-Mar-2005 Theodore Ts'o <tytso@mit.edu> Enhance debugfs's stat command so it can dump extended attributes
which are stored in the inode body.
xt2_ext_attr.h
06ce1f6b282f2c632b1aabbee07a103d1bc1fa69 19-Mar-2005 Theodore Ts'o <tytso@mit.edu> Fix clean target to remove tst_getsectsize.

Remove useless -DDEBUG when linking tst_getsectsize.
hangeLog
akefile.in
283df83e7e2559f7190bb7a1dab759ccedac27ab 19-Mar-2005 Theodore Ts'o <tytso@mit.edu> getsize.c (ext2fs_get_device_size): Check to see if the number
of blocks is greater than 2**32 when we are doing a binary
search to determine the device size. Thanks to Stephen
Tweedie for the patch.
hangeLog
etsize.c
3eee5e9eed61ab6f635f4e0c236e999564a73b77 06-Feb-2005 Theodore Ts'o <tytso@mit.edu> Update for release of e2fsprogs 1.36.
hangeLog
b7aa0d653e4fcfbff3f122e1382fcca090f82a44 05-Feb-2005 Theodore Ts'o <tytso@mit.edu> Remove *.pc files on a "make distclean"

Remove emacs backup files in tests/Makefile on a "make clean"
hangeLog
akefile.in
dbb2a1014a553a1d6df83c4cb718ba645ae952f0 04-Feb-2005 Theodore Ts'o <tytso@mit.edu> Makefile.in (clean): Remove tst_getsize when doing a make clean
hangeLog
akefile.in
7004b4af6e52ce8985e45bf37bde813df4d509ff 04-Feb-2005 Theodore Ts'o <tytso@mit.edu> Drop the sparc assembly bitwise operations; it's less efficient
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.
hangeLog
itops.c
itops.h
d4dc0a9e29f9e50a46840bc130c6a816c4c7faa5 28-Jan-2005 Theodore Ts'o <tytso@mit.edu> Create the resize inode is created even if the s_reserved_gdt_blocks is
zero; e2fsck will now complain and recreate the resize inode if i_links_count
is zero or if it is not a regular file.
hangeLog
es_gdt.c
e644186542707a44e5fbeddd581eb3f77a30ba0f 26-Jan-2005 Theodore Ts'o <tytso@mit.edu> Add pkg-config files to e2fsprogs's libraries.
hangeLog
akefile.in
xt2fs.pc.in
7331196a16e57ef80dd6ae40eeeab14747ce2f5d 26-Jan-2005 Theodore Ts'o <tytso@mit.edu> Add library support for large (EA in inode) inodes. Make sure that garbage
doesn't get written into the reserved portion when writing into filesystems
that have large inodes defined.
hangeLog
xt2_fs.h
xt2fs.h
xt_attr.c
node.c
wapfs.c
8800c738350800a66d38aa22f5ec916f97c29622 19-Jan-2005 Theodore Ts'o <tytso@mit.edu> Makefile.in: Fix the kernel compile-time echo commands to be
consistent and portable
hangeLog
akefile.in
4e60fb609b330fb488f2fcbfe9e330b1441201c0 08-Jan-2005 Theodore Ts'o <tytso@mit.edu> Ex2fs_unlink() will return an error if both the name and inode number are
unspecified, to avoid doing something surprising (such as unconditionally
deleting the first directory entry). Directory entries are now deleted
by coalescing them with the previous directory entry if possible, to
avoid directory fragmentation. This is not an issue with the e2fsprogs suite,
but may be a problem for some of the users of libext2fs, such as e2tools.
hangeLog
nlink.c
da83cb6e4833c7c19279d31c31c6c8b5851f17e2 07-Jan-2005 Theodore Ts'o <tytso@mit.edu> Update version to 1.36-rc1, and change parsing algorithm for version strings
so that it deals with -rc version numbers correctly.
hangeLog
ersion.c
dc8ce3463791366ac844d3f0436709511fa09c49 06-Jan-2005 Theodore Ts'o <tytso@mit.edu> Fix resize inode handling on big endian systems, by adding new routines
that read/write indirect blocks, byte swapping them if necessary.
hangeLog
akefile.in
lock.c
xt2fs.h
nd_block.c
es_gdt.c
bc1b803214dc462efc9307ce0dbe0fc004f8a3e8 05-Jan-2005 Theodore Ts'o <tytso@mit.edu> dupfs.c (ext2fs_dup_handle): Make sure the new filesystem handle
has its own copy of the orig_super data structure. (This
is a better way of fixing a double-free problem in
resize2fs which Fedora attempted to fix in
e2fsprogs-1.35-double_free.patch. Addresses Red Hat
Bugzilla #132707.)
hangeLog
upfs.c
71669d0541f0d3db64792c60a28abddba78382e2 24-Dec-2004 Theodore Ts'o <tytso@mit.edu> Avoid some potential inode cache coherency problem caused by using the
byte-swapping options to e2fsck. This was the cause of some hard to
reproduce problems that had been reported in the past, and which the
resize_inode changes tickled in a much more repeatable fashion.
hangeLog
node.c
1d667534e93e78eedbf2efcef6d7844041675f26 23-Dec-2004 Theodore Ts'o <tytso@mit.edu> ext2fs.h (BMAP_SET), bmap.c (ext2fs_bmap): Add support for new
flag, BMAP_SET, which allows the caller to set a
particular logical->physical block mapping.
hangeLog
map.c
xt2_err.et.in
xt2fs.h
40abad69155d59d0cbe081d46606fda8549eb5cf 23-Dec-2004 Theodore Ts'o <tytso@mit.edu> Clean up resize inode routines in ext2fs library. We no longer print
any debugging statements from within library code (always a bad idea), and
ext2fs_create_resize_inode() will return a proper error code if the
resize inode is corrupt, instead of returning -1.
hangeLog
xt2_err.et.in
nitialize.c
es_gdt.c
5d28e3be679b515fb4a2e9ce1716f2452381b308 23-Dec-2004 Theodore Ts'o <tytso@mit.edu> swapfs.c (ext2fs_swap_super): Byteswap the reserved_gdt_blocks
superblocks field.
hangeLog
wapfs.c
1b4cd9c7464d5bd0f5b416c7303bcc827e312473 16-Dec-2004 Theodore Ts'o <tytso@mit.edu> sparse.c (ext2fs_list_backups, ext2fs_bg_has_super),
res_gdt.c (list_backups), closefs.c (ext2fs_bg_has_super),
ext2fs.h: Move ext2fs_list_backups() to res_gdt.c, and
ext2fs_bg_has_super() back to closefs.c. There's no
reason for the new file, since list_backups() isn't being
used by any other functions, and can be made static, and
all users of the ext2fs filesystem will have to call
ext2fs_close() anyway.
hangeLog
akefile.in
losefs.c
xt2fs.h
es_gdt.c
22c6821a2495b0bf340dd3c277713bb1bee01144 15-Dec-2004 Theodore Ts'o <tytso@mit.edu> Supplied changelog for resize inode patch.
hangeLog
d323f8fb369089b97d6f3bf0f8d64ceeab0b10f5 15-Dec-2004 Theodore Ts'o <tytso@mit.edu> Add support for on-line resizing ala the resize inode. This patch
is taken from Fedora Core 3's e2fsprogs 1.35-11.2.src.rpm's
e2fsprogs-resize.patch.
akefile.in
lloc_sb.c
losefs.c
xt2_err.et.in
xt2fs.h
nitialize.c
es_gdt.c
parse.c
522798d3428807800d8471f5ac3050b82aa9de97 15-Dec-2004 Theodore Ts'o <tytso@mit.edu> Add install-strip and install-shlibs-strip targets

Use Linux-kernel-style makefile output for "make install"

Update intl/Makefile.in to version from gettext 0.14.1
hangeLog
akefile.in
6d4022786dc43e66f0699a72925b946b9d2e4439 15-Dec-2004 Theodore Ts'o <tytso@mit.edu> Use MKINSTALLDIRS macro so that the Makefiles can find the script
correctly.

Update Makefile dependencies.

Update "make depend" production so that it filters out comments
inserted by newer gcc compilers.

Remove sync from e2fsck's "make all" target.
hangeLog
akefile.in
2e8ca9a26b0bd7dae546a3f9a98df67b043fe3be 30-Nov-2004 Theodore Ts'o <tytso@mit.edu> Add support for passing options to the io layer using the URL syntax. For
example, /tmp/test.img?offset=1024. Multiple options can separated using
the & character, although at the moment the only option implemented is
the offset option in the unix_io layer.
hangeLog
akefile.in
xt2_io.h
xt2fs.h
reefs.c
o_manager.c
penfs.c
est_io.c
nix_io.c
47204ff9830b17fc6317f48e88d2039f57a5d10a 30-Nov-2004 Theodore Ts'o <tytso@mit.edu> Use Linux-kernel-style makefile output to make it easier to
see errors/warnings.
hangeLog
akefile.in
39dc1c45cb41ce37a56d364103bb852d0b62c835 30-Nov-2004 Theodore Ts'o <tytso@mit.edu> Add definition for the extents filesystem feature and inode flag.

Change the maximum allowable blocksize to be 65536. This allows e2fsck to
check filesystems with a pagesize of 65536, and mke2fs to accept -b 65536.
Of course such a filesystem will not currently work on a Linux/x86 system,
at least not as of this writing!
hangeLog
xt2_fs.h
2b5901d9c7eb4b60cce5a9726517b8f79e5e0bfc 19-Nov-2004 Theodore Ts'o <tytso@mit.edu> Remove the a.out DLL support, since it's been obsolete and unmaintained
for a long time now.
akefile.in
ll/jump.funcs
ll/jump.ignore
ll/jump.import
ll/jump.params
ll/jump.undefs
ll/jump.vars
1a9c8c35ba148e55039bd04e0237085f7a3625d1 08-Oct-2004 Theodore Ts'o <tytso@mit.edu> getsize.c (ext2fs_get_device_size): Add support for Windows
9x/NT under Cygwin. Thanks to Sam Robb
(samrobb@users.sourceforge.net) for pointing this and the
suggested code patch.
hangeLog
etsize.c
9845cf5dbd4d06ebc1fe0db99078d7a0be641e0a 18-Sep-2004 Theodore Ts'o <tytso@mit.edu> Clean up the header file #include's for lib/blkid/getsize.c
and lib/ext2fs/getsize.c

In lib/blkid/getsize.c, include <sys/disk.h> if present since
this is where the DIOCGMEDIASIZE ioctl is defined on FreeBSD.
(Addresses Debian Bug #264630)
hangeLog
etsize.c
488f3c2dad93af023e8db2394d9b2af6439048f0 17-Sep-2004 Theodore Ts'o <tytso@mit.edu> On non-linux systems, use lseek64() if it is present in
ext2fs_llseek() and blkid_llseek(). (Addresses Debian bug #269044)
hangeLog
lseek.c
1ad54a940c499a66241f624882f1ffa03ce56d90 29-Jul-2004 Theodore Ts'o <tytso@mit.edu> Add ability for debugfs to use a separate source of data blocks when
reading from an e2image file. (New -d option)

Add new functions ext2fs_get_data_io, ext2fs_set_data_io,
ext2fs_rewrite_to_io to libext2fs library.
hangeLog
lock.c
xt2_err.et.in
xt2fs.h
reefs.c
nitialize.c
node.c
penfs.c
w_bitmaps.c
a63d12678369f4ab0edf8fc5741825c035e78bf9 27-May-2004 Theodore Ts'o <tytso@mit.edu> closefs.c (ext2fs_flush): Make sure the master superblock is
written last, and only after other I/O has been flushed to
disk. Thanks to Junfeng Yang from the Stanford
Metacompilation group for pointing a potential ordering
constraint problem if we don't write things out in the
right order.
hangeLog
losefs.c
a002e7e200308eb010f55f19b673a53775a7cccd 27-May-2004 Theodore Ts'o <tytso@mit.edu> Implement the ability for the test_io mechanism to abort after n reads
or writes to a particular block. The block is specified by
TEST_IO_BLOCK environment variable, and the read/write count
by the TEST_IO_READ_ABORT and TEST_IO_WRITE_ABORT environment
variables. The block data is now only dumped if the 0x10 bit
is set in TEST_IO_FLAGS.
hangeLog
est_io.c
aa5c0a4562fd9f991557311e400cc93972bbea3e 05-May-2004 Theodore Ts'o <tytso@mit.edu> Remove .cvsignore files; they were out of date, and causes lintian
to flame about their presence in the source tarball.
cvsignore
2625803ecff90ba8ab60d3c6b83a1ea0c91d2294 03-Apr-2004 Theodore Ts'o <tytso@mit.edu> Use C99 stdint.h types instead of custom types in the uuid library.
hangeLog
xt2_types.h.in
83e692e88bf2d01edb089010bdfc07b7dcc78642 30-Mar-2004 Matthias Andree <matthias.andree@gmx.de> unix_io.c, pass1.c:
int -> unsigned for 1 bit wide bitfields - we cannot have a value and a sign in 1 bit.
Fixes some of the Intel C++ 8.0 warnings (-w1 level).
nix_io.c
289e0557c24c68290b6d9b73b09674447801fdac 30-Mar-2004 Matthias Andree <matthias.andree@gmx.de> GNU/KFreeBSD portability fixes. (Addresses Debian Bug #239934)
etsize.c
nix_io.c
2c5cfbcb99f70d90f8e679bd2994b263ca6d11d6 08-Mar-2004 Theodore Ts'o <tytso@mit.edu> Only use the BLKGETSIZE64 ioctl on Linux 2.6 since it is
unreliable in Linux 2.4. (Addresses Debian Bug #236528).

Fix typo in the ioctl used for Mac OS X.
hangeLog
etsize.c
85b870034437e590e4aca77e325f3f5d6815eb39 02-Mar-2004 Theodore Ts'o <tytso@mit.edu> Update getsize functions to use the Apple Darwin and Linux 64-bit
ioctl's.
hangeLog
etsize.c
434661f8d5efd0999e586dfbf73b319f070bc20b 01-Mar-2004 Theodore Ts'o <tytso@mit.edu> Patch from Brian Bergstrand to use the correct -fPIC flag for
Darwin in order to get rid of the compiler warning.
hangeLog
akefile.in
b70b1167fec6d90771344d8560a1fc1b8731b9a9 28-Feb-2004 Theodore Ts'o <tytso@mit.edu> Update version number for e2fsprogs 1.35 release.
hangeLog
e47fd8414d3bd4632792cc52310e53edcfeea27c 22-Feb-2004 Theodore Ts'o <tytso@mit.edu> ext2fs.h (ext2fs_resize_mem): Fix C++ problem. (Addresses Red
Hat Bugzilla #112448; thanks Thomas Woerner from Red Hat.)
hangeLog
xt2fs.h
795afc4483c341d61805247a69b3b696e5599c09 22-Feb-2004 Theodore Ts'o <tytso@mit.edu> Fix libext2fs and debugfs to correctly deal with symlinks that have
extended attribute information. (Addresses Debian Bug #232328)
hangeLog
amei.c
1daf758571f444bf61e8a201e963f7d3b2d273e1 01-Feb-2004 Theodore Ts'o <tytso@mit.edu> Update for WIP release 1.35-WIP release dated 31-Jan-2004.
akefile.in
1ba7a2f2b6a9b152828a06443955a7fb1d139930 30-Jan-2004 Theodore Ts'o <tytso@mit.edu> Fix a byte swap bugs, including one which caused e2fsck to
incorrectly treat as valid symlinks created with SE Linux
(Debian bug #228723) as well as failing the f_journal test case on
big endian systems due to the backup journal blocks not being swapped.
hangeLog
xt2_fs.h
wapfs.c
b34cbddbd66baedc163d36dd281b63ef478f547a 28-Dec-2003 Matthias Andree <matthias.andree@gmx.de> Re-add FreeBSD support.
Tested on FreeBSD 5.2-CURRENT as of 2003-12-28.
Tested on FreeBSD 4.9-STABLE as of 2003-12-27.
lushb.c
etsize.c
nix_io.c
544349270e4c74a6feb971123884a8cf5052a7ee 07-Dec-2003 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nitpicks
hangeLog
lloc.c
b_inode.c
itops.c
lock.c
heck_desc.c
losefs.c
ir_iterate.c
irblock.c
xpanddir.c
xt2fs.h
et_pathname.c
count.c
mager.c
nitialize.c
node.c
fs_compat.h
ookup.c
kjournal.c
penfs.c
ead_bb.c
ead_bb_file.c
w_bitmaps.c
nix_io.c
nlink.c
rite_bb_file.c
ef344e13d2125e9dae3764b98f9fe3a170cd79e2 21-Nov-2003 Theodore Ts'o <tytso@mit.edu> Centeralize calculation of which blocks are reserved/used for
the superblock and block group descriptors into two functions:
ext2fs_reserve_super_and_bgd, found in lib/ext2fs/alloc_sb.c, and
ext2fs_super_and_bgd_lock, found in lib/ext2fs/close.c.

Change e2fsck/pass1.c (mark_table_blocks), lib/ext2fs/closefs.c
(ext2fs_flush), lib/ext2fs/initialize.c (ext2fs_initialize),
and misc/dumpe2fs.c (list_desc) to use these functions.

e2fsck/ChangeLog
pass1.c (mark_table_blocks): Use the new function
ext2fs_reserve_super_and_bgd to calculate the blocks to be
reserved.

lib/ext2fs/ChangeLog
closefs.c (ext2fs_super_and_bgd_loc): New function which
centralizes the calculation of the superblock and block
group descriptors.
(ext2fs_flush): Use ext2fs_super_and_bgd_lock to figure
out where to write the superblock and block group
descriptors.

alloc_sb.c (ext2fs_reserve_super_and_bgd): New function which
reserves space in the block bitmap using
ext2fs_super_and_bgd_loc.

initialize.c (ext2fs_initialize): Use
ext2fs_reserve_super_and_bgd to initialize the block bitmap.

misc/ChangeLog
dumpe2fs.c (list_desc): Use ext2fs_super_and_bgd_loc to
determine the locations of the superblock and block group
descriptors.
hangeLog
akefile.in
lloc_sb.c
losefs.c
xt2fs.h
nitialize.c
a435ec3449694a8fa299337197cc09624960a3a6 21-Aug-2003 Theodore Ts'o <tytso@mit.edu> Add support for backing up the journal inode location in the
superblock. E2fsck will automatically save the journal information
in the superblock if it is not there already, and will use it if the
journal inode appears to be corrupted. ext2fs_add_journal_inode()
will also save the backup information, so that new filesystems
created by mke2fs and filesystems that have journals added via
tune2fs will also have journal location written to the superblock as
well. Debugfs's logdump command has been enhanced so that it can
use the journal information in the superblock.

The debugfs man page has been improved to more fully describe the
logdump command.

Added two new functions, ext2fs_file_open2() and
ext2fs_inode_io_intern2() which take a pointer to an inode structure;
this is needed so that e2fsck and debugfs can synthesize a
fake journal inode and use it to access the journal.
hangeLog
xt2_fs.h
xt2fs.h
ileio.c
node_io.c
kjournal.c
c4e3d3f374b409500e3dd05c0b0eca6ac98a6b4e 01-Aug-2003 Theodore Ts'o <tytso@mit.edu> ext2fs_getmem(), ext2fs_free_mem(), and ext2fs_resize_mem()
all now take a 'void *' instead of a 'void **' in order to
avoid pointer aliasing problems with GCC 3.x.
hangeLog
lloc.c
adblocks.c
b_inode.c
itmaps.c
lock.c
map.c
move.c
rel_ma.c
losefs.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
upfs.c
xpanddir.c
xt2fs.h
xt_attr.c
ileio.c
reefs.c
et_pathname.c
count.c
nitialize.c
node.c
node_io.c
rel_ma.c
kdir.c
kjournal.c
amei.c
ewdir.c
penfs.c
s_bitmap.c
w_bitmaps.c
est_io.c
nix_io.c
9c7ec178092d6d5be005406c2912ea6e59a996b5 26-Jul-2003 Theodore Ts'o <tytso@mit.edu> Update for 1.34 release.
hangeLog
c6df04bbdb12db1060ac11ba0e996bddca84032f 23-Jul-2003 Theodore Ts'o <tytso@mit.edu> Update makefile dependencies.
akefile.in
48e6e81362f264aee4f3945c14928efaf71a06c9 06-Jul-2003 Theodore Ts'o <tytso@mit.edu> Fixx gcc -Wall nitpicks.
hangeLog
xt2_fs.h
xt2_types.h.in
lushb.c
nitialize.c
smounted.c
ernel-jbd.h
lseek.c
ookup.c
ead_bb.c
est_io.c
7d7bdd578b307cad1dc248310eb279c6fb73b682 24-Jun-2003 Theodore Ts'o <tytso@mit.edu> Fix bug in resize2fs which caused it to fail on filesystems with a
non-empty bad block list. Resize2fs now discards any blocks on the
badblock list which are no longer part of the filesystem as the result
of a filesystem shrink. (Note: this means that shrinking and then
enlarging a filesystem is no longer a reversible operation;
information about bad blocks in the part of the filesystem
which is to be chopped off will be lost.)
hangeLog
adblocks.c
xt2fs.h
st_badblocks.c
93d5c38791a3778eed18fe968cdd136d23d0fa07 21-May-2003 Theodore Ts'o <tytso@mit.edu> mke2fs.c (PRS, set_fs_defaults): If the sector size of the
device is larger than the default block size, then use the
sector size of the device as the default block size.

getsectsize.c (ext2fs_get_device_sectsize): New function which
returns the hardware sector size (if it is available).
hangeLog
akefile.in
xt2fs.h
etsectsize.c
st_getsectsize.c
b8a953157bce577bff6f9d8437e8d7f2c881fe63 14-May-2003 Theodore Ts'o <tytso@mit.edu> unix_io.c: Add #ifdef NO_IO_CACHE which disables all userspace
caching by the unix_io layer. Not enabled, only for
debugging.
hangeLog
nix_io.c
c62dbdb9ec3244c8b324d8dbeb9ee14baac361f5 06-May-2003 Theodore Ts'o <tytso@mit.edu> Stupid think-o bugfix in test_io.c: Don't close data->outfile
if it is stderr.
est_io.c
2a29f1354f793557fa1829c9e85e74586e2907db 05-May-2003 Theodore Ts'o <tytso@mit.edu> Add --enable-test-io-debug configure option which causes e2fsck and
tune2fs to use the test I/O manager.

The test I/O manager has been changed to not do anything extra by
default, unless the TEST_IO_FLAGS and/or TEST_IO_BLOCK environment
variables are set, which controls what I/O operations are logged and
a block number to watch, respectively. The log messages are sent to
stderr by default, unless a filename is specified via the
TEST_IO_LOGFILE environment variable.
hangeLog
est_io.c
68dbdc2f1d717faa73c61e5f2ed5c3c9d6128dd6 03-May-2003 Theodore Ts'o <tytso@mit.edu> tst_badblocks.c (file_test): Use tmpfile() instead of mktemp().
hangeLog
st_badblocks.c
05a27b1d34fc566a3f11b086a4f6e7b7888b5406 30-Apr-2003 Theodore Ts'o <tytso@mit.edu> getsize.c (ext2fs_get_device_size): Allow windows code to get
the resize for filesystems that are in regular files.
hangeLog
etsize.c
71df0dc393f959277ed985f9d1e6313df9ff9c0a 21-Apr-2003 Theodore Ts'o <tytso@mit.edu> Update for 1.33 release.

Fix typo's in README.subset

Change debian control file so it doesn't bomb out if the EVMS FSIM
is not there, since it is not built on the Hurd. Resolves Debian
bug #189687.
hangeLog
afb6d709ba94cee1ab6b32c5f2f7acaa37c6845d 21-Apr-2003 Theodore Ts'o <tytso@mit.edu> Use DYLD_LIBRAY_PATH so that "make check" works on
Darwin systems when building with shared libraries.
hangeLog
akefile.in
a85e81a2ff4fb1afc05ff74d5da573031c3495e0 18-Apr-2003 Theodore Ts'o <tytso@mit.edu> configure.in: Remove CYGWIN definition; we will use the
automatically defined __CYGWIN__ instead.
hangeLog
nix_io.c
c6928406b3d8b1437a379ab66da2b8fa389febbc 18-Apr-2003 Theodore Ts'o <tytso@mit.edu> Add Cygwin/Windows version of ext2fs_get_device_size()
hangeLog
etsize.c
fff45483ede7fe38a31b3364a9c07e2418776dee 13-Apr-2003 Theodore Ts'o <tytso@mit.edu> Add portability enhancements for Cygwin32 environment.
hangeLog
mager.c
smounted.c
nix_io.c
2c93113e6ac1384abd1935af7217b783fdcb3023 11-Apr-2003 Theodore Ts'o <tytso@mit.edu> Remove EXT2_FEATURE_RO_COMPAT_BTREE_DIR mention of since it's not
actually used, and may confuse people who are looking for
EXT2_FEATURE_COMPAT_DIR_INDEX, which is in use.
hangeLog
xt2_fs.h
91835c151fd48fd03bfe74133b8214486af18c12 31-Mar-2003 Theodore Ts'o <tytso@mit.edu> Change compile_et to generate header files that use <et/com_err.h>
instead of <com_err.h>, so the current version of the header file
is used.

Add a --build-tree option to compile_et to make sure that it uses
the et_?.awk files from the build tree.

Remove legacy support for varargs.h, K&R C, and pre-POSIX signal
support. Also fixed gcc -Wall nits.
hangeLog
akefile.in
e71d87317ac095fa08079f0cc9040da16952eb93 14-Mar-2003 Theodore Ts'o <tytso@mit.edu> Add Apple/Darwin patches.
hangeLog
etsize.c
220c0040fb4a5e8a2a091a9e3a936bb8a85223d8 14-Mar-2003 Theodore Ts'o <tytso@mit.edu> badblocks.c (ext2fs_u32_list_count), ext2fs.h: Add new function
which returns the number of entries in the list.
hangeLog
adblocks.c
xt2fs.h
20754488a228fed766126a2788bce523154a48f0 10-Mar-2003 Theodore Ts'o <tytso@mit.edu> fileio.c (ext2fs_file_lseek): Fix bug added when adding 64-bit
support; avoid null dereference when ret_pos is NULL.
hangeLog
ileio.c
ed78c021c3b111d8ab9a51aef5d5156e3004083f 06-Mar-2003 Theodore Ts'o <tytso@mit.edu> Fix up lots of portability problems that caused e2fsprogs not to build successfully
under Solaris.
hangeLog
xt2_ext_attr.h
xt2_types.h.in
lushb.c
smounted.c
ernel-jbd.h
d3f917989badf78d1f97654e46d60d1f3d25cd17 25-Jan-2003 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nits.
hangeLog
irhash.c
23b7c8b88673248b1f93abc717943867ad037bb4 23-Jan-2003 Theodore Ts'o <tytso@mit.edu> unix_io.c (unix_write_blk): Fix up GCC -Wall nits.
hangeLog
nix_io.c
819157db798cd514aa2f3ae421d64e2e0c9b7fa8 23-Jan-2003 Theodore Ts'o <tytso@mit.edu> Remove 32-bit limitations for debugfs's dump command and to the
ext2fs library's ext2fs_file_read.
hangeLog
xt2fs.h
ileio.c
4564c727e9613da61688abbf6dbd879b19f20648 20-Jan-2003 Theodore Ts'o <tytso@mit.edu> initialize.c (ext2fs_initialize): If the user specifies a really
large number of inodes, then reduce the number of blocks
per group until we find a workable set of filesystem
parameters.

ext2_err.et.in (EXT2_ET_TOO_MANY_INODES): Add new error code.
hangeLog
xt2_err.et.in
nitialize.c
38513011b951e60abe25d85f10eec53f1fa73b7b 09-Nov-2002 Theodore Ts'o <tytso@mit.edu> Update files for 1.32 release.
hangeLog
82c4660c756fba5eae289e6fbf03fab55393e3e2 09-Nov-2002 Theodore Ts'o <tytso@mit.edu> unix_io.c (find_cached_block, reuse_cache, unix_read_blk,
unix_write_blk): Optimize routines so that we don't end up
searching the cache twice when a block isn't in the
cache. If reads are larger than READ_DIRECT_SIZE, don't
let them go through the cache.
hangeLog
nix_io.c
1d47dfb91ef010c506e9354dec102385d8494d8f 09-Nov-2002 Theodore Ts'o <tytso@mit.edu> unix_io.c (find_cached_block): Fixed bug which caused some clean
blocks to be erroneously marked as dirty, so they would
get written back to the disk before they are evicted from
the cache. Harmless, but it slows down e2fsck
significantly.
hangeLog
nix_io.c
ae65b29f112542327d05bedded745705fdabe012 09-Nov-2002 Theodore Ts'o <tytso@mit.edu> Update files for 1.31 release.
hangeLog
feb44c6955378a0b698886d104808ed2a5644258 08-Nov-2002 Theodore Ts'o <tytso@mit.edu> Skip byteswap tests on --disable-swapfs

Disable certain tests that depend on the byteswapping functions
being present so that "make check" succeeds even if --disable-swapfs
is passed to the configure script.
hangeLog
akefile.in
bfd418832d46da1767517b40a7857de449ea03fe 08-Nov-2002 Theodore Ts'o <tytso@mit.edu> closefs.c (write_bgdesc, ext2fs_flush): Fix bug in meta_bg
support when the MASTER_SB_ONLY flag is set. Some of
the descriptor blocks that should have been written out
were getting skipped.
hangeLog
losefs.c
5d823a478f806fddd76391f3f63e61f948c9d849 01-Nov-2002 Theodore Ts'o <tytso@mit.edu> Update files for 1.30 release.
hangeLog
a2c8bf94834b29d7679ae0bb9b4e7a4deb1c6f42 01-Nov-2002 Theodore Ts'o <tytso@mit.edu> ext2_fs.h: Add support for a new inode flag, which is to be used
for indicating the top of directory hierarchies for the
Orlov block allocator.
hangeLog
15f9011add4013d32ea2f7ca7dbf860f95b8ec53 01-Nov-2002 Theodore Ts'o <tytso@mit.edu> Add support for a new inode flag, which is to be used
for indicating the top of directory hierarchies for the
Orlov block allocator.
xt2_fs.h
3a42fe220c301c8b9a8df595938c9a923cf5c494 31-Oct-2002 Theodore Ts'o <tytso@mit.edu> ismounted.c (check_mntent, check_mntent_file): Add better
support for loopback-mounted filesystems. Check /etc/mtab
if /proc/mounts doesn't turn up any mount flags, since
/etc/mtab has the loopback image filename, instead of
/dev/loop0. Also, check based on st_dev and st_ino, so
that if a relative pathname or a pathnames using symbolic
links are used, we can detect the the filesystem correctly
in those cases. (Addresses Sourceforge bug #619119)
hangeLog
smounted.c
55ca9ae5ecc5968e272e900b3e6e815fdeae683b 31-Oct-2002 Theodore Ts'o <tytso@mit.edu> flushb.c (ext2fs_sync_device): If the BLKFLSBUF ioctl succeeds,
don't try the FDFLUSH ioctl that was required for floppies
with older kernels. This avoids needless whining from the
MD device driver. (Addresses Sourceforge bug #545832).
hangeLog
lushb.c
9ed06a1eb90efbc3290c1b5a56e0e09d243f95da 31-Oct-2002 Theodore Ts'o <tytso@mit.edu> openfs.c (ext2fs_open): Fix bug which caused us to pass the
wrong group_block to ext2fs_descriptor_block_loc if we're
using the backup superblock/block group descriptors.
(ext2fs_descriptor_block_loc): If we're using the backup
superblock descriptors, use the backup descriptor block in
the next block group.
hangeLog
penfs.c
76dd5e5c2842fb1a7b858aad3e68b5e9c16890c9 31-Oct-2002 Theodore Ts'o <tytso@mit.edu> Add support for the meta_bg feature flag to the resize2fs program.

Fix bug in meta_bg support in mke2fs, e2fsck, and dumpe2fs; we were
incorrectly reserving the legacy block groups desriptor blocks.
hangeLog
lloc_tables.c
losefs.c
nitialize.c
9d2aefb3bc0a48b1540d06e1983aa96c56d39e17 25-Oct-2002 Theodore Ts'o <tytso@mit.edu> Add a new superblock field, s_mkfs_time, which indicates when
the filesystem was created. It is set via mke2fs, and printed
via list_super2() (which is called by dumpe2fs).

Also, list_super2() will now print "n/a" if the last mount time
(s_mtime) is zero.
hangeLog
xt2_fs.h
nitialize.c
4a959fe6f18a3b6023234a66f4455f7ec660b8b4 20-Oct-2002 Theodore Ts'o <tytso@mit.edu> Add support for new default mount options for the journal data mode.
hangeLog
xt2_fs.h
c046ac7f2e4c53e20cf1e909bbe511f91074b396 20-Oct-2002 Theodore Ts'o <tytso@mit.edu> Add support for the meta_blockgroup filesystem format.
hangeLog
losefs.c
xt2_fs.h
xt2fs.h
nitialize.c
penfs.c
wapfs.c
a0c3fd5e4cdc2e0b032c9ace89d960a622069c32 15-Oct-2002 Theodore Ts'o <tytso@mit.edu> Add support for new feature in ext2/3 filesystems; a default mount options field
in the superblock. Added the tune2fs '-o' option to set this field.
hangeLog
xt2_fs.h
3e69906495d5898849a6154b0311b5d4a84a27ae 14-Oct-2002 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nits.

Fix format bug if NLS is in use.

Add extra so that the info directory looks OK on OpenWall.
hangeLog
xt2fs.h
8132d840c8f6b0d90ab5048d6f8529f74e1aa0b3 03-Oct-2002 Theodore Ts'o <tytso@mit.edu> Fix endian problems in the htree code for e2fsck and debugfs.

When byte-swapping a filesystem on a PPC architecture, byte-swap
the bitmaps since the historical big-endian ext2 variant had
byte-swapped bitmaps, and the ext2fs library assumes this. Otherwise
the regression test suite will fail...
hangeLog
w_bitmaps.c
wapfs.c
c6633059470c28757062daa811ef50265f5f582a 24-Sep-2002 Theodore Ts'o <tytso@mit.edu> Update for 1.29 release.
hangeLog
akefile.in
87ee8dcad3b9e42dc0576b9788b9d321076dee5e 31-Aug-2002 Theodore Ts'o <tytso@mit.edu> Update changelogs for 1.28 release
hangeLog
ea1959f01523ffc105747d660ccc5b7f02805928 31-Aug-2002 Theodore Ts'o <tytso@mit.edu> Fix a bug which caused e2fsck to fail to correctly check filesystems
using a non-zero hash version (i.e., half MD4 or TEA hash).

The hash version wasn't getting copied into dx_dir->hashversion and
this caused the kernel to treat all directories if they were using the
legacy hash, which was Bad.
hangeLog
blist.c
xt2fs.h
ee504128d34315b579d34fad8e9a3b1f80ffc00e 20-Aug-2002 Theodore Ts'o <tytso@mit.edu> valid_blk.c (ext2fs_inode_has_valid_blocks): Fix bug which
failed to accurately characterize non-standard slow
symlinks. (Which don't appear in practice on real-life
systems, fortunately.)
hangeLog
alid_blk.c
e5b164373c2b7feb867f701f6493e3d87765272c 18-Aug-2002 Theodore Ts'o <tytso@mit.edu> Update to debian's 1.27+1.28-WIP-0626-1

Revert the shlibs hack.

Makefile.in: Remove inode_io.o from the standard object files
in libext2fs, and only build it if debugfs is enabled
(it requires fileio.o, which is only built if
--disable-debugfs isn't specified to configure).
hangeLog
akefile.in
b33278c4d640c3fc8f99a314b637b7e502fceb9c 17-Aug-2002 Theodore Ts'o <tytso@mit.edu> Modify the half MD4 hash so it is no longer endian dependent. This is
a backwards incompatible change, but this should be OK since the kernel
MD4 ext3 code was only in the CVS tree, and hasn't generally escaped.

Add support for the TEA hash.
hangeLog
irhash.c
xt2_fs.h
xt2fs.h
0684a4f33b5c268fe12f57fcbc77a880c79ab282 17-Aug-2002 Theodore Ts'o <tytso@mit.edu> Overhaul extended attribute handling. Should now be correct with
respect to the latest V2 bestbits ACL code.
hangeLog
xt2_err.et.in
xt2fs.h
xt_attr.c
alid_blk.c
917e87509841ad7bd91cfd7d423204f831ebfc93 13-Aug-2002 Theodore Ts'o <tytso@mit.edu> Makefile.in: Move dupfs.o and test_io.o from the
needed-by-debugfs object list to the needed-by-resizer
object list. Fixes compile problem if the system is built
with only --disable-debugfs.
hangeLog
akefile.in
fe4dd429dc878d877abe08c2c41eed48df4e4651 30-Jul-2002 Theodore Ts'o <tytso@mit.edu> link.c (ext2fs_link): When adding a new link to a directory,
clear the HTREE bit.
hangeLog
ink.c
cc90bdfd083036c9646f35ad6fa375af4ff92526 23-Jul-2002 Theodore Ts'o <tytso@mit.edu> dirhash.c (ext2fs_dirhash): Fix bug which caused MD4
calculations for names > 32 characters to be completely
bogus. Changed MD4 calculation to match what is currently
being used in the CVS gkernel tree.
hangeLog
irhash.c
b7a00563b22b0ea47ddc7117508c0b8e0d65df43 20-Jul-2002 Theodore Ts'o <tytso@mit.edu> Add support to e2fsck to reindex directories to use hash trees.
hangeLog
adblocks.c
xt2_fs.h
xt2fs.h
xt2fsP.h
reefs.c
3ea1f0fb45d5d3ec81370efc3c1c0759a4d88675 20-Jul-2002 Theodore Ts'o <tytso@mit.edu> dirhash.c (halfMD4Transform): Shift the hash by one bit,
since that's required by the directory indexing code.
hangeLog
irhash.c
50cd7e06e26d8cb232819b3d94b67e37ade80c0f 14-Jul-2002 Theodore Ts'o <tytso@mit.edu> ext2fs.h, read_bb_file.c: Change private to priv_data, to avoid
using a C++ reserved word.
hangeLog
xt2fs.h
ead_bb_file.c
f154d2f687e922f8444ef3050dc83f5d8e0e2178 14-Jul-2002 Theodore Ts'o <tytso@mit.edu> unix_io.c (unix_open): Only attempt the setrlimit workaround if
the kernel version is 2.4.10 -- 2.4.17, since otherwise an
old version of glibc (built against 2.2 headers) will
interact badly with the workaround to actually cause more
problems. I hate it when the glibc folks think they're
being smarter than the kernel....
hangeLog
nix_io.c
9e6c5dd73e7bc1a946b2b8b6c5a15c1f9d3534c0 09-Jul-2002 Theodore Ts'o <tytso@mit.edu> ext2_fs.h: Add superblock field for reserved group descriptors.
hangeLog
xt2_fs.h
2cb403b255f1254a29f26d2b356e7764c0f12506 28-Jun-2002 Theodore Ts'o <tytso@mit.edu> bitops.h: Add #define's for ext2fs_{l,b}e{32,16}_to_cpu and
ext2fs_cpu_to_{l,b}e{32,16}
hangeLog
itops.h
5818d6789aaa795aeee1fdb0f7d812a1cabe3d1d 28-Jun-2002 Theodore Ts'o <tytso@mit.edu> ismounted.c (check_mntent): In AIX 4.3, MOUNTED isn't defined.
Add appropriate fallbacks in this case.
hangeLog
smounted.c
503f9e7f6eb331c5b75d7f1ad126f71bcdcfb4e3 26-Jun-2002 Theodore Ts'o <tytso@mit.edu> Add support for the half-MD4 HTREE hash.

Add HTREE root node tests.
hangeLog
irhash.c
xt2_fs.h
xt2fs.h
88372d5c4b2ebd0405446b42de65bf2b0ebb2408 16-Jun-2002 Theodore Ts'o <tytso@mit.edu> Applied Andrew Morton's patch to support the dirsync option.
hangeLog
xt2_fs.h
b21bf267783274683a432eea6e5c589eab94123e 10-Jun-2002 Andreas Dilger <adilger@clusterfs.com> Do sanity checking of the number of blocks and inodes in a group for
8192-byte and 16384-byte blocksize filesystems.

Change the default bytes-per-inode ratio of a new filesystem to be at most
one inode per block for large blocksizes.
hangeLog
xt2_fs.h
nitialize.c
penfs.c
7da78ff17df7d2c1eeebbc2b0727106b63c08a68 10-Jun-2002 Andreas Dilger <adilger@clusterfs.com> ext2_fs.h: Further minor cleanups of the header. Consolidate
some checks for __KERNEL__ into one place.
hangeLog
xt2_fs.h
0fbd1a8a9a2ef697927f886559344ffa1bb2eefa 23-May-2002 Andreas Dilger <adilger@clusterfs.com> ext2_fs.h: Remove macros accessing u.ext2_sb field and use
the EXT2_SB() macro instead. Remove kernel function
prototypes also. This matches the 2.5 kernel, and
is also cleaner for other reasons. Whitespace cleanup.
hangeLog
xt2_fs.h
0d63467ddb76ef0c08481b74dae1fc7d6f364d1d 22-May-2002 Theodore Ts'o <tytso@mit.edu> Update to support the V2 Bestbits EA format.
hangeLog
xt2_ext_attr.h
31e29a12d1e22745c74afe47bf172a3c73280dd9 17-May-2002 Theodore Ts'o <tytso@mit.edu> Fix up Andreas's 8k blocksize changes to fix a number of bugs,
and to make the page size determined at run-time instead of
compile time.
hangeLog
932a489cdf6bc83d69e59d3f8e0a57b733799ce1 16-May-2002 Andreas Dilger <adilger@clusterfs.com> Add support for creating and checking 8192-byte blocksize filesystems.
We complain if you try to create such a filesystem on a system with 4096
byte PAGE_SIZE.

Add checks for valid inode size for undocumented -I option.
xt2_fs.h
nitialize.c
b38cd283637dafff6b39d4b76bf76fa2789eb21f 12-May-2002 Theodore Ts'o <tytso@mit.edu> Add a new command "bmap" to debugfs which calculates the logical->physical block
mapping for a particular inode.

Fixed a bug in the libext2 library which broke ext2fs_bmap if no inode structre
was passed inside for here.

Fixed bad calling parameters to parse_ulong which broken the -b and -s
options to debugfs, as well as do_init, and the testb, setb, clearb functions.
hangeLog
map.c
f0efd2976b69d31b752b5e5ce4f5e8341a130c45 27-Apr-2002 Theodore Ts'o <tytso@mit.edu> ismounted.c (check_mntent_file, is_swap_device): Verify that the
file we are checking is a block device file before looking
at st_rdev, since it's not valid for normal files.
(is_swap_device): Move so that it is outside the
HAVE_MNTENT_H, so that it is always built.
hangeLog
smounted.c
1acb01b4e28067a37c4f41e0a76df9f429fb417e 12-Mar-2002 Theodore Ts'o <tytso@mit.edu> Fix stupid bug; dx_hack_hash was left-shifted by one in CPP macro
trap.
irhash.c
f9190c8a95c6b76eac567d5896b3ed06ed2a3ada 12-Mar-2002 Theodore Ts'o <tytso@mit.edu> dirblock.c (ext2fs_read_dir_block2, ext2fs_write_dir_block): New
functions which take an extra flags argument. The flag
EXT2_DIRBLOCK_V2_STRUCT will reverse when the name_len
field is byte swampped on big-endian machines, since in
the V2 structure, name_len is a char field which is
doesn't need to be byte swapped --- except if an
old-style kernel had byte-swapped the name_len field
as part of the V1 structure.

Also fixed a bug in debugfs which used ext2_dir_entry_2 without
worrying about the above issue, with the net result that "ls -l"
would print an incorrect file type on big-endian systems.
hangeLog
irblock.c
xt2fs.h
52783e0ca72a80c549e9d266b3472f78fc61bdb2 11-Mar-2002 Theodore Ts'o <tytso@mit.edu> Add new function to the libext2fs library, ext2fs_dirhash, which
calculates the hash of a filename for indexed directories.
hangeLog
akefile.in
irhash.c
xt2_err.et.in
xt2fs.h
a8e772498cea7d6d2d84d94c7985c79afb96a4fa 08-Mar-2002 Theodore Ts'o <tytso@mit.edu> Update for 1.27 release.
hangeLog
546a1ff18cc912003883ff67ba3e87c69f700fc4 08-Mar-2002 Theodore Ts'o <tytso@mit.edu> Fix various gcc -Wall complaints.
hangeLog
map.c
xt2fs.h
ileio.c
node_io.c
st_badblocks.c
st_byteswap.c
304905df4acb457faed3b807d31b84b46bebbd80 08-Mar-2002 Theodore Ts'o <tytso@mit.edu> Makefile.in (check): Use LD_LIBRARY_PATH to run test programs.
(From Philipp Thomas <pthomas@suse.de>)
hangeLog
akefile.in
57173d0febd3d6ea911981420945d12ec205ec2c 26-Feb-2002 Theodore Ts'o <tytso@mit.edu> Update Changelog messages to use tytso@mit.edu for all addresses
after September 7, 2001. (Forgot to update my emacs file to get
rid of the tytso@valinux.com address. Oops.)
hangeLog
df614db6ef79c767745b8154c26d69398b571605 25-Feb-2002 Theodore Ts'o <tytso@mit.edu> Add initial support in debugfs for examining directory indexing
information.
hangeLog
xt2_fs.h
64e1b274edc48553c76511ff9b30f85c52aff046 24-Feb-2002 Theodore Ts'o <tytso@mit.edu> unix_io.c (unix_open): Fix 2.4 resource limit workaround so that
it doesn't break things on mis32, sparc32, and alpha
platforms.
hangeLog
nix_io.c
f3e3d31502c972e8dfbab391dda84f069e9b6b87 22-Feb-2002 Theodore Ts'o <tytso@mit.edu> ismounted.c (is_swap_device): Fix file descriptor/memory leak;
we were missing an fclose().
hangeLog
smounted.c
f12e285ffd9ff0b37c4f91d5ab2b021ed1eb43be 20-Feb-2002 Theodore Ts'o <tytso@mit.edu> Add new inode I/O abstraction interface which exports an inode as
an I/O object.

Export ext2_file_flush as a public interface.

Also minor cleanups to tighten code in other I/O abstractions, and to
mark a void * pointer as const in the ext2_file_write interface.
hangeLog
akefile.in
xt2_err.et.in
xt2fs.h
ileio.c
node_io.c
est_io.c
nix_io.c
7d4343d0d05ce69e0a72da5ac34eea415d4c789f 12-Feb-2002 Theodore Ts'o <tytso@mit.edu> Lots of small random portability fixes to make e2fsprogs build
under AIX --- even without the 5L compatibility toolkit, and even
using the uber-crippled AIX native C compiler.
hangeLog
akefile.in
ernel-jbd.h
ernel-list.h
7f961d424b1ba527e835d01ad24e0e4c3f4088c5 03-Feb-2002 Theodore Ts'o <tytso@mit.edu> Fix bug where ext2fs_mkdir wasn't correctly bumping the number of
directories in use in a bloock group.
hangeLog
lloc_stats.c
xt2fs.h
kdir.c
a5f3f5c19191c0eabd345f9cad2d9159e9bc0084 03-Feb-2002 Theodore Ts'o <tytso@mit.edu> Update files for 1.26 release.
hangeLog
akefile.in
682720a41b70cbe5291b524184983712124035b2 03-Jan-2002 Theodore Ts'o <tytso@mit.edu> Fix gcc -Wall nits.
smounted.c
8bd0c95908baa3af706b9e731daff9472bec74c9 03-Jan-2002 Theodore Ts'o <tytso@mit.edu> dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.

Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.

mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
hangeLog
akefile.in
lloc.c
lloc_stats.c
b_inode.c
blist_dir.c
ir_iterate.c
xpanddir.c
xt2fs.h
xt2fsP.h
kdir.c
kjournal.c
07cefe7a7051e32f14b93d9003a6dbb308597bd3 24-Dec-2001 Theodore Ts'o <tytso@mit.edu> ismounted.c (is_swap_device): New function used by
ext2fs_check_if_mounted and ext2fs_check_mount_point which
determines whether or not the specified device is a swap
device by using /proc/swaps. More bulletproofing for
idiotic/careless system administrators!
hangeLog
xt2fs.h
smounted.c
5f0fabe6db7a6494cc50eaa71a960e7527fda052 24-Dec-2001 Theodore Ts'o <tytso@mit.edu> Fix broken Makefile dependencies.
akefile.in
6a525069a99787ef3ae1156f12230044b3568f4b 24-Dec-2001 Theodore Ts'o <tytso@mit.edu> Mke2fs now creates the lost+found directory with 0700 permissions,
since files which get dropped into that directory may have come
from a protected directory, and the system administrator may not
deal with immediately. (Addresses Debian bug #118443)
hangeLog
xt2fs.h
nitialize.c
kdir.c
penfs.c
a8fd6e36b866f2cf14edaa19d452fa64bd0fba40 24-Dec-2001 Theodore Ts'o <tytso@mit.edu> ismounted.c (check_mntent_file): Stat all of the entries in
/etc/mtab and/or /proc/mounts in order to catch dim-witted
system administrators who might have created alias
devices.
hangeLog
smounted.c
19007e51a548d1e0eff01025dde9f147a0beb26d 24-Dec-2001 Theodore Ts'o <tytso@mit.edu> Move linux/jbd.h to ext2fs/kernel-jbd.h, to avoid using the
system header file version of hbd.h when using diet glibc
(since it forcibly adds /usr/include to the beginning of include
search path.)
hangeLog
akefile.in
fs_compat.h
fs_user.h
ernel-jbd.h
ernel-list.h
4ea7bd04390935e1f8b473c8b857e518df2e226b 17-Dec-2001 Theodore Ts'o <tytso@mit.edu> Fix various gcc -Wall nits. Fixed a bug in mke2fs where a bogus
error message could be printed on an malloc() failure, and e2image
was optimized to avoid needless system calls by using the stashed
inode functions.
hangeLog
itops.h
xt_attr.c
ileio.c
8cf93332d180e6929d73cd8c855c3a83d6a6648c 16-Dec-2001 Theodore Ts'o <tytso@mit.edu> Fix e2fsck's handling of external journals,and update journal
recovery files from 2.4.17-pre8.
hangeLog
akefile.in
fs_user.h
bd27880b4ba42544f30a08ac3b6ba86190da021b 03-Dec-2001 Theodore Ts'o <tytso@mit.edu> unix_io.c (unix_open): Make sure the ulimit workaround works
regardless of the version of glibc which is used to
compild e2fsprogs.
hangeLog
nix_io.c
571fc5a89c17985626df29823617b63094d10b31 02-Dec-2001 Theodore Ts'o <tytso@mit.edu> Fixes necessary for e2fsprogs to work using the diet libc.

- Renamed linux/list.h to be linux/linked_list.h to work around a
problem caused by diet libc insistence to search the kernel
header files ahead of all other files in the include path,
including the user specified include files.

- Worked around a bug in diet libc which core dumps when using
putc with stderr by using fputs instead. As a bonus, this
also shaved a few bytes off of com_err.o.

- Fixed a real bug in debugfs which was detected because diet libc
was more sensitive than glibc when incorrectly using fclose()
where pclose() is required.
akefile.in
8880e7599ced6d047626dd45665b765d0f5eded5 27-Nov-2001 Theodore Ts'o <tytso@mit.edu> unix_io.c (unix_open): Work around a bug in 2.4.10+ kernels by
trying to unset the filesize limit if at all possible,
if a block device is getting opened. (The filesize limit
shouldn't be applied against writes to a block device, but
starting in 2.4.10, the kernel is doing this.)
hangeLog
nix_io.c
5bc28df0fa2544a08b65d9091fdc9fb23bdbce68 09-Nov-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_add_journal_inode): When creating a .journal
file on adding a journal to an already-mounted filesystem,
try to clear the ext2 file attributes on an already
existing .journal file so that we don't fail if on a
partially added journal to the filesystem.
hangeLog
kjournal.c
b3f5b4c22939daba86465d05842bce76053bc3cf 06-Nov-2001 Theodore Ts'o <tytso@mit.edu> Define a new ext2 file attribute, EXT2_NOTAIL_FL,
which signals that a particular inode should not have the
last bits of data (the "tail") be merged with another
file. This is necessary to keep programs like LILO happy.
hangeLog
xt2_fs.h
fbf91112163add26bd9d44e992afa31a47790588 20-Sep-2001 Theodore Ts'o <tytso@mit.edu> Update changelogs for 1.25 release.
hangeLog
2038b636b2a72d997b7a6b4123e50d7f8dcb7108 14-Sep-2001 Theodore Ts'o <tytso@mit.edu> ismounted.c (check_mntent_file): We now validate the entry in
/etc/mtab to make sure the filesystem is really mounted,
since some broken distributions (read: Slackware) have
buggy boot scripts that don't initialize /etc/mtab before
checking non-root filesystems. (Slackware also doesn't
check the root filesystem separately, and reboot if the
root filesystem had changes applied to it, which is
dangerous and broken.)
hangeLog
smounted.c
7746cad695fb6708f2e1e68bc16eddcf75e4a281 17-Sep-2001 Theodore Ts'o <tytso@mit.edu> ext2_ext_attr.h: Remove unneeded #include of <linux/config.h>
which was breaking the build on the hurd. (Addresses
Debain bug #112414)
hangeLog
xt2_ext_attr.h
fb70775b0f5cb54730a294e88c7c80f0810a871b 04-Sep-2001 Theodore Ts'o <tytso@mit.edu> Update for 1.24a release
hangeLog
109624a133f147b13903f59d585b20446a3c538f 31-Aug-2001 Theodore Ts'o <tytso@mit.edu> Update for 1.24 release.
hangeLog
eddeb56f9f14b6d06a6108b626e863e4a43535e0 30-Aug-2001 Theodore Ts'o <tytso@mit.edu> getsize.c (ext2fs_get_device_size): Back out BLKGETSIZE64
changes, since the ioctl number has been reused by another
unofficial patch.
hangeLog
etsize.c
943ed874fc76bebf38288ebf0069718375f7f377 27-Aug-2001 Theodore Ts'o <tytso@mit.edu> Add missing log entry showing when we released e2fsprogs 1.23
hangeLog
89a6ebd524891f332aad8ca0281935159ddc1217 06-Aug-2001 Theodore Ts'o <tytso@mit.edu> Performance enhancements to speed up creating a journal and
block and inode allocation in general.
hangeLog
lloc.c
kjournal.c
d007cb4cbb4b8b190ffd9a597f0e88ea365926c5 05-Aug-2001 Theodore Ts'o <tytso@mit.edu> Cleanup changes to Andreas' symlink patch. Remove use of EXT2_LINK_DIR

Also cleaned up the symlink handling code to make it a bit more
compact and to test for a bad symlink block earlier.
xt2_fs.h
67052a8aeeca8cd80d1dd33c2792f917573accc8 04-Aug-2001 Andreas Dilger <adilger@clusterfs.com> Add extra checks for bad symlinks, including zero length symlinks,
too long i_size for slow and fast symlinks, i_size_high set, multiple
blocks for slow symlinks.
xt2_fs.h
3751721fbb2b72cf99dff3755249357ef5372205 29-Jul-2001 Theodore Ts'o <tytso@mit.edu> finddev.c (scan_dir): Fix memory leak; we weren't calling
closedir() when exiting the function in all cases.
hangeLog
inddev.c
4e40f6c348b9c9f4bd9c82c2b5404c2eabbdc1d3 28-Jul-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_create_journal_superblock): Set the first block
usable in the journal for external journals to be 2 or 3,
depending on the blocksize, so that the existing kernel code
does the right thing.
hangeLog
kjournal.c
343fa65e9fc67e55717d622ee1db6553dc2285b4 28-Jul-2001 Theodore Ts'o <tytso@mit.edu> getsize.c (ext2fs_get_device_size): Add support for the
BLKGETSIZE64 ioctl. (Ioctl defined by unofficial patches
from Ben LaHaise, but it's likely this interface won't
change.)
hangeLog
etsize.c
f35e6440ef09dca989d98213c1be62efd1ee183a 27-Jul-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_add_journal_device): Use the correct block
when writing the journal superblock, too. (Oops! Needed
to make 1k filesystems with external journal to work.)
hangeLog
kjournal.c
36131b37d7d37ad59153cc2c56f774e28e286acf 27-Jul-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_add_journal_device): Use the correct block
to find the journal superblock if the blocksize is 1024.
hangeLog
kjournal.c
adee8d75db09dc8ecb2a32f59a8c64d3f4c64b0e 23-Jul-2001 Theodore Ts'o <tytso@mit.edu> Add support for use of an external journal (so long as the external
journal only has one filesystem).
hangeLog
xt2_err.et.in
241f7d20680982dc710dbd472bedef33e6b9f5ea 20-Jul-2001 Theodore Ts'o <tytso@mit.edu> ext_attr.c (ext2fs_write_ext_attr): When writing the extended
attribute block, set the filesystem changed bit.
hangeLog
xt_attr.c
6ae296e7349bdf9393b2531f4acd84dd586546f6 20-Jul-2001 Theodore Ts'o <tytso@mit.edu> Comment out ext2_find_first_bit_set and ext2fs_find_next_bit_set
since we're not using them.
hangeLog
itops.h
3c6b8977d44c66f0a50dd77c18a78b57b1022f8c 10-Jul-2001 Theodore Ts'o <tytso@mit.edu> Speed up journal recovery in userspace by avoiding a pointless
unconditional ext2_flush() call. Also made ext2_flush() more
efficient when the superblock is modified after the filesystem has
been flushed, and make it clear the superblock dirty flag
after doing the superblock/block group descriptor flush.
hangeLog
losefs.c
f41e7e6961366f15eca8c05edbf5a35f4a9b3b65 08-Jul-2001 Theodore Ts'o <tytso@mit.edu> bitops.h (ext2fs_find_first_bit_set): Use %esi instead of %ebx to
avoid register conflicts when compiling in PIC mode.
hangeLog
itops.h
ac493821ea0af9767a4c0f21a322133494bcdc48 04-Jul-2001 Theodore Ts'o <tytso@mit.edu> Add new functions to bitops.h to find quickly search for set bits in
a bitmask. (In both C and i386 assembler).
hangeLog
akefile.in
itops.h
st_bitops.c
342d847db355d81299218e07a1e58ece82080a04 02-Jul-2001 Theodore Ts'o <tytso@mit.edu> Add initial support for extended attribute blocks
hangeLog
akefile.in
xt2_ext_attr.h
xt2fs.h
xt_attr.c
67960139d73fb99f579e8447b9f1c743581b6610 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> Update changelogs for 1.22.
hangeLog
b23520d0501095dee715d0829c365933c216e612 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_add_journal_inode): Move close of file
descriptor so that adding a journal to a mounted
filesystem doesn't die. (Fixes a bug accidentally
introduced in e2fsprogs 1.21.)
hangeLog
kjournal.c
7833262585b0f9f85915c387fa35708cf3ff3609 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> mkjournal.c (ext2fs_add_journal_inode): Only use fchflags if
HAVE_CHFLAGS and UF_NODUMP are defined, since the Hurd has
fchflags without defining UF_NODUMP. (Addresses Debian
bug #101361)
hangeLog
kjournal.c
d90f3494b219f9fe327eaa561faf75582f65ad9e 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> e2fsck/flushb.c and lib/ext2fs/flushb.c: Use platform independent
method of defining the BLKFLSBUF and FDFLUSH ioctl's.
Also include sys/mount.h since on newer glibc's BLKFLSBUF
is defined there.
hangeLog
lushb.c
16645f802a809195757f04daa421356f90dc5857 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> bitops.h: The C language versions of ext2fs_swab16/32 need to be
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).
hangeLog
itops.h
89a1fa831f466cb4c79f5e4ea1db36aa479a1355 23-Jun-2001 Theodore Ts'o <tytso@mit.edu> dirblock.c (ext2fs_read_dir_block): Remove use of dir_entry_2 since
the byte-swapping code all assumes the ext2_dir_entry structure.
(It's a question of whether or not name_len should be byte-swapped or
not, and whether it's a 16 bit or 8 bit field.)
hangeLog
irblock.c
f4f75bae8520ae44e9c593c4d90c7bfdb6b5139a 16-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog:
Update for 1.21 release.
hangeLog
d1e66b79360761ee6011202830536c2fe0459d0a 16-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in:
Makefile.in: Fix bug in installation of ext2_types.h. It is a file
which is generated and is therefore found in the build directory, not
source directory.
hangeLog
akefile.in
997b820e94468aeb3fb1a6fd38bc52e34af6f9e6 15-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ismounted.c:
ismounted.c (check_mntent_file): Use a test file in / to check to see
if the root filesystem is mounted read-only. This protects against
the case where /etc might not be on /, as well as the case where
/etc/mtab doesn't exist. (Both are should-never happen scenarios, but
you never know...)
hangeLog
smounted.c
6bd134809ca75741941f41c11fa2b24fbc5ecfac 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ismounted.c:
ismounted.c (ext2fs_check_if_mounted): Fix grammer in comment. Remove
unneeded #pragma argsused, since the arguments are always used.
hangeLog
smounted.c
6579488028f0fcd8173f49f11971ee0a4f9c99cb 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_types.h.in:
ext2_types.h.in: If linux/types.h has been defined, then don't try to
redefine the typedefs.
ChangeLog, Makefile.in:
Makefile.in: Make the install target depend on $(SUBS) to accomodate
the fools who want to compile and install e2fsprogs as root using just
one command.
hangeLog
xt2_types.h.in
364a373e16efda7b6f5b7bdc992594ec04ffcc14 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, setsuper.c:
setsuper.c: Add s_lastcheck field to the fields which can be modified
using set_super_value. (Suggested by Andreas Dilger)
ChangeLog, Makefile.in:
Makefile.in (HFILES): Add ext2_types.h to the list of files which
should be installed.
hangeLog
akefile.in
83d5abf1d781a1d46af193bf439bb813ceb6e061 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog:
Add debian bug number reference.
Add debian bug reference.
hangeLog
66a461469ccafd7aad2a824b0ab66fd9096d6e94 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ismounted.c:
ismounted.c (check_mntent_file): Work around GNU hurd brain damage.
hangeLog
smounted.c
30ae14c9ded3c52e9fcf4869057cbc3b9927afb2 14-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in:
Makefile.in: Limit some .o files from being included into the library
if --disable-debugfs, --disable-swapfs, --disable-imager, or
--disable-resizer are used.
hangeLog
akefile.in
cbbf031b6edf9bdf5511af2193e44cff7fdaa66a 13-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, dumpe2fs.c, mke2fs.c:
dumpe2fs.c: Use WORDS_BIGENDIAN to determine whether or not we're
(not) using i386 byte order.
dumpe2fs.c, mke2fs.c: Stop using the compatibility badblocks function,
and use the ext2fs_badblocks_* functions instead.
ChangeLog, inode.c, tst_iscan.c:
inode.c, tst_iscan.c: Stop using the compatibility badblocks function,
and use the ext2fs_badblocks_* functions instead.
ChangeLog, badblocks.c:
badblocks.c: Stop using the compatibility badblocks function, and use
the ext2fs_badblocks_* functions instead.
hangeLog
node.c
st_iscan.c
3034f62a0f9c31e6dce8bd1237cffd3851847250 11-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, bitops.h, gen_bitmap.c:
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.
hangeLog
akefile.in
itops.h
en_bitmap.c
5df55d7f847e29d23227592a0bb23daad1a61500 11-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, swapfs.c, 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.
hangeLog
itops.h
lock.c
map.c
losefs.c
irblock.c
xt2fs.h
nitialize.c
node.c
ative.c
penfs.c
w_bitmaps.c
wapfs.c
349a484a57ab13fed315f72552bdf8dbf89ba72a 11-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, mkjournal.c:
Makefile.in: Remove the dependence on the libe2p library.
mkjournal.c (ext2fs_add_journal_inode): Replace use of fsetflags with
direct usage of the ioctl/fchflags so that we don't have to depend on
the libe2p library.
hangeLog
akefile.in
kjournal.c
30e50b7cdd6f5bbd5f2d6a2ee8ce0d4522336397 08-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, icount.c:
icount.c (insert_icount_el): Fix the code used to estimate the size of
the new icount array to be more intelligent, to avoid reallocating the
array too many times.
ChangeLog, ext2_types.h.in:
ext2_types.h.in: Use unsigned ints in favor of unsigned longs when
trying to find a 32-bit wide type.
hangeLog
xt2_types.h.in
count.c
f36d14f5f0c9b97f52fdc2047179457d6fe2c52d 02-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, valid_blk.c:
valid_blk.c (ext2fs_inode_has_valid_blocks): Only check i_blocks for a
symlink to determine whether it is a fast symlink.
hangeLog
alid_blk.c
36a23e1806067074f0278de31dc94fe50d840cb0 02-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog:
Fix typo in ChangeLog.
hangeLog
797f5ef14e92294b329e52971d467d7af5b2993e 02-Jun-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, wordwrap.pl:
Makefile.in: Move include/asm/types.h.in to lib/ext2fs/ext2_fs.h.in.
wordwrap.pl: Add some rules which help fix up the dependencies.
Many files:
Move include/asm/types.h.in to lib/ext2fs/ext2_fs.h.in.
hangeLog
akefile.in
osio.c
xt2_fs.h
xt2_types.h.in
xt2fs.h
bb185861d10f84b452260c6d8b89abaa23c67408 25-May-2001 Theodore Ts'o <tytso@mit.edu> e2fsprogs.lsm, version.h:
Update version string for 1.20 release
ChangeLog:
Update Changelogs for 1.20 release.
hangeLog
d5f858dd7f02532ad90e4121537c358e86d0eecf 25-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ismounted.c:
ismounted.c: More cleanups for ismounted.c, some from Andreas, some to
clean up Andreas's patches. Use strncpy instead of strcpy to save the
root's mountpoint. Clean up #ifdef structure. Remove uneeded
variable in testing/debug driver.
hangeLog
smounted.c
cc86017b593ddfbd4d7a12ed8695e62998f30944 25-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ismounted.c:
ismounted.c: Add check for root device which doesn't depend on
/etc/fstab or /proc/mounts to be correct. Don't call endmntent()
before we are done with mnt struct.
hangeLog
smounted.c
4ed8ebe2684aa3863ce8286d29195baf5e879876 23-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_err.et.in:
ext2_err.et.in (EXT2_ET_JOURNAL_UNSUPP_VERSION): Added new error code.
hangeLog
xt2_err.et.in
b10820cdcd5f007894b81cf716cf1fdd8523bbca 21-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_fs.h:
ext2_fs.h: Change assignment of EXT2_FEATURE_COMPAT_DIR_INDEX to make
room for pre-existing usage of EXT2_FEATURE_COMPAT_EXT_ATTR. Add flag
EXT2_INDEX_FL with the same codepoint as EXT2_BTREE_FL.
hangeLog
xt2_fs.h
7c2d25699f2da458ba8201a375b00562d7a2469e 21-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h: #include <> instead of "" for ext2fs and et header files,
since they will be installed in /usr/include
ChangeLog, e2p.h:
e2p.h: #include <> instead of "" for ext2fs and et header files, since
they will be installed in /usr/include
hangeLog
xt2fs.h
9f8046fc6dfc13eee2f5c363214e60b533872cac 14-May-2001 Theodore Ts'o <tytso@mit.edu> Many files:
alloc.c, alloc_tables.c, badblocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c, dblist_dir.c,
dir_iterate.c, dirblock.c, dupfs.c, expanddir.c, ext2_fs.h, fileio.c,
finddev.c, flushb.c, freefs.c, get_pathname.c, getsize.c, icount.c,
imager.c, initialize.c, inline.c, inode.c, irel_ma.c, ismounted.c,
link.c, lookup.c, mkdir.c, mkjournal.c, namei.c, native.c, newdir.c,
nt_io.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c, tst_byteswap.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c, write_bb_file.c, ext2_fs.h: Moved file from include/linux.
Adjust all files in this directroy to include this file.
hangeLog
akefile.in
lloc.c
lloc_tables.c
adblocks.c
b_compat.c
b_inode.c
itmaps.c
itops.c
lock.c
map.c
move.c
rel_ma.c
heck_desc.c
losefs.c
mp_bitmaps.c
blist.c
blist_dir.c
ir_iterate.c
irblock.c
upfs.c
xpanddir.c
xt2_fs.h
ileio.c
inddev.c
lushb.c
reefs.c
et_pathname.c
etsize.c
count.c
mager.c
nitialize.c
nline.c
node.c
rel_ma.c
smounted.c
ink.c
ookup.c
kdir.c
kjournal.c
amei.c
ative.c
ewdir.c
t_io.c
penfs.c
ead_bb.c
ead_bb_file.c
s_bitmap.c
w_bitmaps.c
wapfs.c
est_io.c
st_badblocks.c
st_byteswap.c
st_getsize.c
st_iscan.c
nix_io.c
nlink.c
alid_blk.c
ersion.c
rite_bb_file.c
7a34cb01a97d39842c610dd609b525eadd0a1de2 14-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, mkjournal.c:
mkjournal.c (ext2fs_create_journal_superblock): Remove redundant code.
hangeLog
kjournal.c
a777397e228243cdc35056b14956db7280b0844c 14-May-2001 Theodore Ts'o <tytso@mit.edu> openfs.c:
Update documentation about what flags are valid for ext2fs_open().
penfs.c
2521f52dddc604d9f173eeb3343218425484d045 11-May-2001 Theodore Ts'o <tytso@mit.edu> Makefile.in:
Update make depend information.
akefile.in
0f6794591edf238825f8ab80c885e83d1efbf203 05-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, fileio.c:
fileio.c (ext2fs_file_read): Factored out common code and cleaned up
function. Fixed a bug where if there was an error reading from the
disk, the number of bytes read wasn't reliably set. (Fixes Debian bug
#79163)
(ext2fs_file_write): Factored out common code and made function more
efficient; if writing a full block, don't bother to do a
read-modify-write cycle.
hangeLog
ileio.c
bfcd9a116ff3bcc6d94a616ab1444eb38d0d5434 05-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, expect, name, script:
d_loaddump: New test which verifies debugfs's dump and load routines.
dirblock.c:
Fix misc. gcc -Wall errors
irblock.c
1cca4d60367c89bcdeb2ee6f1d54ab6f393f289d 05-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, dirblock.c:
dirblock.c (ext2fs_read_dir_block): Check for an directory record
length which isn't a multiple four, and treat that as an invalid.
Scan the directory and return an error (EXT2_ET_DIR_CORRUPTED) if the
directory records are orrupted.
(ext2fs_write_dir_block): If while byte-swapping the directory block,
if there's an error, abort and return EXT2_ET_DIR_CORRUPTED.
hangeLog
irblock.c
a78926effb15bbabb1c0ed3e438b03be25c4d48c 03-May-2001 Theodore Ts'o <tytso@mit.edu> Many files:
ext2fs.h (EXT2_FLAG_IMAGE_FILE): Add new flag, and add image_header
field in the ext2_filsys structure
block.c (block_iterate_ind, block_iterate_dind, block_iterate_tind):
inode.c (ext2fs_read_inode):
rw_bitmaps.c (read_bitmaps):
openfs.c (ext2fs_open): Add support for EXT2_FLAG_IMAGE_FILE
imager.c (ext2fs_image_bitmap_read): Fix bug in imager to make sure
the full bitmap is saved.
hangeLog
lock.c
2image.h
xt2fs.h
mager.c
node.c
penfs.c
w_bitmaps.c
f955cc14257e410a3e44457af4c6b75c1ef427f6 01-May-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, dir_iterate.c:
dir_iterate.c (ext2fs_process_dir_block): Add a double-check to make
sure the rec_len is a multiple of 4, to prevent bus-errors on
architectures which care about mis-aligned pointer references.
hangeLog
ir_iterate.c
954a683dd0353d280d56b3d70b5e8f24e88b3d2f 26-Apr-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, getsize.c:
getsize.c (ext2fs_get_device_size): Use an unsigned long to query the
device sizes using the BLKGETSIZE ioctl.
hangeLog
etsize.c
52db0b4178553318aac08bb9cdc1d42743e6beeb 17-Apr-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, ismounted.c:
ismounted.c (check_mntent): Check /proc/mounts on Linux systems before
checking /etc/mtab. The EXT2_MF_READONLY flag is now set from the
/etc/mtab options field for all filesystems, not just the root
filesystem. Add debugging code to make it easier to test
ext2fs_check_if_mounted().
hangeLog
akefile.in
smounted.c
036039460ff76f397bc23977a26632698136b0e6 17-Apr-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_err.et.in, mkjournal.c:
mkjournal.c (ext2fs_create_journal_superblock): Add safety check;
return an error if there's an attempt to create a journal less than
1024 filesystem blocks.
ext2_err.et.in, mkjournal.c: Change EXT2_JOURNAL_NOT_BLOCK and
EXT2_NO_JOURNAL_SB to be EXT2_ET_*.
hangeLog
xt2_err.et.in
kjournal.c
9ec53cf4f32cc65e91a9c71651f05a6d872a7088 20-Feb-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, bitops.h, tst_byteswap.c:
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.
hangeLog
akefile.in
itops.h
st_byteswap.c
c5423c5b3ea549d96d1b3315a96b5b58beca75cd 08-Feb-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, e2image.c:
e2image.c (main): Add code to write the e2image header.
ChangeLog, e2image.h:
e2image.h (struct ext2_image_hdr): Fix type for fs_hostname
hangeLog
2image.h
d23042af75f2723ed4575946cfa310fca4e526ef 08-Feb-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, mkjournal.c:
mkjournal.c (ext2fs_create_journal_superblock): Fix the setting of
s_first for external devices to always be 1, since jsb->s_first is
always relative to the start of the journal superblock. Use htonl(1)
when setting s_nr_users.
hangeLog
kjournal.c
a05c589a5ef9959ac91f9b56bba9e61aeacb9d9c 18-Jan-2001 Theodore Ts'o <tytso@mit.edu> Makefile.in:
Update makefile dependencies
akefile.in
020888625fb8f6d5293e67da95ae18c0af45aead 18-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, mkjournal.c:
mkjournal.c (ext2fs_add_journal_device): Fix bug where the device
number of the filesystem (instead of the journal) was being dropped
into s_journal_dev.
ChangeLog, dumpe2fs.c:
dumpe2fs.c (print_journal_information): Use s_first_data_block to find
the correct block to read the journal superblock.
hangeLog
kjournal.c
a112847b39386f9e7332ba5e5a0a5e54cfe301cc 16-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
hangeLog
xt2_err.et.in
xt2fs.h
nitialize.c
kjournal.c
penfs.c
8077994116824ae55d4b8f9a26971a7d11e089bf 14-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, closefs.c:
closefs.c (ext2fs_flush): Don't write out anything beyond the primary
superblock if EXT2_INCOMPAT_JOURNAL_DEV is listed.
hangeLog
losefs.c
426d734ff06e769cf5117053b6264c4a9decd3b2 13-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, setsuper.c:
setsuper.c: Cleaned up some random whitespace problems.
ext2fs.h:
Fixed spelling mistake in comment.
xt2fs.h
b94bd81ae2c514c9a75218e3b6146606684f729b 12-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, imager.c:
imager.c: Fix gcc -Wall complaints and a series of bugs where retval
wasn't set correctly. (Thanks to Andreas Dilger for pointing this
out.)
hangeLog
mager.c
4d0f3e17a5b7556505fe437680070fe3bb140d67 11-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, MCONFIG.in, configure, configure.in:
MCONFIG.in: Change --enable-gcc-wall handling so that it's no longer a
configure option, but something which is done when the developer uses
the command "make gcc-wall".
configure.in: Remove test for ino_t, since we don't use it any more
(we always use our own ext2_ino_t). Remove --enable-gcc-wall support.
Add test for sys/ioctl.h
.del-types.h.in~ca55114a:
Remove definition of ino_t
ChangeLog, Makefile.in, ext2fs.h, flushb.c, jump.funcs:
flushb.c (ext2fs_sync_device): New function which centralizes all of
the places which might try to use the BLKFLSBUF or FDFLUSH ioctls (and
usually failing to define them since the system header files don't
usually do this for us, and we're trying to avoid usage of kernel
include files now.)
hangeLog
akefile.in
ll/jump.funcs
xt2fs.h
lushb.c
31dbecd482405e0d3a67eb58e1a1c8cb9f2ad83e 11-Jan-2001 Theodore Ts'o <tytso@mit.edu> Many files:
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.
hangeLog
lloc.c
b_inode.c
itmaps.c
itops.h
lock.c
map.c
move.c
rel.h
mp_bitmaps.c
blist.c
blist_dir.c
ir_iterate.c
xpanddir.c
xt2fs.h
xt2fsP.h
ileio.c
inddev.c
et_pathname.c
count.c
node.c
rel.h
rel_ma.c
smounted.c
ink.c
ookup.c
kdir.c
kjournal.c
amei.c
ewdir.c
ead_bb_file.c
est_io.c
st_iscan.c
nix_io.c
nlink.c
e446d71838c8fde06e59bd4eb01de031825c6f2b 05-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, dirblock.c:
dirblock.c (ext2fs_read_dir_block): Fix a potential case where we may
overrun allocated memory in case of a corrupted filesystem (or an
e2fsck test case :-) when byte-swapping the directory block.
hangeLog
irblock.c
cdaf1fa78f6d63457eb5337c14b23e567d1346a7 05-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, mkjournal.c:
mkjournal.c (ext2fs_add_journal_device): Fix various gcc -Wall
complaints including a missing return 0 at the end of
ext2fs_add_journal_device.
ChangeLog, ext2fs.h:
ext2fs.h: Indent the #warning to fix gcc -Wall complaint.
hangeLog
xt2fs.h
kjournal.c
4becab6824aa5fdb022a293ae0b4622784496256 03-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, mkjournal.c:
Makefile.in: Link in libe2p when creating libext2fs as a shared
library, since mkjournal.c now references fsetflags().
mkjournal.c (ext2fs_add_journal_inode): Folded in Andreas Dilger's
changes (with fixups) to allow on-line creation of a journal file.
.del-types.h.in~ca55114a:
Change what we use to protect the header file to be _ASM_TYPES_H
instead of _LINUX_TYPES_H. (Needed to make libc5 builds happy).
version.h:
Update for WIP release.
hangeLog
akefile.in
kjournal.c
43ec8734f2ecd0a345e831f45fd3dfb077426811 03-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h, ismounted.c:
ismounted.c: add ext2fs_check_mount_point() function, which will
optionally return the mount point of a device if mounted
ChangeLog, closefs.c, ext2fs.h:
ext2fs.h, closefs.c (ext2fs_flush): Add new flag,
EXT2_FLAG_SUPER_ONLY, which the close routines to only update the
superblock, and not the group descriptors.
hangeLog
losefs.c
xt2fs.h
smounted.c
31a17b36d5f7d875f9de8e86501eaf2338f94d2b 03-Jan-2001 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h, mkjournal.c:
mkjournal.c: rename ext2fs_add_journal_fs() to the more descriptive
ext2fs_add_journal_inode()
hangeLog
xt2fs.h
kjournal.c
e5b38a5fafe4807b54d90a2e70bddf4b41b1695b 01-Jan-2001 Theodore Ts'o <tytso@mit.edu> Many files:
ext2fs.h: Remove definition of ext2fs_sb. Note: this may break source
(but not binary) compatibility of some users of the ext2 library.
They should just simply do a global search and replace of struct
ext2fs_sb with struct ext2_super_block, and use their own private copy
of ext2_fs.h if they aren't already.
closefs.c, initialize.c, link.c, newdir.c, openfs.c, swapfs.c: Replace
use of ext2fs_sb with ext2_super_block.
ChangeLog, main.c:
main.c (main): Replace use of struct ext2fs_sb with struct ext2_super_block.
hangeLog
losefs.c
xt2fs.h
nitialize.c
ink.c
ewdir.c
penfs.c
wapfs.c
2fe1efe2e56dc9f8223992301aec3844dd9563e6 31-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h: Cleaned up header file by removing definitions of feature
flags that might not have been defined in older ext2 header files.
Now that we're using our own include/linux/ext2fs.h header file, this
can never happen.
jfs_dat.h: Removed old header file which is no longer needed.
ChangeLog:
jfs_compat.h: Remove uneeded header file.
hangeLog
xt2fs.h
a917d1ccf49605b3009f4e7225f00b81fc16100b 13-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, closefs.c, ext2fs.h, jump.funcs, super.c:
Rename _ext2fs_update_fs_dynamic_rev to _ext2fs_update_dynamic_rev
hangeLog
losefs.c
ll/jump.funcs
xt2fs.h
db6c40bcc1c289da87b6687a5163f07904abf000 13-Dec-2000 Theodore Ts'o <tytso@mit.edu> swapfs.c:
Fix stupid typo.
wapfs.c
3fe973b3068f68bb9d3ea6ba309dc7d2df30301f 13-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, closefs.c, ext2fs.h, jump.funcs:
closefs.c (ext2fs_update_fs_dynamic_rev): New function suggested by
Andreas Dilger to update the filesystem revision to EXT2_DYNAMIC_REV.
hangeLog
losefs.c
ll/jump.funcs
xt2fs.h
7dcfa6e21762e57b97031e88251cb9994318f339 13-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, swapfs.c:
swapfs.c (ext2fs_swap_super): Add byte swapping for the journal fields.
hangeLog
wapfs.c
4e246704eab31407ac15be9ab206c6f929507cf0 09-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h, mkjournal.c:
ext2fs.h, mkjournal.c (ext2fs_add_journal_fs,
ext2fs_add_journal_device): Add a new argument to the APIs of these
function, which is a flags word. This is used to allow the creation
of a V1 superblock for those folks who are using ext3 0.3b in
production. Note, the user-land interface for getting at this flag
won't be documented, as the V1 superblock is deprecated.
hangeLog
xt2fs.h
kjournal.c
0e8a9560d89dd9cca73037a59efa93e46abdccda 09-Dec-2000 Theodore Ts'o <tytso@mit.edu> Many files:
jfs_e2fsck.h, jfs_user.h: Replaces jfs_compat.h. The jfs.h file has
been moved to the include/linux directory.
journal.c, revoke.c, recovery.c: Updated files from Stephen to support
the V2 superblock and revoke processing. The journal.c and revoke.c
files are copies from the ext3 kernel source.
Makefile.in: Added revoke.c to the list of source/object files.
Makefile.in:
Fix up some mistakes in the source file list, and regenerate the
dependencies.
Update Makefile dependencies.
ChangeLog, jfs.h:
jfs.h: Remove excess #include of JFS_DEBUG. Not needed for e2fsprogs,
since we optioanlly define it in the configuration file system.
akefile.in
586187372afea65ae685687505b49b40fc5f3212 09-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, jfs_user.h, mkjournal.c:
mkjournal.c (init_journal_superblock): Sync Stephen's changes which
creates a V2 superblock instead of a V1 superblock.
ChangeLog, jfs.h, jfs_compat.h, list.h:
jfs.h, jfs_compat.h, list.h: New files added to support ext3.
hangeLog
fs_user.h
kjournal.c
f20d0d57f73f7eb7fc801b85921cff4a3d90e385 05-Dec-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, test_io.c:
test_io.c (test_write_blk, test_write_byte): Fix typos pointed out by
Andreas Dilger.
hangeLog
est_io.c
72ed12648368b3f3ea14e8102e20bf5d3a3be6d3 12-Nov-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, e2image.h, ext2_err.et.in, ext2fs.h, imager.c:
imager.c (ext2fs_image_{inode,super,bitmap}_{read,write}, ext2_fs.h,
Makefile.in: New file that has routines that save ext2fs metadata to a
file.
ext2_err.et.in (EXT2_ET_MAGIC_E2IMAGE): New error code assigned.
e2image.h: New file which defines the file format for the ext2 image
file. (Saved copy of ext2 metadata to a file as a saving throw
against worst-case damage.)
ChangeLog, Makefile.in, e2image.c:
e2image.c, Makefile.in: New program which saves ext2 metadata to a
file for people who need a last-ditch saving throw.
hangeLog
akefile.in
2image.h
xt2_err.et.in
xt2fs.h
mager.c
6a7f455bb129e867407fe1961328931ff704b3d2 12-Nov-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, inode.c:
inode.c (ext2fs_flush_icache): Add new function ext2fs_flush_icache()
which flushes the internal inode cache. Applications which modify the
inode table blocks directly must call this function.
hangeLog
node.c
17ee8b17f91988a3beedbd96eec4642e784f3251 26-Oct-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, mkjournal.c:
mkjournal.c: Add #include of netinet/in.h, since Solaris requires it
for ntohl().
hangeLog
kjournal.c
c180ac86533bcbfb1560bd4aa01464785a760f70 26-Oct-2000 Theodore Ts'o <tytso@mit.edu> Many files:
ext2_io.h (io_channel_write_byte): Add new interface to allow callers
to write specific byte ranges. This is an optional interface, which
not all IO channels may implement.
unix_io.c (unix_write_byte): test_io.c (test_write_byte): Add
implementation of the write_byte function.
closefs.c (write_primary_superblock, ext2fs_flush): Add a new function
which writes the primary superblock. If the IO channel supports
writing raw bytes directly, only fields which were modified are
written to the disk. This makes it safe(r) to use utilities like
tune2fs on a mounted filesystem.
freefs.c (ext2fs_free): Free the original superblock if it is available.
openfs.c (ext2fs_open): Store a copy of the original superblock when
opening it.
ext2fs.h: Add a field to store the original superblock in the ext2
context structure.
hangeLog
losefs.c
xt2_io.h
xt2fs.h
reefs.c
penfs.c
est_io.c
nix_io.c
438196669574f87493b153b2dee93f5eeba1844e 25-Oct-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, llseek.c:
llseek.c: Add #ifdef's for IA64 (it's a 64-bit platform, so we don't
need to use llseek).
ChangeLog, fsck.c:
fsck.c (device_already_active): Add a special case check for MD
devices, so we don't try to check them in parallel with other devices.
hangeLog
lseek.c
d3cd93cabeac8c153c8ae7b1b7358d6ced86b15e 24-Oct-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, ext2_err.et.in, ext2fs.h, jfs_dat.h, mkjournal.c:
Makefile.in, ext2fs.h, jfs_dat.h, mkjournal.c: Add functions for
creating an ext3 journal on a filesystem.
ext2_err.et.in (EXT2_JOURNAL_NOT_BLOCK): Add new error code.
.del-ext2_fs.h~7a460879, ChangeLog:
ext2_fs.h (EXT2_JOURNAL_INO): Add definition for EXT2_JOURNAL_INO;
reserve inode #7 for EXT2_RESIZE_INO.
TODO:
Commit TOOD suggestion.
hangeLog
akefile.in
xt2_err.et.in
xt2fs.h
fs_dat.h
kjournal.c
adfc8c6c9902c3f08c79a44c1927971175f9d947 18-Oct-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2_io.h, unix_io.c:
unix_io.c: Make massive changes to support a multiple block
writethrough cacheing.
ext2_io.h: Added flags field to the io_channel structure.
hangeLog
xt2_io.h
nix_io.c
f86fa6c7483f6fee33fb128fced4644ec876a1bc 20-Aug-2000 Theodore Ts'o <tytso@mit.edu> finddev.c:
Fix stupid bug in finddev.c which could cause things to loop if the
stat call failed.
inddev.c
de23aa1d177a67283f5f5a1f172b00527fe3b63a 19-Aug-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in, ext2fs.h, finddev.c:
finddev.c, ext2fs.h, Makefile.in: Add new file, finddev.c, which
provides the function ext2fs_find_block_device(). This function
returns the pathname to a block device, given its device number.
hangeLog
akefile.in
xt2fs.h
inddev.c
f9e67064ce720e9a8563038d07fe452ffed661bc 14-Jul-2000 Theodore Ts'o <tytso@mit.edu> configure.in:
Commit this file for future use; contains a configure.in script for when
libuuid gets separtead out into its own package.
libext2fs.texinfo:
Update version numbers for 1.19 release.
TODO:
Commit TODO list for 1.19 release.
README:
Update file for 1.19 release.
ChangeLog, e2fsprogs.spec:
e2fsprogs.spec: Merge in a few changes from the Red Hat 6.2 spec file,
now that we're using a modern rpm to build e2fsprogs. Also updated
version number to 1.19.
version.h:
Update version number for 1.19 release.
ChangeLog:
Check in changes for 1.19 release.
hangeLog
ab146766e3c773ef532381328772ec5e9db9e40b 07-Jul-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h (EXT2_LIB_FEATURE_INCOMPAT_SUPP): Add
EXT3_FEATURE_INCOMPAT_RECOVER (aka needs_recovery) to the list of
filesystem flags supported by the library.
ChangeLog, e2fsprogs.spec:
e2fsprogs.spec (%post): Remove resize2fs from its old location in
/usr/sbin in the postinstall script.
RELEASE-NOTES, version.h:
Update for WIP release.
hangeLog
xt2fs.h
8f13d8cb5c8f0419003b7114d293cf1046947f1b 04-Jul-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h: Update to include latest journalling additions to the superblock.
.del-ext2_fs.h~7a460879, ChangeLog:
ext2_fs.h: Update to include latest journalling additions to the
superblock.
hangeLog
xt2fs.h
57dca85467cf3fc61565e916a5f2e35db8020d88 04-Jul-2000 Theodore Ts'o <tytso@mit.edu> Many files:
tst_badblocks.c: Update test program to test ext2fs_read_bb_FILE2 and
ext2fs_write_FILE.
write_bb_file.c (ext2fs_write_bb_FILE): New function which writes out
bad blocks list to a file.
read_bb_file.c (ext2fs_read_bb_FILE2): Add new function which changes
the callback function to take two additional arguments; a private
blind pointer supplied by the caller, and pointer to a char *
containing a pointer to the invalid string.
badblocks.c (ext2fs_badblocks_equal): Add new function which returns
true if two badblocks list are equal.
Makefile.in: Remove explicit link of -lc in the shared library. (It
shouldn't be necessary, and is harmful in some cases).
jump.funcs:
dll/jump.funcs: Add new jumptable entries for ext2fs_write_bb_FILE,
ext2fs_read_bb_FILE2, and ext2fs_badblocks_equal.
hangeLog
akefile.in
adblocks.c
ll/jump.funcs
xt2fs.h
ead_bb_file.c
st_badblocks.c
rite_bb_file.c
abf7d3880b84994783437e291bd4e7950c4b0fe7 10-Jun-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, getsize.c:
getsize.c (main): Add debugging code under #ifdef DEBUG
hangeLog
etsize.c
2e8d40d562ec93d68505800a46c5b9dcc229264e 27-May-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, debug_cmds.ct, debugfs.8.in, debugfs.c, dump.c, ls.c:
debugfs.8.in: Documented new behaviour.
ls.c (ls_l_file): Fix Y2K bug -- was printing 22-May-100 for recent
files. Switched to 4-digit years.
dump.c, debug_cmds.ct (do_rdump): Add new debugfs command "rdump",
which recursively dumps a directory and its contents.
(fix_perms): New function. Break permission-fixing code out of
dump_file() so it can be called by rdump code as well.
(dump_file): Call fix_perms().
debugfs.c, debug_cmds.ct (do_lcd): Add new debugfs command "lcd",
which changes the cwd on the native filesystem.
debugfs.c (open_filesystem): Extra args for superblock, blocksize, and
catastrophic mode. Changed callers.
(do_open_filesys, main): Accept new -b, -s, -c options for
open_filesystem.
ChangeLog, mkdir.c:
mkdir.c (ext2fs_mkdir): Read the parent directory's inode earlier, so
that if there's an error reading it, we can more cleanly back out of
the operation.
version.h:
Update version file for WIP release.
hangeLog
kdir.c
415ed79ebcb9a48172764c7e9339001f24ef5fa2 26-May-2000 Theodore Ts'o <tytso@mit.edu> Many files:
Remove generated file.
depend
7fd86d396745cf38ed5a3b91d1570440a8e770a1 26-May-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, getsize.c:
getsize.c: Under linux, manually define the ioctl for BLKGETSIZE if it
isn't already defined and it's safe to do so.
.cvsignore:
Ignore build files when builddir==srcdir
hangeLog
etsize.c
dc5f68cad3c8ee4c583acf9afbfdb7354cd3d6af 26-May-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, getsize.c, llseek.c, unix_io.c:
getsize.c (ext2fs_get_device_size): Use open64() instead of open() if
it exists.
unix_io.c (unix_open): Use open64() instead of open() if it exists.
llseek.c: Simplify header includes of unistd.h. If lseek64 is
available (and prototypes are defined) use it in preference to llseek.
hangeLog
etsize.c
lseek.c
nix_io.c
f0f4acbdd51fde0ef72b2d275c4aac22560b2dae 26-May-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, Makefile.in:
Makefile.in: Add hack dependency rule so that parallel makes work
correctly.
hangeLog
akefile.in
bdcb8234e7783714a83b32eea25901cd43b83817 26-May-2000 Theodore Ts'o <tytso@mit.edu> .cvsignore:
Supress build files when builddir==srcdir
cvsignore
fa7ef7176ee66aaaec58a24c5a5523c4afb550dd 19-May-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h: Add appropriate ifdef's to support C++ compilation.
hangeLog
xt2fs.h
06af47f0e81c8dd75daf83c848659ef011ea5450 03-Apr-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, block.c:
block.c: Readibility tweak in conditionals involving ctx->fs->flags.
hangeLog
lock.c
e589f678e1ed5efa8dd4450f37bee0486caa3504 03-Apr-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, gen_uuid.c:
gen_uuid.c (get_random_bytes): Make more paranoid about misbehaving
/dev/urandom. If we get a return of zero without an error more than 8
times in a row, we break out and return an error. Also, if
/dev/urandom doesn't exist, try /dev/random.
ChangeLog, ext2fs.h:
ext2fs.h: Use AUTOCONF SIZEOF_* macros if available to determine how
to define __s64 and __u64. Turn off "compression is experimental"
warning if the cpp macro I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL is
defined.
hangeLog
xt2fs.h
5a63dd28f23e31f4ed47073b558fc701adf83536 11-Feb-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, ext2fs.h:
ext2fs.h: Define EXT2FS_COMPRESSED_BLKADDR and HOLE_BLKADDR.
Conditionally include Compression as a supported type if
ENABLE_COMPRESSION (via --enable-compression) is turned on.
hangeLog
xt2fs.h
2c1a0ce7c61677bcadd37c417667eff3b961c050 11-Feb-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, swapfs.c:
swapfs.c (ext2fs_swap_super): Swap the compression usage bitmap.
hangeLog
wapfs.c
28ffafb09c6fd8a9ebe716c06b02143771a9b17f 08-Feb-2000 Theodore Ts'o <tytso@mit.edu> ChangeLog, bitops.h:
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 tryi