FreeBSD 10.2 will blow up compiling its own header files in sys/file.h
if _XOPEN_SOURCE is defined.
In file included from tdb.c:59:
/usr/include/sys/file.h:209:2: error: unknown type name 'u_int'
u_int xf_flag; /* flags (see fcntl.h) */
^
1 error generated.
This is despite the fact that POSIX.1 requires comforming applications
to define _XOPEN_SOURCE (to different numbers depending on the version
of POSIX.1 the program is expecting to work against). See section
2.2.1 in POSIX.1 for chapter and verse.
Work around this by removing the _XOPEN_SOURCE declaration. This will
cause compiler warnings (and will cause builds against some versions
of Solaris to break), so only do this for FreeBSD.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Implement pass-through calls for discard, zero-out, and readahead in
the IO manager so that we can take advantage of any underlying
support.
Furthermore, improve tdb write-out speed by disabling locking and only
fsyncing at the end -- we don't care about locking because having
multiple writers to the undo file will produce an undo database full
of garbage blocks; and we only need to fsync at the end because if we
fail before the end, our undo file will lack the necessary superblock
data that e2undo requires to do replay safely. Without this, we call
fsync four times per tdb update(!) This reduces the overhead of using
undo_io while converting a 2TB FS to metadata_csum from 3+ hours to 55
minutes.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
When undoing an expansion of an mmap'd database while cancelling a
transaction, the tdb code prematurely decreases the variable that
tracks the file size, which leads to a region leak during the
subsequent unmap. Fix this by maintaining a separate counter for the
region size.
(This is probably unnecessary since e2undo was the only user of tdb
transactions, but I suppose we could be proactive.)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
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>
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>
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>
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>
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>
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>