From 9a5c6ff4ef8569504c30af460be9092c8dc45243 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Wed, 25 Nov 2009 18:03:49 -0600 Subject: [PATCH] Revert "Merge branch 'xfsprogs-dev'" 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 --- Makefile | 29 ++- Makepkgs | 37 +-- VERSION | 2 +- build/Makefile | 1 - configure.in | 36 +-- copy/Makefile | 4 +- db/Makefile | 13 +- db/xfs_check64.sh | 36 +++ db/xfs_ncheck64.sh | 34 +++ debian/Makefile | 4 +- debian/changelog | 7 - doc/CHANGES | 10 - estimate/Makefile | 4 +- fsck/Makefile | 4 +- fsr/Makefile | 4 +- fsr/xfs_fsr.c | 2 +- growfs/Makefile | 6 +- include/Makefile | 2 +- include/builddefs.in | 20 +- include/buildmacros | 32 ++- include/buildrules | 13 +- include/darwin.h | 6 - include/freebsd.h | 6 - include/irix.h | 6 - include/linux.h | 14 -- io/Makefile | 10 +- libdisk/dm.c | 18 +- libxfs/cache.c | 21 -- logprint/Makefile | 4 +- m4/Makefile | 13 +- man/man8/mkfs.xfs.8 | 5 - mdrestore/Makefile | 4 +- mkfs/Makefile | 23 +- mkfs/xfs_mkfs.c | 198 ++-------------- po/Makefile | 2 +- quota/Makefile | 4 +- repair/Makefile | 4 +- repair/incore.c | 27 +++ repair/incore.h | 11 + repair/incore_ext.c | 27 +-- repair/prefetch.c | 5 +- repair/scan.c | 536 +++++++++++++++++++++++++------------------ rtcp/Makefile | 4 +- 43 files changed, 567 insertions(+), 681 deletions(-) create mode 100755 db/xfs_check64.sh create mode 100755 db/xfs_ncheck64.sh diff --git a/Makefile b/Makefile index 55e09cc95..db718d298 100644 --- 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 diff --git a/Makepkgs b/Makepkgs index 6e61a2539..d5583b44a 100755 --- 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 601881826..b3a880e06 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=3 PKG_MINOR=0 -PKG_REVISION=4 +PKG_REVISION=3 PKG_BUILD=1 diff --git a/build/Makefile b/build/Makefile index cec611502..200c249db 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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 diff --git a/configure.in b/configure.in index ad13b19fa..8f5782a3c 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/copy/Makefile b/copy/Makefile index 3bdc72b8c..3ba29993b 100644 --- a/copy/Makefile +++ b/copy/Makefile @@ -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: diff --git a/db/Makefile b/db/Makefile index 69a85d76d..93ab0407f 100644 --- a/db/Makefile +++ b/db/Makefile @@ -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 index 000000000..c82c607dd --- /dev/null +++ b/db/xfs_check64.sh @@ -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 index 000000000..6c3a6e167 --- /dev/null +++ b/db/xfs_ncheck64.sh @@ -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 diff --git a/debian/Makefile b/debian/Makefile index 9a284a765..9b1d92bae 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -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 diff --git a/debian/changelog b/debian/changelog index 7e556148d..ebf9819eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,3 @@ -xfsprogs (3.0.4) unstable; urgency=low - - * New bugfix release - * Resolve a libxfs unaligned access (closes: #517553) - - -- Nathan Scott Thu, 17 Sep 2009 14:32:48 +1000 - xfsprogs (3.0.2) unstable; urgency=low * New bugfix release diff --git a/doc/CHANGES b/doc/CHANGES index 515c04c00..c7da0bde5 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -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. diff --git a/estimate/Makefile b/estimate/Makefile index c972403a3..192aa3931 100644 --- a/estimate/Makefile +++ b/estimate/Makefile @@ -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: diff --git a/fsck/Makefile b/fsck/Makefile index 171d8976c..32291fd70 100644 --- a/fsck/Makefile +++ b/fsck/Makefile @@ -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: diff --git a/fsr/Makefile b/fsr/Makefile index b7b0ab881..b62447ac7 100644 --- a/fsr/Makefile +++ b/fsr/Makefile @@ -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: diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index 253a55d90..9f2bf24c7 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -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"), diff --git a/growfs/Makefile b/growfs/Makefile index 2bab89fd9..8a30ea738 100644 --- a/growfs/Makefile +++ b/growfs/Makefile @@ -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: diff --git a/include/Makefile b/include/Makefile index d89480ed6..1ca507129 100644 --- a/include/Makefile +++ b/include/Makefile @@ -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 \ diff --git a/include/builddefs.in b/include/builddefs.in index ca8f172cd..d6bf5c0c2 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -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@ diff --git a/include/buildmacros b/include/buildmacros index 01743613d..ec22fb63d 100644 --- a/include/buildmacros +++ b/include/buildmacros @@ -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; \ diff --git a/include/buildrules b/include/buildrules index 62d9a377e..f2a337272 100644 --- a/include/buildrules +++ b/include/buildrules @@ -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 # diff --git a/include/darwin.h b/include/darwin.h index 69c032277..25cd61841 100644 --- a/include/darwin.h +++ b/include/darwin.h @@ -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__ */ diff --git a/include/freebsd.h b/include/freebsd.h index 7089dd97c..967ca25f2 100644 --- a/include/freebsd.h +++ b/include/freebsd.h @@ -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__ */ diff --git a/include/irix.h b/include/irix.h index f75193939..a7debd3e9 100644 --- a/include/irix.h +++ b/include/irix.h @@ -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; diff --git a/include/linux.h b/include/linux.h index 048648513..1bb5866d6 100644 --- a/include/linux.h +++ b/include/linux.h @@ -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 diff --git a/io/Makefile b/io/Makefile index 59c286097..1a5187998 100644 --- a/io/Makefile +++ b/io/Makefile @@ -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: diff --git a/libdisk/dm.c b/libdisk/dm.c index dfc1f375b..fd91164ba 100644 --- a/libdisk/dm.c +++ b/libdisk/dm.c @@ -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) { diff --git a/libxfs/cache.c b/libxfs/cache.c index 56b24e75e..48f91d7c9 100644 --- a/libxfs/cache.c +++ b/libxfs/cache.c @@ -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; diff --git a/logprint/Makefile b/logprint/Makefile index 1c7d9972c..1388370a0 100644 --- a/logprint/Makefile +++ b/logprint/Makefile @@ -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: diff --git a/m4/Makefile b/m4/Makefile index 825ba710c..ab0ed4834 100644 --- a/m4/Makefile +++ b/m4/Makefile @@ -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) diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index 40ea1bd70..74a98db38 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -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), diff --git a/mdrestore/Makefile b/mdrestore/Makefile index 6dc6cd4f4..9f192090a 100644 --- a/mdrestore/Makefile +++ b/mdrestore/Makefile @@ -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: diff --git a/mkfs/Makefile b/mkfs/Makefile index 9fcadf2d1..b98551750 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -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: diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index bd92bc00f..53eccbd90 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -17,25 +17,11 @@ */ #include -#include -#ifdef ENABLE_BLKID -#include -#else #include #include -#endif +#include #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, §oralign); + 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 */ diff --git a/po/Makefile b/po/Makefile index 4db7d1e55..ac7d43ff7 100644 --- a/po/Makefile +++ b/po/Makefile @@ -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) diff --git a/quota/Makefile b/quota/Makefile index 7aedd562d..e7c8629f2 100644 --- a/quota/Makefile +++ b/quota/Makefile @@ -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: diff --git a/repair/Makefile b/repair/Makefile index a80ea41fd..38e0f6421 100644 --- a/repair/Makefile +++ b/repair/Makefile @@ -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: diff --git a/repair/incore.c b/repair/incore.c index 27604e27c..84626c912 100644 --- a/repair/incore.c +++ b/repair/incore.c @@ -25,6 +25,33 @@ #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 diff --git a/repair/incore.h b/repair/incore.h index a22ef0fb0..1f0f45a9b 100644 --- a/repair/incore.h +++ b/repair/incore.h @@ -25,6 +25,17 @@ * 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. diff --git a/repair/incore_ext.c b/repair/incore_ext.c index d0b8cdc4b..a2acbf4a6 100644 --- a/repair/incore_ext.c +++ b/repair/incore_ext.c @@ -31,12 +31,12 @@ * 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]); diff --git a/repair/prefetch.c b/repair/prefetch.c index 2c78db0d7..c049748e9 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -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); } diff --git a/repair/scan.c b/repair/scan.c index 18ac38513..d7905fb1b 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -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); } diff --git a/rtcp/Makefile b/rtcp/Makefile index 5f1a803e8..5947692e3 100644 --- a/rtcp/Makefile +++ b/rtcp/Makefile @@ -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: -- 2.39.2