]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Revert "Merge branch 'xfsprogs-dev'"
authorAlex Elder <aelder@sgi.com>
Thu, 26 Nov 2009 00:03:49 +0000 (18:03 -0600)
committerAlex Elder <aelder@sgi.com>
Thu, 26 Nov 2009 00:03:49 +0000 (18:03 -0600)
This reverts commit 15a60a5e1ac0502d351ceda9888cc523e272ffc9, reversing
changes made to d24f8e6d2d46781bc76e6686f5a38f965ef057c1.

This completes the reverts of changes published to oss.sgi.com on
October 23, 2009.

The state of the tree should now match this commit:
    d24f8e6d2d46781bc76e6686f5a38f965ef057c1 (on 2009-09-10)

Signed-off-by: Alex Elder <aelder@sgi.com>
43 files changed:
Makefile
Makepkgs
VERSION
build/Makefile
configure.in
copy/Makefile
db/Makefile
db/xfs_check64.sh [new file with mode: 0755]
db/xfs_ncheck64.sh [new file with mode: 0755]
debian/Makefile
debian/changelog
doc/CHANGES
estimate/Makefile
fsck/Makefile
fsr/Makefile
fsr/xfs_fsr.c
growfs/Makefile
include/Makefile
include/builddefs.in
include/buildmacros
include/buildrules
include/darwin.h
include/freebsd.h
include/irix.h
include/linux.h
io/Makefile
libdisk/dm.c
libxfs/cache.c
logprint/Makefile
m4/Makefile
man/man8/mkfs.xfs.8
mdrestore/Makefile
mkfs/Makefile
mkfs/xfs_mkfs.c
po/Makefile
quota/Makefile
repair/Makefile
repair/incore.c
repair/incore.h
repair/incore_ext.c
repair/prefetch.c
repair/scan.c
rtcp/Makefile

index 55e09cc959a06bae5d264be0a39b97af78af05d5..db718d29855abfc9371ce061973f0710ebc5ca2d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,21 +9,19 @@ ifeq ($(HAVE_BUILDDEFS), yes)
 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
@@ -40,14 +38,10 @@ db logprint: libxfs libxlog
 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
@@ -66,7 +60,18 @@ configure:
        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
index 6e61a253982af7e75ee46f95b6b8c9f227909e49..d5583b44a87891e5acf15f43fdd209c03f1679f0 100755 (executable)
--- a/Makepkgs
+++ b/Makepkgs
@@ -5,15 +5,7 @@
 #
 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}
@@ -43,27 +35,13 @@ test -f fileslib.rpm && rm -f fileslib.rpm
 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
@@ -72,6 +50,7 @@ if [ $type = debian ] ; then
        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
diff --git a/VERSION b/VERSION
index 60188182694d62dedd6004de96b7df7444e211cb..b3a880e06428f6bb55e87308555ca8cfcf232a05 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=3
 PKG_MINOR=0
-PKG_REVISION=4
+PKG_REVISION=3
 PKG_BUILD=1
index cec611502a34104f989a96142b0384f8a8f6079f..200c249dbb3fccd1390bd22902ffeb730a52bdb9 100644 (file)
@@ -9,7 +9,6 @@ MANIFEST=src-manifest
 SRCTAR=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 
 LDIRT = *-manifest *.gz $(TOPDIR)/$(PKG_NAME)-*
-LDIRDIRT = deb
 
 # for clean and clobber
 SUBDIRS = tar rpm
index ad13b19fa089f9247d8e7a33af3b40e47c1ef22a..8f5782a3cb7f2dc40de039f55f2afa7b322b458d 100644 (file)
@@ -35,43 +35,11 @@ AC_ARG_ENABLE(termcap,
        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
index 3bdc72b8c810237f5edb67ed119af068c032fbe4..3ba29993be23693b5ef6167f3d9be5af463d8c24 100644 (file)
@@ -18,6 +18,6 @@ default: $(LTCOMMAND)
 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:
index 69a85d76dcd1b8d3ebcfb66f4ecc2d70857c26e6..93ab0407f79379d0d7738fb4a48dc8839b08affa 100644 (file)
@@ -15,6 +15,7 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \
        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)
@@ -35,10 +36,10 @@ default: $(LTCOMMAND)
 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:
diff --git a/db/xfs_check64.sh b/db/xfs_check64.sh
new file mode 100755 (executable)
index 0000000..c82c607
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
diff --git a/db/xfs_ncheck64.sh b/db/xfs_ncheck64.sh
new file mode 100755 (executable)
index 0000000..6c3a6e1
--- /dev/null
@@ -0,0 +1,34 @@
+#!/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
index 9a284a765ef2fdd4a727613a81f1960f81f08f35..9b1d92baee6a88e37119f05fbb13cb7ff4e58c36 100644 (file)
@@ -29,6 +29,6 @@ endif
 
 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
index 7e556148dfe3c45275f60e3869c53cdb53ac5fe8..ebf9819ebd9a86478cfc0114ab90e3cd7c2e8820 100644 (file)
@@ -1,10 +1,3 @@
-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
index 515c04c009514d41808aaed90207b13c9a90baa4..c7da0bde5b4ac9ef4d93a10dac4f04aafdda055c 100644 (file)
@@ -1,13 +1,3 @@
-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.
index c972403a3d4d8126740436b7da8ffe176122c718..192aa393132fbc3799d01a539f880caaa77ca33a 100644 (file)
@@ -13,6 +13,6 @@ default: $(LTCOMMAND)
 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:
index 171d8976c078e3e08091cf8e91a1412cef6ef693..32291fd706054087b8a28eb8085526d0490efbea 100644 (file)
@@ -12,6 +12,6 @@ default: $(LTCOMMAND)
 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:
index b7b0ab8817b45bc523844b362e068cd2b747e69c..b62447ac7d12213219a10b73ee90c8e549d0dbec 100644 (file)
@@ -14,6 +14,6 @@ default: $(LTCOMMAND)
 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:
index 253a55d909c34bad8d65fbeef6a217aa8a77a0a3..9f2bf24c791b0dd56390dc345fd7b824e2650f9c 100644 (file)
@@ -1190,7 +1190,7 @@ packfile(char *fname, char *tname, int fd,
                        }
                        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"),
index 2bab89fd9800d74575a4b8b4191a017b20661d4f..8a30ea738fe6df38562a76da77b7970688145b67 100644 (file)
@@ -27,7 +27,7 @@ default: $(LTCOMMAND)
 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:
index d89480ed6eb6fe6ec981f3e27c2c44dfab1c7085..1ca5071295839f137927e6becdb5d7dc6218d5f3 100644 (file)
@@ -19,7 +19,7 @@ TOPDIR = ..
 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 \
index ca8f172cd8549c6b71e71586bb8a734e3b937816..d6bf5c0c2421a2969164a138ce1867322051c7c7 100644 (file)
@@ -31,13 +31,19 @@ LIBPTHREAD = @libpthread@
 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@
@@ -45,18 +51,11 @@ PKG_RELEASE = @pkg_release@
 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
@@ -86,7 +85,6 @@ ENABLE_SHARED = @enable_shared@
 ENABLE_GETTEXT = @enable_gettext@
 ENABLE_EDITLINE        = @enable_editline@
 ENABLE_READLINE        = @enable_readline@
-ENABLE_BLKID   = @enable_blkid@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
 
index 01743613d79cd5afa88ef17dd26ae24c66589659..ec22fb63d95e5226ea106b2b6fa95f08e53b1210 100644 (file)
@@ -22,8 +22,6 @@ MANDIRT = *.[1-9].gz
 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) \
@@ -51,16 +49,16 @@ LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
 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
@@ -72,15 +70,15 @@ endif
 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)
@@ -88,8 +86,8 @@ endif
 
 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 \
@@ -140,7 +138,7 @@ DIST_MAKERULE = \
 
 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; \
index 62d9a377e7180dd0632ab624a4f87e7695019adf..f2a33727285ff22c8cf686fa2593fde5a65a3309 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs
 
 clean clobber : $(addsuffix -clean,$(SUBDIRS))
        rm -f $(DIRT)
-       rm -fr $(DIRDIRT)
+       @rm -fr .libs
 %-clean:
        $(MAKE) -C $* clean
 
@@ -21,17 +21,6 @@ $(SUBDIRS):
        $(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
 #
index 69c03227753063133540ddf31fadc8dec3de780f..25cd61841cb8163bf0729947316addb6ed2299c2 100644 (file)
@@ -154,10 +154,4 @@ typedef unsigned char      uchar_t;
 
 #define HAVE_FID       1
 
-static __inline__ int
-platform_discard_blocks(int fd, off64_t start, off64_t end)
-{
-       return 0;
-}
-
 #endif /* __XFS_DARWIN_H__ */
index 7089dd97ca9d5ba77f4b709a6a7b92116ecfb847..967ca25f238575d937b1f12ad41740b8764cbd90 100644 (file)
@@ -139,10 +139,4 @@ static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
        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__ */
index f75193939acfa41f21e5a6251b64fc8011dbd49c..a7debd3e991603cd46d6dcfd27dbe125abe6daa6 100644 (file)
@@ -337,12 +337,6 @@ static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
        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;
index 0486485137d642ca371d95e3e71814092976bc90..1bb5866d6ee2c45da5852653cba75bc638d5c4cc 100644 (file)
@@ -93,20 +93,6 @@ static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
        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
index 59c2860975c0f201b785b1dbbf95118a98a7ce37..1a51879988d00be96ccb600965c1dcd82e846638 100644 (file)
@@ -68,9 +68,9 @@ default: $(LTCOMMAND)
 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:
index dfc1f375b1f4e684b630dc66f28b274b9ba7fd65..fd91164babe1599e2632500307bdfc5be19cedf3 100644 (file)
@@ -36,11 +36,10 @@ dm_get_subvol_stripe(
 {
        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;
@@ -58,15 +57,16 @@ dm_get_subvol_stripe(
                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) {
index 56b24e75e3e2ee22ceb9e0802cbab30602f758e3..48f91d7c94f1c6e473bccbfe6e6e3dedbb7c32e1 100644 (file)
@@ -82,18 +82,6 @@ cache_init(
        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,
@@ -356,15 +344,6 @@ cache_node_get(
                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;
index 1c7d9972cd2bd2dcd416953d2db009d174b091be..1388370a0371417d9d207cb544d001d56a904319 100644 (file)
@@ -21,6 +21,6 @@ default: $(LTCOMMAND)
 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:
index 825ba710cfaa36dea4bd63a0bd8394675c3abc1e..ab0ed48343bb5ab483c44baeb057b17e8afd4a12 100644 (file)
@@ -5,13 +5,6 @@
 TOPDIR = ..
 include $(TOPDIR)/include/builddefs
 
-CONFIGURE = \
-       libtool.m4 \
-       ltoptions.m4 \
-       ltsugar.m4 \
-       ltversion.m4 \
-       lt~obsolete.m4
-
 LSRCFILES = \
        manual_format.m4 \
        package_aiodev.m4 \
@@ -21,14 +14,10 @@ LSRCFILES = \
        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)
index 40ea1bd707d6fcaf47facf67bcff41087aa2d054..74a98db385a3b7c1e9a6c189e6c85ff2fc0ca433 100644 (file)
@@ -36,8 +36,6 @@ mkfs.xfs \- construct an XFS filesystem
 .I label
 ] [
 .B \-N
-] [
-.B \-K
 ]
 .I device
 .SH DESCRIPTION
@@ -716,9 +714,6 @@ manual entries for additional information.
 .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),
index 6dc6cd4f4e51e7b8b3329479da2c73823be75f86..9f192090ad98bd0d6c6bcbc67bfe086fb149c730 100644 (file)
@@ -17,6 +17,6 @@ default: $(LTCOMMAND)
 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:
index 9fcadf2d16ede3dfb7ea41f29f386e0a024c98b1..b9855175044c7f9f577e7a9d065db43abf8130b0 100644 (file)
@@ -11,27 +11,14 @@ FSTYP = fstyp
 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)
 
@@ -39,6 +26,6 @@ $(FSTYP):
        $(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:
index bd92bc00fdbe6afa68f2ba1c66836c0275278c24..53eccbd901391338ba58ef858c0af6b554f63f80 100644 (file)
  */
 
 #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.
  */
@@ -281,105 +267,6 @@ calc_stripe_factors(
        }
 }
 
-#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)
@@ -403,24 +290,6 @@ check_overwrite(
        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,
@@ -736,20 +605,6 @@ done:
        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,
@@ -826,7 +681,6 @@ main(
        int                     nvflag;
        int                     nci;
        int                     Nflag;
-       int                     discard = 1;
        char                    *p;
        char                    *protofile;
        char                    *protostring;
@@ -838,6 +692,7 @@ main(
        char                    *rtfile;
        char                    *rtsize;
        xfs_sb_t                *sbp;
+       int                     sectoralign;
        int                     sectorlog;
        unsigned int            sectorsize;
        __uint64_t              sector_mask;
@@ -847,7 +702,8 @@ main(
        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]);
@@ -885,7 +741,7 @@ main(
        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':
@@ -1401,9 +1257,6 @@ main(
                case 'N':
                        Nflag = 1;
                        break;
-               case 'K':
-                       discard = 0;
-                       break;
                case 'p':
                        if (protofile)
                                respec('p', NULL, 0);
@@ -1540,10 +1393,12 @@ main(
                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, &sectoralign);
+       if (sectoralign) {
                sectorsize = blocksize;
                sectorlog = libxfs_highbit32(sectorsize);
                if (loginternal) {
@@ -1691,15 +1546,14 @@ main(
                 * 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)) {
@@ -1791,14 +1645,6 @@ main(
                }
        }
 
-       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)
@@ -1948,27 +1794,27 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
                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 */
index 4db7d1e555ae5c2adc37e46468bc0d46fa4c62eb..ac7d43ff7331f2b80edf91fc222586d035f737dd 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/include/builddefs
 
 POTHEAD = $(PKG_NAME).pot
 LINGUAS = pl
-LSRCFILES = $(LINGUAS:%=%.po)
+LSRCFILES = $(LINGUAS:%=%.po) $(POTHEAD)
 LDIRT = $(POTHEAD)
 
 XGETTEXTFILES =        $(LOCALIZED_FILES)
index 7aedd562d2fb5056fc48abedf5c7d3328093944b..e7c8629f27c4f3ef65b7c50f41a54cb49c2c9391 100644 (file)
@@ -33,6 +33,6 @@ default: $(LTCOMMAND)
 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:
index a80ea41fd192845bdc03b1e7044e5c0ec323db22..38e0f6421cfb9cc735475839a669817a57be4c8f 100644 (file)
@@ -47,6 +47,6 @@ include $(BUILDRULES)
 #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:
index 27604e27c9c9b9b49bc039b03dfba376499c4aa3..84626c91206b1f2e13c5d277e4158a1508180b81 100644 (file)
 #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
index a22ef0fb06b20008623503015f67e4c267a989e0..1f0f45a9bec2c22149a2e818e362f477cbeda451 100644 (file)
  * 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.
index d0b8cdc4ba20a2a78326d201c7bcda66e3966968..a2acbf4a6c6f072d8c21db2e2660d8d88212046e 100644 (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;
 
@@ -89,8 +89,8 @@ static avltree_desc_t **extent_bcnt_ptrs;     /*
 /*
  * 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.
@@ -120,7 +120,7 @@ mk_extent_tree_nodes(xfs_agblock_t new_startblock,
                        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];
 
@@ -678,7 +678,7 @@ mk_rt_extent_tree_nodes(xfs_drtbno_t new_startblock,
                        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];
 
@@ -755,15 +755,12 @@ release_rt_extent_tree()
 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;
@@ -898,8 +895,8 @@ incore_ext_init(xfs_mount_t *mp)
        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);
@@ -957,11 +954,9 @@ incore_ext_init(xfs_mount_t *mp)
 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]);
index 2c78db0d73cf2f49ea54c5ef3f6894bd3c7e69d8..c049748e9fc01f373b9fe917211ed6e6a8881815 100644 (file)
@@ -64,6 +64,7 @@ static void           pf_read_inode_dirs(prefetch_args_t *, xfs_buf_t *);
  * 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
 
@@ -130,7 +131,7 @@ pf_queue_io(
 
        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++;
@@ -152,7 +153,7 @@ pf_queue_io(
                        (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);
        }
index 18ac38513c81d45b2174dc74f7d7a13342ac21e0..d7905fb1b021c8506345803dc17735f151688018 100644 (file)
@@ -439,16 +439,16 @@ _("out-of-order bmap key (file offset) in inode %llu, %s fork, fsbno %llu\n"),
 }
 
 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;
@@ -456,20 +456,16 @@ scanfunc_allocbt(
        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;
@@ -487,8 +483,8 @@ scanfunc_allocbt(
        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;
        }
 
@@ -510,42 +506,29 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
 
                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));
                                }
                        }
                }
@@ -581,8 +564,6 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
        }
 
        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,
@@ -592,27 +573,13 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
                 * 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,
@@ -623,170 +590,138 @@ scanfunc_cnt(
        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
@@ -813,11 +748,18 @@ scanfunc_ino(
        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;
@@ -892,8 +834,165 @@ _("inode btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
                 * 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;
@@ -944,26 +1043,23 @@ scan_freelist(
 {
        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);
@@ -971,11 +1067,12 @@ scan_freelist(
        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;
@@ -984,7 +1081,8 @@ scan_freelist(
        }
        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);
 }
index 5f1a803e88b01fb80b78443ad769e685c298a0f3..5947692e3a0f93c58bde2fb6b7aadf9c47008060 100644 (file)
@@ -14,6 +14,6 @@ default: $(LTCOMMAND)
 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: