Merge branch 'maint' into next

pu
Theodore Ts'o 2014-02-23 23:07:38 -05:00
commit 3ba59bf649
17 changed files with 177 additions and 61 deletions

View File

@ -249,6 +249,14 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/MCONFIG \
@MAINTAINER_CMT@$(top_srcdir)/configure: $(top_srcdir)/configure.in
@MAINTAINER_CMT@ cd $(top_srcdir) && autoheader && autoconf
coverage.txt: Makefile $(SRCS)
if test -n "$(SRCS)"; then \
gcov -s $(top_srcdir) -o . $(SRCS) > coverage.txt 2>&1 ; \
fi
clean::
$(RM) -f *.gcda *.gcov *.gcno coverage.txt
#
# Make depend magic...
#

View File

@ -73,10 +73,12 @@ install-libs: install-libs-recursive
uninstall-libs: uninstall-libs-recursive
coverage.txt: coverage.txt-recursive
check-recursive: all
TAGS clean-recursive distclean-recursive depend-recursive check-recursive \
mostlyclean-recursive realclean-recursive:
mostlyclean-recursive realclean-recursive coverage.txt-recursive:
@for subdir in $(SUBDIRS); do \
if test -d $$subdir ; then \
target=`echo $@|$(SED) 's/-recursive//'`; \
@ -86,7 +88,7 @@ TAGS clean-recursive distclean-recursive depend-recursive check-recursive \
done
all-progs-recursive install-progs-recursive install-strip-progs-recursive \
uninstall-progs-recursive: all-libs-recursive
uninstall-progs-recursive coverage.txt-progs-recursive: all-libs-recursive
@for subdir in $(PROG_SUBDIRS); do \
if test -d $$subdir ; then \
target=`echo $@|$(SED) 's/-progs-recursive//'`; \
@ -97,7 +99,8 @@ all-progs-recursive install-progs-recursive install-strip-progs-recursive \
all-libs-recursive install-libs-recursive install-strip-libs-recursive \
uninstall-libs-recursive install-shlibs-libs-recursive \
install-shlibs-strip-libs-recursive uninstall-shlibs-libs-recursive:
install-shlibs-strip-libs-recursive uninstall-shlibs-libs-recursive \
coverage.txt-libs-recursive:
@for subdir in $(LIB_SUBDIRS); do \
if test -d $$subdir ; then \
target=`echo $@|$(SED) 's/-libs-recursive//'`; \
@ -108,7 +111,7 @@ all-libs-recursive install-libs-recursive install-strip-libs-recursive \
mostlyclean: mostlyclean-recursive mostlyclean-local
clean: clean-recursive clean-local clean-doc
clean:: clean-recursive clean-local clean-doc
$(RM) -f $(SUBS)
distclean: distclean-doc distclean-recursive

14
configure vendored
View File

@ -836,6 +836,7 @@ enable_htree
enable_elf_shlibs
enable_bsd_shlibs
enable_profile
enable_gcov
enable_checker
enable_jbd_debug
enable_blkid_debug
@ -1495,6 +1496,7 @@ Optional Features:
--enable-elf-shlibs select ELF shared libraries
--enable-bsd-shlibs select BSD shared libraries
--enable-profile build profiling libraries
--enable-gcov build for coverage testing using gcov
--enable-checker build checker libraries
--enable-jbd-debug enable journal debugging
--enable-blkid-debug enable blkid debugging
@ -4683,6 +4685,18 @@ fi
# Check whether --enable-gcov was given.
if test "${enable_gcov+set}" = set; then :
enableval=$enable_gcov; if test "$enableval" = "yes"
then
CFLAGS="-g -fprofile-arcs -ftest-coverage"
LDFLAGS="-fprofile-arcs -ftest-coverage"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling gcov support" >&5
$as_echo "Enabling gcov support" >&6; }
fi
fi
# Check whether --enable-checker was given.
if test "${enable_checker+set}" = set; then :
enableval=$enable_checker; if test "$enableval" = "no"

View File

@ -381,6 +381,18 @@ AC_MSG_RESULT([Disabling profiling libraries by default])
AC_SUBST(PROFILE_CMT)
AC_SUBST_FILE(MAKEFILE_PROFILE)
dnl
dnl handle --enable-gcov
dnl
AC_ARG_ENABLE([gcov],
[ --enable-gcov build for coverage testing using gcov],
if test "$enableval" = "yes"
then
CFLAGS="-g -fprofile-arcs -ftest-coverage"
LDFLAGS="-fprofile-arcs -ftest-coverage"
AC_MSG_RESULT([Enabling gcov support])
fi
)
dnl
dnl handle --enable-checker
dnl
AC_ARG_ENABLE([checker],

View File

@ -117,7 +117,7 @@ uninstall:
$(RM) -f $(DESTDIR)$(man8dir)/$$i; \
done
clean:
clean::
$(RM) -f $(PROGS) debugfs.8 \#* *.s *.o *.a *~ debug_cmds.c \
extent_cmds.c ro_debug_cmds.c core rdebugfs debugfs.static

View File

@ -257,7 +257,7 @@ uninstall:
$(DESTDIR)$(root_sbindir)/fsck.ext4 \
$(DESTDIR)$(root_sbindir)/fsck.ext4dev
clean:
clean::
$(RM) -f $(PROGS) \#* *\# *.s *.o *.a *~ core e2fsck.static \
e2fsck.shared e2fsck.profiled flushb e2fsck.8 \
tst_problem tst_region tst_refcount e2fsck.conf.5 \

View File

@ -734,8 +734,11 @@ void check_super_block(e2fsck_t ctx)
#ifndef EXT2_SKIP_UUID
/*
* If the UUID field isn't assigned, assign it.
* Skip if checksums are enabled and the filesystem is mounted,
* if the id changes under the kernel remounting rw may fail.
*/
if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) {
if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid) &&
(!csum_flag || !(ctx->mount_flags & EXT2_MF_MOUNTED))) {
if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) {
uuid_generate(sb->s_uuid);
ext2fs_init_csum_seed(fs);

View File

@ -65,7 +65,7 @@ ext2ed.8: $(DEP_SUBSTITUTE) $(srcdir)/ext2ed.8.in
ext2ed.conf: $(DEP_SUBSTITUTE) $(srcdir)/ext2ed.conf.in
$(SUBSTITUTE_UPTIME) $(srcdir)/ext2ed.conf.in ext2ed.conf
clean:
clean::
$(RM) -f ext2ed $(OBJS) $(DOCS) ext2ed.conf ext2ed.8
-rmdir doc

View File

@ -488,13 +488,14 @@ id: ID
ID: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
coverage.txt::
mostlyclean:
rm -f *.a *.la *.o *.obj *.lo core core.*
rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
rm -f -r .libs _libs
clean: mostlyclean
clean:: mostlyclean
distclean: clean
rm -f Makefile ID TAGS

View File

@ -118,7 +118,7 @@ tst_tag: $(srcdir)/tag.c $(DEPLIBS_BLKID)
tst_types: tst_types.o blkid_types.h
$(E) " LD $@"
$(Q) $(CC) -o tst_types tst_types.o
$(Q) $(CC) -o tst_types $(ALL_LDFLAGS) tst_types.o
../../misc/blkid.o: $(top_srcdir)/misc/blkid.c blkid.h
$(E) " CC $@"

View File

@ -226,8 +226,8 @@ ext2fs.pc: $(srcdir)/ext2fs.pc.in $(top_builddir)/config.status
tst_badblocks: tst_badblocks.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_badblocks tst_badblocks.o $(STATIC_LIBEXT2FS) \
$(STATIC_LIBCOM_ERR) $(SYSLIBS)
$(Q) $(CC) -o tst_badblocks tst_badblocks.o $(ALL_LDFLAGS) \
$(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_icount: $(srcdir)/icount.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
@ -236,7 +236,7 @@ tst_icount: $(srcdir)/icount.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
tst_iscan: tst_iscan.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_iscan tst_iscan.o $(STATIC_LIBEXT2FS) \
$(Q) $(CC) -o tst_iscan tst_iscan.o $(ALL_LDFLAGS) $(STATIC_LIBEXT2FS) \
$(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_getsize: tst_getsize.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
@ -270,13 +270,13 @@ tst_types.o: $(srcdir)/tst_types.c ext2_types.h
tst_types: tst_types.o ext2_types.h
$(E) " LD $@"
$(Q) $(CC) -o tst_types tst_types.o $(SYSLIBS)
$(Q) $(CC) -o tst_types tst_types.o $(ALL_LDFLAGS) $(SYSLIBS)
tst_super_size.o: $(srcdir)/tst_super_size.c $(srcdir)/ext2_fs.h
tst_super_size: tst_super_size.o
$(E) " LD $@"
$(Q) $(CC) -o tst_super_size tst_super_size.o $(SYSLIBS)
$(Q) $(CC) -o tst_super_size tst_super_size.o $(ALL_LDFLAGS) $(SYSLIBS)
tst_fs_struct.o: $(srcdir)/tst_fs_struct.c $(srcdir)/ext2fs.h
@ -288,11 +288,11 @@ tst_inode_size.o: $(srcdir)/tst_inode_size.c $(srcdir)/ext2_fs.h
tst_inode_size: tst_inode_size.o
$(E) " LD $@"
$(Q) $(CC) -o tst_inode_size tst_inode_size.o $(SYSLIBS)
$(Q) $(CC) -o tst_inode_size tst_inode_size.o $(ALL_LDFLAGS) $(SYSLIBS)
ext2_tdbtool: tdbtool.o
$(E) " LD $@"
$(Q) $(CC) -o ext2_tdbtool tdbtool.o tdb.o $(SYSLIBS)
$(Q) $(CC) -o ext2_tdbtool tdbtool.o tdb.o $(ALL_LDFLAGS) $(SYSLIBS)
extent_dbg.c: $(srcdir)/extent_dbg.ct
$(E) " MK_CMDS $<"

View File

@ -599,7 +599,7 @@ uninstall:
$(RM) $(DESTDIR)/$(root_sysconfdir)/mke2fs.conf; \
fi
clean:
clean::
$(RM) -f $(SPROGS) $(USPROGS) $(UPROGS) $(UMANPAGES) $(SMANPAGES) \
$(FMANPAGES) profile.h \
base_device base_device.out mke2fs.static filefrag e2freefrag \

View File

@ -281,7 +281,9 @@ mostlyclean:
rm -f $(DOMAIN).po.bak
rm -fr *.o
clean: mostlyclean
coverage.txt::
clean:: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo

View File

@ -104,7 +104,7 @@ check:: test_extent.out
exit 1 ; \
fi
clean:
clean::
$(RM) -f $(PROGS) $(TEST_PROGS) $(MANPAGES) \#* *.s *.o *.a *~ core \
resize2fs.static test_extent.out

View File

@ -280,40 +280,61 @@ static void fix_uninit_block_bitmaps(ext2_filsys fs)
* release them in the new filesystem data structure, and mark them as
* reserved so the old inode table blocks don't get overwritten.
*/
static void free_gdp_blocks(ext2_filsys fs,
ext2fs_block_bitmap reserve_blocks,
ext2_filsys old_fs,
dgrp_t group)
static errcode_t free_gdp_blocks(ext2_filsys fs,
ext2fs_block_bitmap reserve_blocks,
ext2_filsys old_fs,
dgrp_t group)
{
blk64_t blk;
int j;
dgrp_t i;
ext2fs_block_bitmap bg_map = NULL;
errcode_t retval = 0;
dgrp_t count = old_fs->group_desc_count - fs->group_desc_count;
blk = ext2fs_block_bitmap_loc(old_fs, group);
if (blk &&
(blk < ext2fs_blocks_count(fs->super))) {
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
/* If bigalloc, don't free metadata living in the same cluster */
if (EXT2FS_CLUSTER_RATIO(fs) > 1) {
retval = ext2fs_allocate_block_bitmap(fs, "bgdata", &bg_map);
if (retval)
goto out;
retval = mark_table_blocks(fs, bg_map);
if (retval)
goto out;
}
blk = ext2fs_inode_bitmap_loc(old_fs, group);
if (blk &&
(blk < ext2fs_blocks_count(fs->super))) {
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
for (i = group; i < group + count; i++) {
blk = ext2fs_block_bitmap_loc(old_fs, i);
if (blk &&
(blk < ext2fs_blocks_count(fs->super)) &&
!(bg_map && ext2fs_test_block_bitmap2(bg_map, blk))) {
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
}
blk = ext2fs_inode_bitmap_loc(old_fs, i);
if (blk &&
(blk < ext2fs_blocks_count(fs->super)) &&
!(bg_map && ext2fs_test_block_bitmap2(bg_map, blk))) {
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
}
blk = ext2fs_inode_table_loc(old_fs, i);
for (j = 0;
j < fs->inode_blocks_per_group; j++, blk++) {
if (blk >= ext2fs_blocks_count(fs->super) ||
(bg_map && ext2fs_test_block_bitmap2(bg_map, blk)))
continue;
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
}
}
blk = ext2fs_inode_table_loc(old_fs, group);
if (blk == 0 ||
(blk >= ext2fs_blocks_count(fs->super)))
return;
for (j = 0;
j < fs->inode_blocks_per_group; j++, blk++) {
if (blk >= ext2fs_blocks_count(fs->super))
break;
ext2fs_block_alloc_stats2(fs, blk, -1);
ext2fs_mark_block_bitmap2(reserve_blocks, blk);
}
out:
if (bg_map)
ext2fs_free_block_bitmap(bg_map);
return retval;
}
/*
@ -504,10 +525,8 @@ retry:
* Check the block groups that we are chopping off
* and free any blocks associated with their metadata
*/
for (i = fs->group_desc_count;
i < old_fs->group_desc_count; i++)
free_gdp_blocks(fs, reserve_blocks, old_fs, i);
retval = 0;
retval = free_gdp_blocks(fs, reserve_blocks, old_fs,
fs->group_desc_count);
goto errout;
}
@ -886,12 +905,12 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
int j, has_super;
dgrp_t i, max_groups, g;
blk64_t blk, group_blk;
blk64_t old_blocks, new_blocks;
blk64_t old_blocks, new_blocks, group_end, cluster_freed;
blk64_t new_size;
unsigned int meta_bg, meta_bg_size;
errcode_t retval;
ext2_filsys fs, old_fs;
ext2fs_block_bitmap meta_bmap;
ext2fs_block_bitmap meta_bmap, new_meta_bmap = NULL;
int flex_bg;
fs = rfs->new_fs;
@ -1002,15 +1021,42 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
* blocks as free.
*/
if (old_blocks > new_blocks) {
if (EXT2FS_CLUSTER_RATIO(fs) > 1) {
retval = ext2fs_allocate_block_bitmap(fs,
_("new meta blocks"),
&new_meta_bmap);
if (retval)
goto errout;
retval = mark_table_blocks(fs, new_meta_bmap);
if (retval)
goto errout;
}
for (i = 0; i < max_groups; i++) {
if (!ext2fs_bg_has_super(fs, i)) {
group_blk += fs->super->s_blocks_per_group;
continue;
}
for (blk = group_blk+1+new_blocks;
blk < group_blk+1+old_blocks; blk++) {
ext2fs_block_alloc_stats2(fs, blk, -1);
group_end = group_blk + 1 + old_blocks;
for (blk = group_blk + 1 + new_blocks;
blk < group_end;) {
if (new_meta_bmap == NULL ||
!ext2fs_test_block_bitmap2(new_meta_bmap,
blk)) {
cluster_freed =
EXT2FS_CLUSTER_RATIO(fs) -
(blk &
EXT2FS_CLUSTER_MASK(fs));
if (cluster_freed > group_end - blk)
cluster_freed = group_end - blk;
ext2fs_block_alloc_stats2(fs, blk, -1);
blk += EXT2FS_CLUSTER_RATIO(fs);
rfs->needed_blocks -= cluster_freed;
continue;
}
rfs->needed_blocks--;
blk++;
}
group_blk += fs->super->s_blocks_per_group;
}
@ -1156,6 +1202,8 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
retval = 0;
errout:
if (new_meta_bmap)
ext2fs_free_block_bitmap(new_meta_bmap);
if (meta_bmap)
ext2fs_free_block_bitmap(meta_bmap);
@ -1829,9 +1877,10 @@ static errcode_t move_itables(ext2_resize_t rfs)
dgrp_t i, max_groups;
ext2_filsys fs = rfs->new_fs;
char *cp;
blk64_t old_blk, new_blk, blk;
blk64_t old_blk, new_blk, blk, cluster_freed;
errcode_t retval;
int j, to_move, moved;
ext2fs_block_bitmap new_bmap = NULL;
max_groups = fs->group_desc_count;
if (max_groups > rfs->old_fs->group_desc_count)
@ -1844,6 +1893,17 @@ static errcode_t move_itables(ext2_resize_t rfs)
return retval;
}
if (EXT2FS_CLUSTER_RATIO(fs) > 1) {
retval = ext2fs_allocate_block_bitmap(fs, _("new meta blocks"),
&new_bmap);
if (retval)
return retval;
retval = mark_table_blocks(fs, new_bmap);
if (retval)
goto errout;
}
/*
* Figure out how many inode tables we need to move
*/
@ -1921,8 +1981,19 @@ static errcode_t move_itables(ext2_resize_t rfs)
}
for (blk = ext2fs_inode_table_loc(rfs->old_fs, i), j=0;
j < fs->inode_blocks_per_group ; j++, blk++)
ext2fs_block_alloc_stats2(fs, blk, -1);
j < fs->inode_blocks_per_group;) {
if (new_bmap == NULL ||
!ext2fs_test_block_bitmap2(new_bmap, blk)) {
ext2fs_block_alloc_stats2(fs, blk, -1);
cluster_freed = EXT2FS_CLUSTER_RATIO(fs) -
(blk & EXT2FS_CLUSTER_MASK(fs));
blk += cluster_freed;
j += cluster_freed;
continue;
}
blk++;
j++;
}
ext2fs_inode_table_loc_set(rfs->old_fs, i, new_blk);
ext2fs_group_desc_csum_set(rfs->old_fs, i);
@ -1942,9 +2013,11 @@ static errcode_t move_itables(ext2_resize_t rfs)
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("Inode table move finished.\n");
#endif
return 0;
retval = 0;
errout:
if (new_bmap)
ext2fs_free_block_bitmap(new_bmap);
return retval;
}

View File

@ -51,7 +51,7 @@ test_icount_cmds.c: test_icount_cmds.ct
$(E) " MK_CMDS $@"
$(Q) $(MK_CMDS) $(srcdir)/test_icount_cmds.ct
clean:
clean::
$(RM) -f $(PROGS) test_rel_cmds.c test_icount_cmds.c \
\#* *.s *.o *.a *~ core

View File

@ -50,7 +50,7 @@ tarballs: gen-tarball
sh gen-tarball all
sh gen-tarball subset
clean:
clean::
$(RM) -f $(PROGS) \#* *.s *.o *.a *~ core *.tar.gz gen-tarball \
copy-sparse dirpaths.h