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>
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>
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>
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>
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>
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>
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>
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.
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.
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.
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.
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_*.
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.
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.
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().
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.
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.
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.
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.
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.