include $(TOPDIR)/include/builddefs
endif
-CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
+CONFIGURE = aclocal.m4 configure config.guess config.sub configure install-sh \
+ ltmain.sh m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
+ m4/ltversion.m4 m4/lt~obsolete.m4
LSRCFILES = configure.in Makepkgs release.sh README VERSION $(CONFIGURE)
LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
Logs/* built .census install.* install-dev.* *.gz autom4te.cache/* \
libtool include/builddefs include/platform_defs.h
-LIB_SUBDIRS = libxfs libxlog libxcmd libhandle $(LDISK)
+LIB_SUBDIRS = libxfs libxlog libxcmd libhandle libdisk
TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
mdrestore repair rtcp m4 man doc po debian build
-ifneq ($(ENABLE_BLKID), yes)
-LIB_SUBDIRS += libdisk
-endif
-
SUBDIRS = include $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
default: include/builddefs include/platform_defs.h
fsr: libhandle
growfs: libxfs libxcmd
io: libxcmd libhandle
-mkfs: libxfs
+mkfs: libxfs libdisk
quota: libxcmd
repair: libxfs libxlog
-ifneq ($(ENABLE_BLKID), yes)
-mkfs: libdisk
-endif
-
ifeq ($(HAVE_BUILDDEFS), yes)
include $(BUILDRULES)
else
autoconf
include/builddefs: configure
- ./configure $$LOCAL_CONFIGURE_OPTIONS
+ ./configure \
+ --prefix=/ \
+ --exec-prefix=/ \
+ --sbindir=/sbin \
+ --bindir=/usr/sbin \
+ --libdir=/lib \
+ --libexecdir=/usr/lib \
+ --enable-lib64=yes \
+ --includedir=/usr/include \
+ --mandir=/usr/share/man \
+ --datadir=/usr/share \
+ $$LOCAL_CONFIGURE_OPTIONS
touch .census
include/platform_defs.h: include/builddefs
#
LOGDIR=Logs
-#
-# If we're on a Debian or Debian-derived system generate deb packages by
-# default, else rpm packages.
-#
-if [ -f /etc/debian_version ] ; then
- type=debian
-else
- type=rpm
-fi
+type=rpm
verbose=false
MAKE=${MAKE:-make}
test ! -d $LOGDIR && mkdir $LOGDIR
rm -rf $LOGDIR/* > /dev/null 2>&1
+# build Debian packages, cleans itself before starting
+SUDO=${SUDO:-sudo}
+test ! -z "$SUDO" && sudo=$SUDO
if [ $type = debian ] ; then
- SOURCE=`pwd`
- PACKAGE=`basename $SOURCE`
- LOGDEB=$SOURCE/$LOGDIR/$PACKAGE.log
- if $verbose ; then
- $MAKE include/builddefs 2>&1 | tee $LOGDIR/configure
- else
- $MAKE include/builddefs > $LOGDIR/configure 2>&1 || exit 1
- fi
-
- . ./VERSION
- VERSION=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
- export SRCLINK_ROOT="$SOURCE/build/deb/$PACKAGE-$VERSION"
- rm -fr "$SRCLINK_ROOT"
- mkdir -p "$SRCLINK_ROOT" || exit 1
-
- $MAKE source-link || exit 1
-
- cd "$SRCLINK_ROOT"
- SUDO=${SUDO:-fakeroot}
- test ! -z "$SUDO" && sudo=$SUDO
+ LOGDEB=`pwd`
+ LOGDEB=../`basename $LOGDEB`.log
+ echo "== Debian build, log is $LOGDEB"; echo
if $verbose ; then
dpkg-buildpackage -r$SUDO | tee $LOGDEB
else
exit 0
fi
+# build RPM packages - manual clean before starting
echo "== clean, log is $LOGDIR/clean"
if $verbose ; then
$MAKE clean 2>&1 | tee $LOGDIR/clean
#
PKG_MAJOR=3
PKG_MINOR=0
-PKG_REVISION=4
+PKG_REVISION=3
PKG_BUILD=1
SRCTAR=$(PKG_NAME)-$(PKG_VERSION).tar.gz
LDIRT = *-manifest *.gz $(TOPDIR)/$(PKG_NAME)-*
-LDIRDIRT = deb
# for clean and clobber
SUBDIRS = tar rpm
test $enable_termcap = yes && libtermcap="-ltermcap",)
AC_SUBST(libtermcap)
-AC_ARG_ENABLE(blkid,
-[ --enable-blkid=[yes/no] Enable block device id library [default=no]],
- test $enable_blkid = yes && libblkid="-lblkid",)
-AC_SUBST(libblkid)
-AC_SUBST(enable_blkid)
-
AC_ARG_ENABLE(lib64,
-[ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],,
- enable_lib64=yes)
+[ --enable-lib64=[yes/no] Enable lib64 support [default=no]],,
+ enable_lib64=no)
AC_SUBST(enable_lib64)
-#
-# If the user specified a libdir ending in lib64 do not append another
-# 64 to the library names.
-#
-base_libdir=`basename "$libdir"`
-case $base_libdir in
-lib64)
- enable_lib64=no
-esac
-
-#
-# Some important tools should be installed into the root partitions.
-#
-# Check whether exec_prefix=/usr: and install them to /sbin in that
-# case. If the user choses a different prefix assume he just wants
-# a local install for testing and not a system install.
-#
-case $exec_prefix:$prefix in
-NONE:NONE | NONE:/usr | /usr:*)
- root_sbindir='/sbin'
- AC_SUBST([root_sbindir])
-
- root_libdir="/${base_libdir}"
- AC_SUBST([root_libdir])
-esac
-
# Find localized files
LOCALIZED_FILES=""
for lfile in `find ${srcdir} -name '*.c' -type f || exit 1`; do
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
text.h type.h write.h attrset.h
CFILES = $(HFILES:.h=.c)
LSRCFILES = xfs_admin.sh xfs_check.sh xfs_ncheck.sh xfs_metadump.sh
+LSRCFILES += xfs_check64.sh xfs_ncheck64.sh
LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG)
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
- $(INSTALL) -m 755 xfs_admin.sh $(PKG_SBIN_DIR)/xfs_admin
- $(INSTALL) -m 755 xfs_check.sh $(PKG_SBIN_DIR)/xfs_check
- $(INSTALL) -m 755 xfs_ncheck.sh $(PKG_SBIN_DIR)/xfs_ncheck
- $(INSTALL) -m 755 xfs_metadump.sh $(PKG_SBIN_DIR)/xfs_metadump
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
+ $(INSTALL) -m 755 xfs_admin.sh $(PKG_BIN_DIR)/xfs_admin
+ $(INSTALL) -m 755 xfs_check.sh $(PKG_BIN_DIR)/xfs_check
+ $(INSTALL) -m 755 xfs_ncheck.sh $(PKG_BIN_DIR)/xfs_ncheck
+ $(INSTALL) -m 755 xfs_metadump.sh $(PKG_BIN_DIR)/xfs_metadump
install-dev:
--- /dev/null
+#!/bin/sh -f
+#
+# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
+#
+
+OPTS=" "
+DBOPTS=" "
+USAGE="Usage: xfs_check64 [-fsvV] [-l logdev] [-i ino]... [-b bno]... special"
+
+while getopts "b:fi:l:stvV" c
+do
+ case $c in
+ s) OPTS=$OPTS"-s ";;
+ t) OPTS=$OPTS"-t ";;
+ v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
+ i) OPTS=$OPTS"-i "$OPTARG" ";;
+ b) OPTS=$OPTS"-b "$OPTARG" ";;
+ f) DBOPTS=" -f";;
+ l) DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+ \?) echo $USAGE 1>&2
+ exit 2
+ ;;
+ esac
+done
+set -- extra $@
+shift $OPTIND
+case $# in
+ 1) xfs_db64$DBOPTS -F -i -p xfs_check64 -c "check$OPTS" $1
+ status=$?
+ ;;
+ *) echo $USAGE 1>&2
+ exit 2
+ ;;
+esac
+exit $status
--- /dev/null
+#!/bin/sh -f
+#
+# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
+#
+
+OPTS=" "
+DBOPTS=" "
+USAGE="usage: xfs_ncheck64 [-sfvV] [-l logdev] [-i ino]... special"
+
+while getopts "b:fi:l:svV" c
+do
+ case $c in
+ s) OPTS=$OPTS"-s ";;
+ i) OPTS=$OPTS"-i "$OPTARG" ";;
+ v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
+ f) DBOPTS=" -f";;
+ l) DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+ \?) echo $USAGE 1>&2
+ exit 2
+ ;;
+ esac
+done
+set -- extra $@
+shift $OPTIND
+case $# in
+ 1) xfs_db64$DBOPTS -r -p xfs_ncheck64 -c "blockget -ns" -c "ncheck$OPTS" $1
+ status=$?
+ ;;
+ *) echo $USAGE 1>&2
+ exit 2
+ ;;
+esac
+exit $status
install-d-i: default
ifeq ($(PKG_DISTRIBUTION), debian)
- $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
- $(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_ROOT_SBIN_DIR)/mkfs.xfs
+ $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_SBIN_DIR)/mkfs.xfs
endif
-xfsprogs (3.0.4) unstable; urgency=low
-
- * New bugfix release
- * Resolve a libxfs unaligned access (closes: #517553)
-
- -- Nathan Scott <nathans@debian.org> Thu, 17 Sep 2009 14:32:48 +1000
-
xfsprogs (3.0.2) unstable; urgency=low
* New bugfix release
-xfsprogs-3.0.4 (17 September 2009)
- - Fix a memory leak in xfsprogs.
- - Increase hash chain length in xfsprogs when running out of memory.
- - Fix dmsetup invocation in libdisk to avoid warnings during mkfs
- on multipath devices.
- - Fix the -V option to various installed tools.
- - Small internal fixes to please the clang semantical analysis tool.
- - Debian packaging updates.
- - Rework Makepkgs and Makefiles to improve deb generation.
-
xfsprogs-3.0.3 (30 August 2009)
- Fix unaligned accesses in libxfs.
- Various small fixes to xfs_db, xfs_repair and xfs_io.
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
- $(INSTALL) -m 755 xfs_fsck.sh $(PKG_ROOT_SBIN_DIR)/fsck.xfs
+ $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 xfs_fsck.sh $(PKG_SBIN_DIR)/fsck.xfs
install-dev:
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
}
if (nfrags) {
/* Do a matching write to the tmp file */
- wc_b4 = wc;
+ wc = wc_b4;
if (((wc = write(ffd, fbuf, wc)) != wc_b4)) {
fsrprintf(_("bad write of %d bytes "
"to %s: %s\n"),
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
- $(INSTALL) -m 755 xfs_info.sh $(PKG_SBIN_DIR)/xfs_info
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
+ $(INSTALL) -m 755 xfs_info.sh $(PKG_BIN_DIR)/xfs_info
install-dev:
include $(TOPDIR)/include/builddefs
QAHFILES = libxfs.h libxlog.h \
- bitops.h cache.h kmem.h list.h parent.h swab.h \
+ bitops.h cache.h kmem.h list.h parent.h swab.h xqm.h \
xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \
xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \
xfs_btree_trace.h xfs_buf_item.h xfs_da_btree.h xfs_dinode.h \
LIBTERMCAP = @libtermcap@
LIBEDITLINE = @libeditline@
LIBREADLINE = @libreadline@
-LIBBLKID = @libblkid@
LIBXFS = $(TOPDIR)/libxfs/libxfs.la
LIBXCMD = $(TOPDIR)/libxcmd/libxcmd.la
LIBXLOG = $(TOPDIR)/libxlog/libxlog.la
LIBDISK = $(TOPDIR)/libdisk/libdisk.la
LIBHANDLE = $(TOPDIR)/libhandle/libhandle.la
+DK_INC_DIR = @includedir@/disk
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+top_builddir = @top_builddir@
+datarootdir = @datarootdir@
+
PKG_NAME = @pkg_name@
PKG_USER = @pkg_user@
PKG_GROUP = @pkg_group@
PKG_VERSION = @pkg_version@
PKG_PLATFORM = @pkg_platform@
PKG_DISTRIBUTION= @pkg_distribution@
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-datarootdir = @datarootdir@
-top_builddir = @top_builddir@
-
+PKG_BIN_DIR = @bindir@
PKG_SBIN_DIR = @sbindir@
-PKG_ROOT_SBIN_DIR = @root_sbindir@
-PKG_ROOT_LIB_DIR= @root_libdir@@libdirsuffix@
PKG_LIB_DIR = @libdir@@libdirsuffix@
+PKG_DEVLIB_DIR = @libexecdir@@libdirsuffix@
PKG_INC_DIR = @includedir@/xfs
-DK_INC_DIR = @includedir@/disk
PKG_MAN_DIR = @mandir@
PKG_DOC_DIR = @datadir@/doc/@pkg_name@
PKG_LOCALE_DIR = @datadir@/locale
ENABLE_GETTEXT = @enable_gettext@
ENABLE_EDITLINE = @enable_editline@
ENABLE_READLINE = @enable_readline@
-ENABLE_BLKID = @enable_blkid@
HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
PODIRT = *.tmpo *.mo
CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
-LIBDIRT = .libs
-DIRDIRT = $(LDIRDIRT) $(LIBDIRT)
OBJECTS = $(ASFILES:.s=.o) \
$(CFILES:.c=.o) \
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CCF)
ifeq ($(ENABLE_SHARED),yes)
-LTLDFLAGS += -rpath $(PKG_ROOT_LIB_DIR)
+LTLDFLAGS += -rpath $(PKG_LIB_DIR)
LTLDFLAGS += -version-info $(LTVERSION)
endif
ifeq ($(ENABLE_SHARED),yes)
INSTALL_LTLIB = \
cd $(TOPDIR)/$(LIBNAME)/.libs; \
- ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
- ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
- ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_ROOT_LIB_DIR)
+ ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
+ ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \
+ ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR)
endif
# Libtool thinks the static and shared libs should be in the same dir, so
ifeq ($(ENABLE_SHARED),yes)
INSTALL_LTLIB_DEV = \
cd $(TOPDIR)/$(LIBNAME)/.libs; \
+ ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
+ ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
+ ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
- ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR); \
- ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
- ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
- ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
- if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)" ; then \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
- ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
+ ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
+ if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
+ ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
+ ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
+ ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so; \
fi
else
INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
INSTALL_LTLIB_STATIC = \
cd $(TOPDIR)/$(LIBNAME)/.libs; \
- ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
- ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR)
+ ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
+ ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
INSTALL_MAN = \
@for d in $(MAN_PAGES); do \
SOURCE_MAKERULE = \
@test -z "$$DIR" && DIR="."; \
- for f in $(SRCFILES) $(POTHEAD) ""; do \
+ for f in $(SRCFILES) ""; do \
test -z "$$f" && break; \
test -L "$$f" || $(ECHO) $$DIR/$$f; \
done; \
clean clobber : $(addsuffix -clean,$(SUBDIRS))
rm -f $(DIRT)
- rm -fr $(DIRDIRT)
+ @rm -fr .libs
%-clean:
$(MAKE) -C $* clean
$(MAKE) -C $@
endif
-source-link:
- @test -z "$$DIR" && DIR="."; \
- for f in `echo $(SRCFILES) $(SUBDIRS)`; do \
- if test -d $$f ; then \
- mkdir $$SRCLINK_ROOT/$$DIR/$$f || exit $$?; \
- $(MAKEF) DIR=$$DIR/$$f -C $$f $@ || exit $$?; \
- else \
- ln $$f $$SRCLINK_ROOT/$$DIR/$$f || exit $$?; \
- fi; \
- done
-
#
# Standard targets
#
#define HAVE_FID 1
-static __inline__ int
-platform_discard_blocks(int fd, off64_t start, off64_t end)
-{
- return 0;
-}
-
#endif /* __XFS_DARWIN_H__ */
memcpy(dst, src, sizeof(uuid_t));
}
-static __inline__ int
-platform_discard_blocks(int fd, off64_t start, off64_t end)
-{
- return 0;
-}
-
#endif /* __XFS_FREEBSD_H__ */
memcpy(dst, src, sizeof(uuid_t));
}
-static __inline__ int
-platform_discard_blocks(int fd, off64_t start, off64_t end)
-{
- return 0;
-}
-
static __inline__ char * strsep(char **s, const char *ct)
{
char *sbegin = *s, *end;
uuid_copy(*dst, *src);
}
-#ifndef BLKDISCARD
-#define BLKDISCARD _IO(0x12,119)
-#endif
-
-static __inline__ int
-platform_discard_blocks(int fd, off64_t start, off64_t end)
-{
- __uint64_t range[2] = { start, end };
-
- if (ioctl(fd, BLKDISCARD, &range) < 0)
- return errno;
- return 0;
-}
-
#if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
# define constpp const char * const *
#else
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 xfs_bmap.sh $(PKG_SBIN_DIR)/xfs_bmap
- $(LTINSTALL) -m 755 xfs_freeze.sh $(PKG_SBIN_DIR)/xfs_freeze
- $(LTINSTALL) -m 755 xfs_mkfile.sh $(PKG_SBIN_DIR)/xfs_mkfile
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 xfs_bmap.sh $(PKG_BIN_DIR)/xfs_bmap
+ $(LTINSTALL) -m 755 xfs_freeze.sh $(PKG_BIN_DIR)/xfs_freeze
+ $(LTINSTALL) -m 755 xfs_mkfile.sh $(PKG_BIN_DIR)/xfs_mkfile
install-dev:
{
int count, stripes = 0, stripesize = 0;
int dmpipe[2];
- char *largv[7];
+ char *dpath, *largv[4], tmppath[PATH_MAX];
FILE *stream;
long long offset, size;
static char *command = "table"; /* dmsetup table /dev/xxx */
- char major_str[4], minor_str[4];
if (!mnt_is_dm_subvol(sb->st_rdev))
return 0;
return 0;
}
- snprintf(major_str, 4, "%d", major(sb->st_rdev));
- snprintf(minor_str, 4, "%d", minor(sb->st_rdev));
+ if (!(dpath = realpath(dfile, tmppath))) {
+ fprintf(stderr,
+ _("Warning - device mapper device, but cannot resolve path %s: %s\n"),
+ dfile, strerror(errno));
+ return 0;
+ }
largv[1] = command;
- largv[2] = "-j";
- largv[3] = major_str;
- largv[4] = "-m";
- largv[5] = minor_str;
- largv[6] = NULL;
+ largv[2] = dpath;
+ largv[3] = NULL;
/* Open pipe */
if (pipe(dmpipe) < 0) {
return cache;
}
-void
-cache_expand(
- struct cache * cache)
-{
- pthread_mutex_lock(&cache->c_mutex);
-#ifdef CACHE_DEBUG
- fprintf(stderr, "doubling cache size to %d\n", 2 * cache->c_maxcount);
-#endif
- cache->c_maxcount *= 2;
- pthread_mutex_unlock(&cache->c_mutex);
-}
-
void
cache_walk(
struct cache * cache,
if (node)
break;
priority = cache_shake(cache, priority, 0);
- /*
- * We start at 0; if we free CACHE_SHAKE_COUNT we get
- * back the same priority, if not we get back priority+1.
- * If we exceed CACHE_MAX_PRIORITY all slots are full; grow it.
- */
- if (priority > CACHE_MAX_PRIORITY) {
- priority = 0;
- cache_expand(cache);
- }
}
node->cn_hashidx = hashidx;
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
TOPDIR = ..
include $(TOPDIR)/include/builddefs
-CONFIGURE = \
- libtool.m4 \
- ltoptions.m4 \
- ltsugar.m4 \
- ltversion.m4 \
- lt~obsolete.m4
-
LSRCFILES = \
manual_format.m4 \
package_aiodev.m4 \
package_types.m4 \
package_utilies.m4 \
package_uuiddev.m4 \
- multilib.m4 \
- $(CONFIGURE)
+ multilib.m4
default:
include $(BUILDRULES)
install install-dev install-lib: default
-
-realclean: distclean
- rm -f $(CONFIGURE)
.I label
] [
.B \-N
-] [
-.B \-K
]
.I device
.SH DESCRIPTION
.B \-N
Causes the file system parameters to be printed out without really
creating the file system.
-.TP
-.B \-K
-Do not attempt to discard blocks at mkfs time.
.SH SEE ALSO
.BR xfs (5),
.BR mkfs (8),
include $(BUILDRULES)
install:
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
HFILES = xfs_mkfs.h
CFILES = maxtrres.c proto.c xfs_mkfs.c
-LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
-LTDEPENDENCIES = $(LIBXFS)
+LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBDISK) $(LIBRT) $(LIBPTHREAD)
+LTDEPENDENCIES = $(LIBXFS) $(LIBDISK)
LLDFLAGS = -static
-ifeq ($(ENABLE_BLKID),yes)
-LLDLIBS += $(LIBBLKID)
-CFLAGS += -DENABLE_BLKID
-else
-LLDLIBS += $(LIBDISK)
-LTDEPENDENCIES += $(LIBDISK)
-endif
-
-
LSRCFILES = $(FSTYP).c
LDIRT = $(FSTYP)
-default: $(LTCOMMAND)
-
-ifneq ($(ENABLE_BLKID),yes)
-default: $(FSTYP)
-endif
+default: $(FSTYP) $(LTCOMMAND)
include $(BUILDRULES)
$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS)
install: default
- $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
install-dev:
*/
#include <xfs/libxfs.h>
-#include <ctype.h>
-#ifdef ENABLE_BLKID
-#include <blkid/blkid.h>
-#else
#include <disk/fstyp.h>
#include <disk/volume.h>
-#endif
+#include <ctype.h>
#include "xfs_mkfs.h"
-/*
- * Device topology information.
- */
-struct fs_topology {
- int dsunit; /* stripe unit - data subvolume */
- int dswidth; /* stripe width - data subvolume */
- int rtswidth; /* stripe width - rt subvolume */
- int sectoralign;
-};
-
/*
* Prototypes for internal functions.
*/
}
}
-#ifdef ENABLE_BLKID
-static int
-check_overwrite(
- char *device)
-{
- const char *type;
- blkid_probe pr;
- int ret = 0;
-
- if (!device || !*device)
- return 0;
-
- pr = blkid_new_probe_from_filename(device);
- if (!pr)
- return -1;
-
- if (blkid_probe_enable_partitions(pr, 1))
- goto out_free_probe;
-
- if (blkid_do_fullprobe(pr))
- goto out_free_probe;
-
- if (!blkid_probe_lookup_value(pr, "TYPE", &type, NULL)) {
- fprintf(stderr,
- _("%s: %s appears to contain an existing "
- "filesystem (%s).\n"), progname, device, type);
- ret = 1;
- } else if (!blkid_probe_lookup_value(pr, "PTTYPE", &type, NULL)) {
- fprintf(stderr,
- _("%s: %s appears to contain a partition "
- "table (%s).\n"), progname, device, type);
- ret = 1;
- }
-
-out_free_probe:
- blkid_free_probe(pr);
- return ret;
-}
-
-static void blkid_get_topology(const char *device, int *sunit, int *swidth)
-{
- blkid_topology tp;
- blkid_probe pr;
- unsigned long val;
-
- pr = blkid_new_probe_from_filename(device);
- if (!pr)
- return;
-
- tp = blkid_probe_get_topology(pr);
- if (!tp)
- goto out_free_probe;
-
- /*
- * Blkid reports the information in terms of bytes, but we want it in
- * terms of 512 bytes blocks (just to convert it to bytes later..)
- *
- * If the reported values are just the normal 512 byte block size
- * do not bother to report anything. It will just causes warnings
- * if people specifier larger stripe units or widths manually.
- */
- val = blkid_topology_get_minimum_io_size(tp) >> 9;
- if (val > 1)
- *sunit = val;
- val = blkid_topology_get_optimal_io_size(tp) >> 9;
- if (val > 1)
- *swidth = val;
-
- if (blkid_topology_get_alignment_offset(tp) != 0) {
- fprintf(stderr,
- _("warning: device is not properly aligned %s\n"),
- device);
- }
-
- blkid_free_probe(pr);
- return;
-
-out_free_probe:
- blkid_free_probe(pr);
- fprintf(stderr,
- _("warning: unable to probe device toplology for device %s\n"),
- device);
-}
-
-static void get_topology(libxfs_init_t *xi, struct fs_topology *ft)
-{
- if (!xi->disfile) {
- const char *dfile = xi->volname ? xi->volname : xi->dname;
-
- blkid_get_topology(dfile, &ft->dsunit, &ft->dswidth);
- }
-
- if (xi->rtname && !xi->risfile) {
- int dummy;
-
- blkid_get_topology(xi->rtname, &dummy, &ft->rtswidth);
- }
-}
-#else /* ENABLE_BLKID */
static int
check_overwrite(
char *device)
return 0;
}
-static void get_topology(libxfs_init_t *xi, struct fs_topology *ft)
-{
- char *dfile = xi->volname ? xi->volname : xi->dname;
-
- if (!xi->disfile) {
- get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
- &ft->dsunit, &ft->dswidth, &ft->sectoralign);
- }
-
- if (xi->rtname && !xi->risfile) {
- int dummy1;
-
- get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1,
- &ft->rtswidth, &dummy1);
- }
-}
-#endif /* ENABLE_BLKID */
-
static void
fixup_log_stripe_unit(
int lsflag,
free(buf);
}
-static void
-discard_blocks(dev_t dev, __uint64_t nsectors)
-{
- int fd;
-
- /*
- * We intentionally ignore errors from the discard ioctl. It is
- * not necessary for the mkfs functionality but just an optimization.
- */
- fd = libxfs_device_to_fd(dev);
- if (fd > 0)
- platform_discard_blocks(fd, 0, nsectors << 9);
-}
-
int
main(
int argc,
int nvflag;
int nci;
int Nflag;
- int discard = 1;
char *p;
char *protofile;
char *protostring;
char *rtfile;
char *rtsize;
xfs_sb_t *sbp;
+ int sectoralign;
int sectorlog;
unsigned int sectorsize;
__uint64_t sector_mask;
uuid_t uuid;
int worst_freelist;
libxfs_init_t xi;
- struct fs_topology ft;
+ int xlv_dsunit;
+ int xlv_dswidth;
int lazy_sb_counters;
progname = basename(argv[0]);
xi.isdirect = LIBXFS_DIRECT;
xi.isreadonly = LIBXFS_EXCLUSIVELY;
- while ((c = getopt(argc, argv, "b:d:i:l:L:n:KNp:qr:s:CfV")) != EOF) {
+ while ((c = getopt(argc, argv, "b:d:i:l:L:n:Np:qr:s:CfV")) != EOF) {
switch (c) {
case 'C':
case 'f':
case 'N':
Nflag = 1;
break;
- case 'K':
- discard = 0;
- break;
case 'p':
if (protofile)
respec('p', NULL, 0);
usage();
}
- memset(&ft, 0, sizeof(ft));
- get_topology(&xi, &ft);
-
- if (ft.sectoralign) {
+ sectoralign = 0;
+ xlv_dsunit = xlv_dswidth = 0;
+ if (!xi.disfile)
+ get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
+ &xlv_dsunit, &xlv_dswidth, §oralign);
+ if (sectoralign) {
sectorsize = blocksize;
sectorlog = libxfs_highbit32(sectorsize);
if (loginternal) {
* and the underlying volume is striped, then set rtextblocks
* to the stripe width.
*/
- int rswidth;
+ int dummy1, rswidth;
__uint64_t rtextbytes;
- rswidth = 0;
+ dummy1 = rswidth = 0;
if (!norsflag && !xi.risfile && !(!rtsize && xi.disfile))
- rswidth = ft.rtswidth;
- else
- rswidth = 0;
+ get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1,
+ &rswidth, &dummy1);
/* check that rswidth is a multiple of fs blocksize */
if (!norsflag && rswidth && !(BBTOB(rswidth) % blocksize)) {
}
}
- if (discard) {
- discard_blocks(xi.ddev, xi.dsize);
- if (xi.rtdev)
- discard_blocks(xi.rtdev, xi.rtsize);
- if (xi.logdev && xi.logdev != xi.ddev)
- discard_blocks(xi.logdev, xi.logBBsize);
- }
-
if (!liflag && !ldflag)
loginternal = xi.logdev == 0;
if (xi.logname)
agsize = dblocks / agcount + (dblocks % agcount != 0);
else
calc_default_ag_geometry(blocklog, dblocks,
- ft.dsunit | ft.dswidth, &agsize, &agcount);
+ xlv_dsunit | xlv_dswidth, &agsize, &agcount);
if (!nodsflag) {
if (dsunit) {
- if (ft.dsunit && ft.dsunit != dsunit) {
+ if (xlv_dsunit && xlv_dsunit != dsunit) {
fprintf(stderr,
_("%s: Specified data stripe unit %d "
"is not the same as the volume stripe "
"unit %d\n"),
- progname, dsunit, ft.dsunit);
+ progname, dsunit, xlv_dsunit);
}
- if (ft.dswidth && ft.dswidth != dswidth) {
+ if (xlv_dswidth && xlv_dswidth != dswidth) {
fprintf(stderr,
_("%s: Specified data stripe width %d "
"is not the same as the volume stripe "
"width %d\n"),
- progname, dswidth, ft.dswidth);
+ progname, dswidth, xlv_dswidth);
}
} else {
- dsunit = ft.dsunit;
- dswidth = ft.dswidth;
+ dsunit = xlv_dsunit;
+ dswidth = xlv_dswidth;
nodsflag = 1;
}
} /* else dsunit & dswidth can't be set if nodsflag is set */
POTHEAD = $(PKG_NAME).pot
LINGUAS = pl
-LSRCFILES = $(LINGUAS:%=%.po)
+LSRCFILES = $(LINGUAS:%=%.po) $(POTHEAD)
LDIRT = $(POTHEAD)
XGETTEXTFILES = $(LOCALIZED_FILES)
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev:
#CFLAGS += ...
install: default
- $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
install-dev:
#include "err_protos.h"
#include "threads.h"
+/*
+ * push a block allocation record onto list. assumes list
+ * if set to NULL if empty.
+ */
+void
+record_allocation(ba_rec_t *addr, ba_rec_t *list)
+{
+ addr->next = list;
+ list = addr;
+
+ return;
+}
+
+void
+free_allocations(ba_rec_t *list)
+{
+ ba_rec_t *current = list;
+
+ while (list != NULL) {
+ list = list->next;
+ free(current);
+ current = list;
+ }
+
+ return;
+}
+
/* ba bmap setupstuff. setting/getting state is in incore.h */
void
* is spread out in separate files.
*/
+/*
+ * block allocation lists
+ */
+typedef struct ba_rec {
+ void *addr;
+ struct ba_rec *next;
+} ba_rec_t;
+
+void record_allocation(ba_rec_t *addr, ba_rec_t *list);
+void free_allocations(ba_rec_t *list);
+
/*
* block bit map defs -- track state of each filesystem block.
* ba_bmap is an array of bitstrings declared in the globals.h file.
* paranoia -- account for any weird padding, 64/32-bit alignment, etc.
*/
typedef struct extent_alloc_rec {
- struct list_head list;
+ ba_rec_t alloc_rec;
extent_tree_node_t extents[ALLOC_NUM_EXTS];
} extent_alloc_rec_t;
typedef struct rt_extent_alloc_rec {
- struct list_head list;
+ ba_rec_t alloc_rec;
rt_extent_tree_node_t extents[ALLOC_NUM_EXTS];
} rt_extent_alloc_rec_t;
/*
* list of allocated "blocks" for easy freeing later
*/
-static struct list_head ba_list;
-static struct list_head rt_ba_list;
+static ba_rec_t *ba_list;
+static ba_rec_t *rt_ba_list;
/*
* locks.
do_error(
_("couldn't allocate new extent descriptors.\n"));
- list_add(&rec->list, &ba_list);
+ record_allocation(&rec->alloc_rec, ba_list);
new = &rec->extents[0];
do_error(
_("couldn't allocate new extent descriptors.\n"));
- list_add(&rec->list, &rt_ba_list);
+ record_allocation(&rec->alloc_rec, rt_ba_list);
new = &rec->extents[0];
void
free_rt_dup_extent_tree(xfs_mount_t *mp)
{
- rt_extent_alloc_rec_t *cur, *tmp;
-
ASSERT(mp->m_sb.sb_rblocks != 0);
- list_for_each_entry_safe(cur, tmp, &rt_ba_list, list)
- free(cur);
-
+ free_allocations(rt_ba_list);
free(rt_ext_tree_ptr);
+ rt_ba_list = NULL;
rt_ext_tree_ptr = NULL;
return;
int i;
xfs_agnumber_t agcount = mp->m_sb.sb_agcount;
- list_head_init(&ba_list);
- list_head_init(&rt_ba_list);
+ ba_list = NULL;
+ rt_ba_list = NULL;
pthread_mutex_init(&ext_flist_lock, NULL);
pthread_mutex_init(&rt_ext_tree_lock, NULL);
pthread_mutex_init(&rt_ext_flist_lock, NULL);
void
incore_ext_teardown(xfs_mount_t *mp)
{
- extent_alloc_rec_t *cur, *tmp;
xfs_agnumber_t i;
- list_for_each_entry_safe(cur, tmp, &ba_list, list)
- free(cur);
+ free_allocations(ba_list);
for (i = 0; i < mp->m_sb.sb_agcount; i++) {
free(extent_tree_ptrs[i]);
* the buffer is for an inode or other metadata.
*/
#define B_IS_INODE(f) (((f) & 5) == 0)
+#define B_IS_META(f) (((f) & 5) != 0)
#define DEF_BATCH_BYTES 0x10000
if (fsbno > args->last_bno_read) {
radix_tree_insert(&args->primary_io_queue, fsbno, bp);
- if (!B_IS_INODE(flag))
+ if (B_IS_META(flag))
radix_tree_tag_set(&args->primary_io_queue, fsbno, 0);
else {
args->inode_bufs_queued++;
(long long)XFS_BUF_ADDR(bp), args->agno, fsbno,
args->last_bno_read);
#endif
- ASSERT(!B_IS_INODE(flag));
+ ASSERT(B_IS_META(flag));
XFS_BUF_SET_PRIORITY(bp, B_DIR_META_2);
radix_tree_insert(&args->secondary_io_queue, fsbno, bp);
}
}
void
-scanfunc_allocbt(
+scanfunc_bno(
struct xfs_btree_block *block,
int level,
xfs_agblock_t bno,
xfs_agnumber_t agno,
int suspect,
- int isroot,
- __uint32_t magic)
+ int isroot
+ )
{
- const char *name;
+ xfs_agblock_t b, e;
int i;
xfs_alloc_ptr_t *pp;
xfs_alloc_rec_t *rp;
int numrecs;
int state;
- assert(magic == XFS_ABTB_MAGIC || magic == XFS_ABTC_MAGIC);
-
- name = (magic == XFS_ABTB_MAGIC) ? "bno" : "cnt";
-
- if (be32_to_cpu(block->bb_magic) != magic) {
- do_warn(_("bad magic # %#x in bt%s block %d/%d\n"),
- be32_to_cpu(block->bb_magic), name, agno, bno);
+ if (be32_to_cpu(block->bb_magic) != XFS_ABTB_MAGIC) {
+ do_warn(_("bad magic # %#x in btbno block %d/%d\n"),
+ be32_to_cpu(block->bb_magic), agno, bno);
hdr_errors++;
if (suspect)
return;
}
if (be16_to_cpu(block->bb_level) != level) {
- do_warn(_("expected level %d got %d in bt%s block %d/%d\n"),
- level, be16_to_cpu(block->bb_level), name, agno, bno);
+ do_warn(_("expected level %d got %d in btbno block %d/%d\n"),
+ level, be16_to_cpu(block->bb_level), agno, bno);
hdr_errors++;
if (suspect)
return;
default:
set_agbno_state(mp, agno, bno, XR_E_MULT);
do_warn(
-_("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
- name, state, agno, bno, suspect);
+_("bno freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
+ state, agno, bno, suspect);
return;
}
rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
for (i = 0; i < numrecs; i++) {
- xfs_agblock_t b, end;
- xfs_extlen_t len;
-
- b = be32_to_cpu(rp[i].ar_startblock);
- len = be32_to_cpu(rp[i].ar_blockcount);
- end = b + len;
-
- if (b == 0 || !verify_agbno(mp, agno, b))
- continue;
- if (len == 0 || len > MAXEXTLEN)
- continue;
- if (!verify_agbno(mp, agno, end - 1))
+ if (be32_to_cpu(rp[i].ar_blockcount) == 0 ||
+ be32_to_cpu(rp[i].ar_startblock) == 0 ||
+ !verify_agbno(mp, agno,
+ be32_to_cpu(rp[i].ar_startblock)) ||
+ be32_to_cpu(rp[i].ar_blockcount) >
+ MAXEXTLEN)
continue;
- for ( ; b < end; b++) {
- state = get_agbno_state(mp, agno, b);
- switch (state) {
- case XR_E_UNKNOWN:
+ e = be32_to_cpu(rp[i].ar_startblock) +
+ be32_to_cpu(rp[i].ar_blockcount);
+ if (!verify_agbno(mp, agno, e - 1))
+ continue;
+ for (b = be32_to_cpu(rp[i].ar_startblock);
+ b < e; b++) {
+ if (get_agbno_state(mp, agno, b)
+ == XR_E_UNKNOWN)
set_agbno_state(mp, agno, b,
XR_E_FREE1);
- break;
- case XR_E_FREE1:
- /*
- * no warning messages -- we'll catch
- * FREE1 blocks later
- */
- if (magic == XFS_ABTC_MAGIC) {
- set_agbno_state(mp, agno, b,
- XR_E_FREE);
- break;
- }
- default:
+ else {
do_warn(
- _("block (%d,%d) multiply claimed by %s space tree, state - %d\n"),
- agno, b, name, state);
- break;
+ _("block (%d,%d) multiply claimed by bno space tree, state - %d\n"),
+ agno, b,
+ get_agbno_state(mp, agno, b));
}
}
}
}
for (i = 0; i < numrecs; i++) {
- xfs_agblock_t bno = be32_to_cpu(pp[i]);
-
/*
* XXX - put sibling detection right here.
* we know our sibling chain is good. So as we go,
* pointer mismatch, try and extract as much data
* as possible.
*/
- if (bno != 0 && verify_agbno(mp, agno, bno)) {
- scan_sbtree(bno, level, agno, suspect,
- (magic == XFS_ABTB_MAGIC) ?
- scanfunc_bno : scanfunc_cnt, 0);
- }
+ if (be32_to_cpu(pp[i]) != 0 && verify_agbno(mp, agno,
+ be32_to_cpu(pp[i])))
+ scan_sbtree(be32_to_cpu(pp[i]), level, agno,
+ suspect, scanfunc_bno, 0);
}
}
-void
-scanfunc_bno(
- struct xfs_btree_block *block,
- int level,
- xfs_agblock_t bno,
- xfs_agnumber_t agno,
- int suspect,
- int isroot)
-{
- return scanfunc_allocbt(block, level, bno, agno,
- suspect, isroot, XFS_ABTB_MAGIC);
-}
-
void
scanfunc_cnt(
struct xfs_btree_block *block,
int isroot
)
{
- return scanfunc_allocbt(block, level, bno, agno,
- suspect, isroot, XFS_ABTC_MAGIC);
-}
-
-static int
-scan_single_ino_chunk(
- xfs_agnumber_t agno,
- xfs_inobt_rec_t *rp,
- int suspect)
-{
- xfs_ino_t lino;
- xfs_agino_t ino;
- xfs_agblock_t agbno;
- int j;
- int nfree;
- int off;
+ xfs_alloc_ptr_t *pp;
+ xfs_alloc_rec_t *rp;
+ xfs_agblock_t b, e;
+ int i;
+ int hdr_errors;
+ int numrecs;
int state;
- ino_tree_node_t *ino_rec, *first_rec, *last_rec;
- ino = be32_to_cpu(rp->ir_startino);
- off = XFS_AGINO_TO_OFFSET(mp, ino);
- agbno = XFS_AGINO_TO_AGBNO(mp, ino);
- lino = XFS_AGINO_TO_INO(mp, agno, ino);
+ hdr_errors = 0;
- /*
- * on multi-block block chunks, all chunks start
- * at the beginning of the block. with multi-chunk
- * blocks, all chunks must start on 64-inode boundaries
- * since each block can hold N complete chunks. if
- * fs has aligned inodes, all chunks must start
- * at a fs_ino_alignment*N'th agbno. skip recs
- * with badly aligned starting inodes.
- */
- if (ino == 0 ||
- (inodes_per_block <= XFS_INODES_PER_CHUNK && off != 0) ||
- (inodes_per_block > XFS_INODES_PER_CHUNK &&
- off % XFS_INODES_PER_CHUNK != 0) ||
- (fs_aligned_inodes && agbno % fs_ino_alignment != 0)) {
- do_warn(
- _("badly aligned inode rec (starting inode = %llu)\n"),
- lino);
- suspect++;
+ if (be32_to_cpu(block->bb_magic) != XFS_ABTC_MAGIC) {
+ do_warn(_("bad magic # %#x in btcnt block %d/%d\n"),
+ be32_to_cpu(block->bb_magic), agno, bno);
+ hdr_errors++;
+ if (suspect)
+ return;
+ }
+ if (be16_to_cpu(block->bb_level) != level) {
+ do_warn(_("expected level %d got %d in btcnt block %d/%d\n"),
+ level, be16_to_cpu(block->bb_level), agno, bno);
+ hdr_errors++;
+ if (suspect)
+ return;
}
/*
- * verify numeric validity of inode chunk first
- * before inserting into a tree. don't have to
- * worry about the overflow case because the
- * starting ino number of a chunk can only get
- * within 255 inodes of max (NULLAGINO). if it
- * gets closer, the agino number will be illegal
- * as the agbno will be too large.
+ * check for btree blocks multiply claimed
*/
- if (verify_aginum(mp, agno, ino)) {
- do_warn(
-_("bad starting inode # (%llu (0x%x 0x%x)) in ino rec, skipping rec\n"),
- lino, agno, ino);
- return ++suspect;
- }
+ state = get_agbno_state(mp, agno, bno);
- if (verify_aginum(mp, agno,
- ino + XFS_INODES_PER_CHUNK - 1)) {
+ switch (state) {
+ case XR_E_UNKNOWN:
+ set_agbno_state(mp, agno, bno, XR_E_FS_MAP);
+ break;
+ default:
+ set_agbno_state(mp, agno, bno, XR_E_MULT);
do_warn(
-_("bad ending inode # (%llu (0x%x 0x%x)) in ino rec, skipping rec\n"),
- lino + XFS_INODES_PER_CHUNK - 1,
- agno, ino + XFS_INODES_PER_CHUNK - 1);
- return ++suspect;
+_("bcnt freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
+ state, agno, bno, suspect);
+ return;
}
- /*
- * set state of each block containing inodes
- */
- if (off == 0 && !suspect) {
- for (j = 0;
- j < XFS_INODES_PER_CHUNK;
- j += mp->m_sb.sb_inopblock) {
- agbno = XFS_AGINO_TO_AGBNO(mp, ino + j);
- state = get_agbno_state(mp, agno, agbno);
- if (state == XR_E_UNKNOWN) {
- set_agbno_state(mp, agno, agbno, XR_E_INO);
- } else if (state == XR_E_INUSE_FS && agno == 0 &&
- ino + j >= first_prealloc_ino &&
- ino + j < last_prealloc_ino) {
- set_agbno_state(mp, agno, agbno, XR_E_INO);
- } else {
- do_warn(
-_("inode chunk claims used block, inobt block - agno %d, bno %d, inopb %d\n"),
- agno, agbno, mp->m_sb.sb_inopblock);
+ numrecs = be16_to_cpu(block->bb_numrecs);
+
+ if (level == 0) {
+ if (numrecs > mp->m_alloc_mxr[0]) {
+ numrecs = mp->m_alloc_mxr[0];
+ hdr_errors++;
+ }
+ if (isroot == 0 && numrecs < mp->m_alloc_mnr[0]) {
+ numrecs = mp->m_alloc_mnr[0];
+ hdr_errors++;
+ }
+
+ if (hdr_errors)
+ suspect++;
+
+ rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
+ for (i = 0; i < numrecs; i++) {
+ if (be32_to_cpu(rp[i].ar_blockcount) == 0 ||
+ be32_to_cpu(rp[i].ar_startblock) == 0 ||
+ !verify_agbno(mp, agno, be32_to_cpu(
+ rp[i].ar_startblock)) ||
+ be32_to_cpu(rp[i].ar_blockcount) >
+ MAXEXTLEN)
+ continue;
+
+ e = be32_to_cpu(rp[i].ar_startblock) +
+ be32_to_cpu(rp[i].ar_blockcount);
+ if (!verify_agbno(mp, agno, e - 1))
+ continue;
+ for (b = be32_to_cpu(rp[i].ar_startblock); b < e; b++) {
+ state = get_agbno_state(mp, agno, b);
/*
- * XXX - maybe should mark
- * block a duplicate
+ * no warning messages -- we'll catch
+ * FREE1 blocks later
*/
- return ++suspect;
+ switch (state) {
+ case XR_E_FREE1:
+ set_agbno_state(mp, agno, b, XR_E_FREE);
+ break;
+ case XR_E_UNKNOWN:
+ set_agbno_state(mp, agno, b,
+ XR_E_FREE1);
+ break;
+ default:
+ do_warn(
+ _("block (%d,%d) already used, state %d\n"),
+ agno, b, state);
+ break;
+ }
}
}
+ return;
}
/*
- * ensure only one avl entry per chunk
+ * interior record
*/
- find_inode_rec_range(agno, ino, ino + XFS_INODES_PER_CHUNK,
- &first_rec, &last_rec);
- if (first_rec != NULL) {
- /*
- * this chunk overlaps with one (or more)
- * already in the tree
- */
- do_warn(
-_("inode rec for ino %llu (%d/%d) overlaps existing rec (start %d/%d)\n"),
- lino, agno, ino, agno, first_rec->ino_startnum);
- suspect++;
+ pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
- /*
- * if the 2 chunks start at the same place,
- * then we don't have to put this one
- * in the uncertain list. go to the next one.
- */
- if (first_rec->ino_startnum == ino)
- return suspect;
+ if (numrecs > mp->m_alloc_mxr[1]) {
+ numrecs = mp->m_alloc_mxr[1];
+ hdr_errors++;
+ }
+ if (isroot == 0 && numrecs < mp->m_alloc_mnr[1]) {
+ numrecs = mp->m_alloc_mnr[1];
+ hdr_errors++;
}
-
- nfree = 0;
/*
- * now mark all the inodes as existing and free or used.
- * if the tree is suspect, put them into the uncertain
- * inode tree.
+ * don't pass bogus tree flag down further if this block
+ * looked ok. bail out if two levels in a row look bad.
*/
- if (!suspect) {
- if (XFS_INOBT_IS_FREE_DISK(rp, 0)) {
- nfree++;
- ino_rec = set_inode_free_alloc(agno, ino);
- } else {
- ino_rec = set_inode_used_alloc(agno, ino);
- }
- for (j = 1; j < XFS_INODES_PER_CHUNK; j++) {
- if (XFS_INOBT_IS_FREE_DISK(rp, j)) {
- nfree++;
- set_inode_free(ino_rec, j);
- } else {
- set_inode_used(ino_rec, j);
- }
- }
- } else {
- for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
- if (XFS_INOBT_IS_FREE_DISK(rp, j)) {
- nfree++;
- add_aginode_uncertain(agno, ino + j, 1);
- } else {
- add_aginode_uncertain(agno, ino + j, 0);
- }
- }
- }
- if (nfree != be32_to_cpu(rp->ir_freecount)) {
- do_warn(_("ir_freecount/free mismatch, inode "
- "chunk %d/%d, freecount %d nfree %d\n"),
- agno, ino, be32_to_cpu(rp->ir_freecount), nfree);
+ if (suspect && !hdr_errors)
+ suspect = 0;
+
+ if (hdr_errors) {
+ if (suspect)
+ return;
+ else suspect++;
}
- return suspect;
+ for (i = 0; i < numrecs; i++) {
+ if (be32_to_cpu(pp[i]) != 0 && verify_agbno(mp, agno,
+ be32_to_cpu(pp[i])))
+ scan_sbtree(be32_to_cpu(pp[i]), level, agno,
+ suspect, scanfunc_cnt, 0);
+ }
}
-
/*
* this one walks the inode btrees sucking the info there into
* the incore avl tree. We try and rescue corrupted btree records
int isroot
)
{
+ xfs_ino_t lino;
int i;
+ xfs_agino_t ino;
+ xfs_agblock_t agbno;
+ int j;
+ int nfree;
+ int off;
int numrecs;
int state;
xfs_inobt_ptr_t *pp;
xfs_inobt_rec_t *rp;
+ ino_tree_node_t *ino_rec, *first_rec, *last_rec;
int hdr_errors;
hdr_errors = 0;
* of INODES_PER_CHUNK (64) inodes. off is the offset into
* the block. skip processing of bogus records.
*/
- for (i = 0; i < numrecs; i++)
- suspect = scan_single_ino_chunk(agno, &rp[i], suspect);
+ for (i = 0; i < numrecs; i++) {
+ ino = be32_to_cpu(rp[i].ir_startino);
+ off = XFS_AGINO_TO_OFFSET(mp, ino);
+ agbno = XFS_AGINO_TO_AGBNO(mp, ino);
+ lino = XFS_AGINO_TO_INO(mp, agno, ino);
+ /*
+ * on multi-block block chunks, all chunks start
+ * at the beginning of the block. with multi-chunk
+ * blocks, all chunks must start on 64-inode boundaries
+ * since each block can hold N complete chunks. if
+ * fs has aligned inodes, all chunks must start
+ * at a fs_ino_alignment*N'th agbno. skip recs
+ * with badly aligned starting inodes.
+ */
+ if (ino == 0 ||
+ (inodes_per_block <= XFS_INODES_PER_CHUNK &&
+ off != 0) ||
+ (inodes_per_block > XFS_INODES_PER_CHUNK &&
+ off % XFS_INODES_PER_CHUNK != 0) ||
+ (fs_aligned_inodes &&
+ agbno % fs_ino_alignment != 0)) {
+ do_warn(
+ _("badly aligned inode rec (starting inode = %llu)\n"),
+ lino);
+ suspect++;
+ }
+
+ /*
+ * verify numeric validity of inode chunk first
+ * before inserting into a tree. don't have to
+ * worry about the overflow case because the
+ * starting ino number of a chunk can only get
+ * within 255 inodes of max (NULLAGINO). if it
+ * gets closer, the agino number will be illegal
+ * as the agbno will be too large.
+ */
+ if (verify_aginum(mp, agno, ino)) {
+ do_warn(
+_("bad starting inode # (%llu (0x%x 0x%x)) in ino rec, skipping rec\n"),
+ lino, agno, ino);
+ suspect++;
+ continue;
+ }
+
+ if (verify_aginum(mp, agno,
+ ino + XFS_INODES_PER_CHUNK - 1)) {
+ do_warn(
+_("bad ending inode # (%llu (0x%x 0x%x)) in ino rec, skipping rec\n"),
+ lino + XFS_INODES_PER_CHUNK - 1,
+ agno, ino + XFS_INODES_PER_CHUNK - 1);
+ suspect++;
+ continue;
+ }
+
+ /*
+ * set state of each block containing inodes
+ */
+ if (off == 0 && !suspect) {
+ for (j = 0;
+ j < XFS_INODES_PER_CHUNK;
+ j += mp->m_sb.sb_inopblock) {
+ agbno = XFS_AGINO_TO_AGBNO(mp, ino + j);
+ state = get_agbno_state(mp,
+ agno, agbno);
+
+ if (state == XR_E_UNKNOWN) {
+ set_agbno_state(mp, agno,
+ agbno, XR_E_INO);
+ } else if (state == XR_E_INUSE_FS &&
+ agno == 0 &&
+ ino + j >= first_prealloc_ino &&
+ ino + j < last_prealloc_ino) {
+ set_agbno_state(mp, agno,
+ agbno, XR_E_INO);
+ } else {
+ do_warn(
+_("inode chunk claims used block, inobt block - agno %d, bno %d, inopb %d\n"),
+ agno, bno,
+ mp->m_sb.sb_inopblock);
+ suspect++;
+ /*
+ * XXX - maybe should mark
+ * block a duplicate
+ */
+ continue;
+ }
+ }
+ }
+ /*
+ * ensure only one avl entry per chunk
+ */
+ find_inode_rec_range(agno, ino,
+ ino + XFS_INODES_PER_CHUNK,
+ &first_rec,
+ &last_rec);
+ if (first_rec != NULL) {
+ /*
+ * this chunk overlaps with one (or more)
+ * already in the tree
+ */
+ do_warn(
+_("inode rec for ino %llu (%d/%d) overlaps existing rec (start %d/%d)\n"),
+ lino, agno, ino,
+ agno, first_rec->ino_startnum);
+ suspect++;
+
+ /*
+ * if the 2 chunks start at the same place,
+ * then we don't have to put this one
+ * in the uncertain list. go to the next one.
+ */
+ if (first_rec->ino_startnum == ino)
+ continue;
+ }
+
+ nfree = 0;
+
+ /*
+ * now mark all the inodes as existing and free or used.
+ * if the tree is suspect, put them into the uncertain
+ * inode tree.
+ */
+ if (!suspect) {
+ if (XFS_INOBT_IS_FREE_DISK(&rp[i], 0)) {
+ nfree++;
+ ino_rec = set_inode_free_alloc(agno,
+ ino);
+ } else {
+ ino_rec = set_inode_used_alloc(agno,
+ ino);
+ }
+ for (j = 1; j < XFS_INODES_PER_CHUNK; j++) {
+ if (XFS_INOBT_IS_FREE_DISK(&rp[i], j)) {
+ nfree++;
+ set_inode_free(ino_rec, j);
+ } else {
+ set_inode_used(ino_rec, j);
+ }
+ }
+ } else {
+ for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
+ if (XFS_INOBT_IS_FREE_DISK(&rp[i], j)) {
+ nfree++;
+ add_aginode_uncertain(agno,
+ ino + j, 1);
+ } else {
+ add_aginode_uncertain(agno,
+ ino + j, 0);
+ }
+ }
+ }
+
+ if (nfree != be32_to_cpu(rp[i].ir_freecount)) {
+ do_warn(_("ir_freecount/free mismatch, inode "
+ "chunk %d/%d, freecount %d nfree %d\n"),
+ agno, ino,
+ be32_to_cpu(rp[i].ir_freecount), nfree);
+ }
+ }
if (suspect)
bad_ino_btree = 1;
{
xfs_agfl_t *agfl;
xfs_buf_t *agflbuf;
- xfs_agnumber_t agno;
xfs_agblock_t bno;
int count;
int i;
- agno = be32_to_cpu(agf->agf_seqno);
-
if (XFS_SB_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
- XFS_AGF_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
- XFS_AGI_BLOCK(mp) != XFS_AGFL_BLOCK(mp))
- set_agbno_state(mp, agno, XFS_AGFL_BLOCK(mp), XR_E_FS_MAP);
-
+ XFS_AGF_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
+ XFS_AGI_BLOCK(mp) != XFS_AGFL_BLOCK(mp))
+ set_agbno_state(mp, be32_to_cpu(agf->agf_seqno),
+ XFS_AGFL_BLOCK(mp), XR_E_FS_MAP);
if (be32_to_cpu(agf->agf_flcount) == 0)
return;
-
- agflbuf = libxfs_readbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
- XFS_FSS_TO_BB(mp, 1), 0);
+ agflbuf = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp,
+ be32_to_cpu(agf->agf_seqno),
+ XFS_AGFL_DADDR(mp)), XFS_FSS_TO_BB(mp, 1), 0);
if (!agflbuf) {
- do_abort(_("can't read agfl block for ag %d\n"), agno);
+ do_abort(_("can't read agfl block for ag %d\n"),
+ be32_to_cpu(agf->agf_seqno));
return;
}
agfl = XFS_BUF_TO_AGFL(agflbuf);
count = 0;
for (;;) {
bno = be32_to_cpu(agfl->agfl_bno[i]);
- if (verify_agbno(mp, agno, bno))
- set_agbno_state(mp, agno, bno, XR_E_FREE);
+ if (verify_agbno(mp, be32_to_cpu(agf->agf_seqno), bno))
+ set_agbno_state(mp, be32_to_cpu(agf->agf_seqno),
+ bno, XR_E_FREE);
else
do_warn(_("bad agbno %u in agfl, agno %d\n"),
- bno, agno);
+ bno, be32_to_cpu(agf->agf_seqno));
count++;
if (i == be32_to_cpu(agf->agf_fllast))
break;
}
if (count != be32_to_cpu(agf->agf_flcount)) {
do_warn(_("freeblk count %d != flcount %d in ag %d\n"), count,
- be32_to_cpu(agf->agf_flcount), agno);
+ be32_to_cpu(agf->agf_flcount),
+ be32_to_cpu(agf->agf_seqno));
}
libxfs_putbuf(agflbuf);
}
include $(BUILDRULES)
install: default
- $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
- $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_BIN_DIR)
install-dev: