Commit Graph

14 Commits (dcb8e1fa0452a3d31b678351c2297ad0255d3e4b)

Author SHA1 Message Date
Theodore Ts'o dcb8e1fa04 Merge branch 'maint' into next 2016-03-06 20:37:49 -05:00
Theodore Ts'o d030908bfc ext2fs: work around FreeBSD header breakage
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>
2016-01-01 20:12:22 -05:00
Darrick J. Wong c866515f02 undo-io: add new calls to and speed up the undo io manager
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>
2015-05-05 10:38:34 -04:00
Darrick J. Wong 5f0164b3a4 libext2fs: fix tdb.c mmap leak
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>
2015-01-27 13:10:39 -05:00
Mike Frysinger 24d364fc43 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>
2012-01-09 21:19:48 -05:00
Theodore Ts'o 4e523bbe00 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>
2011-11-29 11:24:52 -05:00
Theodore Ts'o db40c20e3f 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>
2011-11-28 12:31:29 -05:00
Theodore Ts'o d1b75fd60c libext2fs: don't leak tdb_null out of the shared library namespace
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-05 14:55:30 -04:00
Theodore Ts'o d1154eb460 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>
2011-09-18 17:34:37 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o ebabf2ad6d 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>
2008-07-13 16:06:57 -04:00
Theodore Ts'o 3eed36b254 Update to latest samba tdb library before LGPLv3 change
The major changes were:

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

Moved from svn revision #22080 to #23590

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

Signed-off-by: Christophe Grenier <grenier@cgsecurity.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-02-17 17:33:57 -05:00
Theodore Ts'o 106ad96dae Add tdb from Samba into libext2fs library.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-04 21:26:37 -04:00