]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Add lazy-counter enable/disable capability on existing filesystems
authorBarry Naujok <bnaujok@sgi.com>
Mon, 21 Apr 2008 16:08:37 +0000 (16:08 +0000)
committerBarry Naujok <bnaujok@sgi.com>
Mon, 21 Apr 2008 16:08:37 +0000 (16:08 +0000)
Merge of master-melb:xfs-cmds:30908a by kenmcd.

  Bump version to 2.9.8

VERSION
db/xfs_admin.sh
doc/CHANGES
man/man8/xfs_admin.8
man/man8/xfs_repair.8
repair/globals.h
repair/phase1.c
repair/xfs_repair.c

diff --git a/VERSION b/VERSION
index 379e646847e237e819120dff9747fc4baad685ca..d01da0f56a5229b511faf001c3015fa24b7aaf87 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=9
-PKG_REVISION=7
+PKG_REVISION=8
 PKG_BUILD=1
index ac86d128d50e99cb115b2ee8e0e10ed8a359d457..74d457c29e313b92a001289cacac622e442b405e 100755 (executable)
@@ -3,20 +3,23 @@
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
-OPTS=""
-USAGE="Usage: xfs_admin [-efjluV] [-L label] [-U uuid] special"
+status=0
+DB_OPTS=""
+REPAIR_OPTS=""
+USAGE="Usage: xfs_admin [-efjluV] [-c 0|1] [-L label] [-U uuid] device"
 
-while getopts "efjluL:U:V" c
+while getopts "efjluc:L:U:V" c
 do
        case $c in
-       e)      OPTS=$OPTS" -c 'version extflg'";;
-       f)      OPTS=$OPTS" -f";;
-       j)      OPTS=$OPTS" -c 'version log2'";;
-       l)      OPTS=$OPTS" -r -c label";;
-       L)      OPTS=$OPTS" -c 'label "$OPTARG"'";;
-       u)      OPTS=$OPTS" -r -c uuid";;
-       U)      OPTS=$OPTS" -c 'uuid "$OPTARG"'";;
-       V)      OPTS=$OPTS" -V";;
+       c)      REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;;
+       e)      DB_OPTS=$DB_OPTS" -c 'version extflg'";;
+       f)      DB_OPTS=$DB_OPTS" -f";;
+       j)      DB_OPTS=$DB_OPTS" -c 'version log2'";;
+       l)      DB_OPTS=$DB_OPTS" -r -c label";;
+       L)      DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
+       u)      DB_OPTS=$DB_OPTS" -r -c uuid";;
+       U)      DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
+       V)      DB_OPTS=$DB_OPTS" -V";;
        \?)     echo $USAGE 1>&2
                exit 2
                ;;
@@ -25,8 +28,25 @@ done
 set -- extra $@
 shift $OPTIND
 case $# in
-       1)      eval xfs_db -x -p xfs_admin $OPTS $1
-               status=$?
+       1)      if [ -n "$DB_OPTS" ]
+               then
+                       eval xfs_db -x -p xfs_admin $DB_OPTS $1
+                       status=$?
+               fi
+               if [ -n "$REPAIR_OPTS" ]
+               then
+                       # Hide normal repair output which is sent to stderr
+                       # assuming the filesystem is fine when a user is
+                       # running xfs_admin.
+                       # Ideally, we need to improve the output behaviour
+                       # of repair for this purpose (say a "quiet" mode).
+                       eval xfs_repair $REPAIR_OPTS $1 2> /dev/null
+                       status=`expr $? + $status`
+                       if [ $status -ne 0 ]
+                       then
+                               echo "Conversion failed, is the filesystem unmounted?"
+                       fi
+               fi
                ;;
        *)      echo $USAGE 1>&2
                exit 2
index ebe46f9952bbfeefd4cf894298dbe5e4ac59fc76..72a28015d5f2b3b8e7191a38b6f7842279e96b4c 100644 (file)
@@ -1,3 +1,14 @@
+xfsprogs-2.9.8 (21 April 2008)
+       - Add support for sb_features2 in wrong location in mkfs.xfs,
+         xfs_repair and xfs_db.
+       - Improve memory limits for libxfs cache in xfs_repair and added
+         a -m option to manually limit usage of xfs_repair.
+       - Add -c option to xfs_admin to turn lazy-counters on/off.
+       - Added support for mdp in libdisk/mkfs.xfs, thanks to
+         Hubert Verstraete.
+       - Add -p option to fsck.xfs, thanks to Markus Rothe.
+       - Cleanup sys v3 bzero/bcopy calls, thanks to Nigel Kukard.
+
 xfsprogs-2.9.7 (1 Mar 2008)
        - Lazy superblock counters not yet the default with mkfs.xfs.
        - Add -y (another no-op) fsck option.
index c38a94267a8f1eb0e69569df36b7019aec20540f..8e3155b2fb203b103db4bced2b130ca5e8b05ec1 100644 (file)
@@ -6,6 +6,8 @@ xfs_admin \- change parameters of an XFS filesystem
 [
 .B \-eflu
 ] [
+.BR "\-c 0" | 1
+] [
 .B \-L
 .I label
 ] [
@@ -53,6 +55,18 @@ Print the current filesystem label.
 .B \-u
 Print the current filesystem UUID (Universally Unique IDentifier).
 .TP
+.BR "\-c 0" | 1
+Enable (1) or disable (0) lazy-counters in the filesystem.
+This operation may take quite a bit of time on large filesystems as the
+entire filesystem needs to be scanned when this option is changed.
+.IP
+With lazy-counters enabled, the superblock is not modified or logged on
+every change of the free-space and inode counters. Instead, enough
+information is kept in other parts of the filesystem to be able to
+maintain the counter values without needing to keep them in the
+superblock. This gives significant improvements in performance on some
+configurations and metadata intensive workloads.
+.TP
 .BI \-L " label"
 Set the filesystem label to
 .IR label .
@@ -90,4 +104,5 @@ rather than its block special device name.
 .BR mount (8),
 .BR xfs_db (8),
 .BR xfs_growfs (8),
+.BR xfs_repair (8),
 .BR xfs (5).
index 8784c6e1d193c30142852b66a195a020ea8d5887..d6cecb86a9cbed2a02f768af83aa23fc13081d38 100644 (file)
@@ -9,6 +9,8 @@ xfs_repair \- repair an XFS filesystem
 .B \-m
 .I maxmem
 ] [
+.BI \-c " subopt" = value
+] [
 .B \-o
 .I subopt\c
 [\c
@@ -100,6 +102,11 @@ This option overrides these limits.
 .B NOTE:
 These memory limits are only approximate and may use more than the specified
 limit.
+.TP
+.BI \-c " subopt" = value
+Change filesystem parameters. Refer to
+.BR xfs_admin (8)
+for information on changing filesystem parameters.
 .HP
 .B \-o
 .I subopt\c
@@ -532,6 +539,7 @@ fixed and/or improved.
 .BR dd (1),
 .BR mkfs.xfs (8),
 .BR umount (8),
+.BR xfs_admin (8),
 .BR xfs_check (8),
 .BR xfs_metadump (8),
 .BR xfs (5).
index 2d5bce65ab55d18a34877a0cc67d25f2b12759bb..9a78caee5d84a8d45bffb4d9bb60ff34f3bef92a 100644 (file)
@@ -116,6 +116,8 @@ EXTERN char *log_name;              /* Name of log device */
 EXTERN int     log_spec;               /* Log dev specified as option */
 EXTERN char    *rt_name;               /* Name of realtime device */
 EXTERN int     rt_spec;                /* Realtime dev specified as option */
+EXTERN int     convert_lazy_count;     /* Convert lazy-count mode on/off */
+EXTERN int     lazy_count;             /* What to set if to if converting */
 
 /* misc status variables */
 
index 3a25934a1e8e5e15c6e6c31a0c2c236df11874c3..618796e811b1e6343fba1b6f9ce6e69e7aec3747 100644 (file)
@@ -105,6 +105,32 @@ phase1(xfs_mount_t *mp)
                do_warn(_("superblock has a features2 mismatch, correcting\n"));
        }
 
+       /*
+        * apply any version changes or conversions after the primary
+        * superblock has been verified or repaired
+        *
+        * Send output to stdout as do_log and everything else in repair
+        * is sent to stderr and there is no "quiet" option. xfs_admin
+        * will filter stderr but not stdout. This situation must be improved.
+        */
+       if (convert_lazy_count) {
+               if (lazy_count && !xfs_sb_version_haslazysbcount(sb)) {
+                       sb->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
+                       sb->sb_features2 |= XFS_SB_VERSION2_LAZYSBCOUNTBIT;
+                       primary_sb_modified = 1;
+                       printf(_("Enabling lazy-counters\n"));
+               } else
+               if (!lazy_count && xfs_sb_version_haslazysbcount(sb)) {
+                       sb->sb_features2 &= ~XFS_SB_VERSION2_LAZYSBCOUNTBIT;
+                       printf(_("Disabling lazy-counters\n"));
+                       primary_sb_modified = 1;
+               } else {
+                       printf(_("Lazy-counters are already %s\n"),
+                               lazy_count ? _("enabled") : _("disabled"));
+                       exit(0); /* no conversion required, exit */
+               }
+       }
+
        if (primary_sb_modified)  {
                if (!no_modify)  {
                        do_warn(_("writing modified primary superblock\n"));
index 0e7e564ea823f52970f84d85e53cd4f69eebe7b0..0efab9c3ec8196ff2cf7a11ac1f4cc91d51e2dbe 100644 (file)
@@ -48,7 +48,7 @@ extern void   incore_init(xfs_mount_t *);
  */
 
 /*
- * -o (user-supplied override options)
+ * -o: user-supplied override options
  */
 
 char *o_opts[] = {
@@ -65,6 +65,17 @@ char *o_opts[] = {
        NULL
 };
 
+/*
+ * -c: conversion options
+ */
+
+char *c_opts[] = {
+#define CONVERT_LAZY_COUNT     0
+       "lazycount",
+       NULL
+};
+
+
 static int     ihash_option_used;
 static int     bhash_option_used;
 static long    max_mem_specified;      /* in megabytes */
@@ -72,9 +83,23 @@ static long  max_mem_specified;      /* in megabytes */
 static void
 usage(void)
 {
-       do_warn(
-_("Usage: %s [-nLvV] [-m memMB] [-o subopt[=value]] [-l logdev] [-r rtdev] devname\n"),
-               progname);
+       do_warn(_(
+"Usage: %s [options] device\n"
+"\n"
+"Options:\n"
+"  -f           The device is a file\n"
+"  -L           Force log zeroing. Do this as a last resort.\n"
+"  -l logdev    Specifies the device where the external log resides.\n"
+"  -m maxmem    Maximum amount of memory to be used in megabytes.\n"
+"  -n           No modify mode, just checks the filesystem for damage.\n"
+"  -P           Disables prefetching.\n"
+"  -r rtdev     Specifies the device where the realtime section resides.\n"
+"  -v           Verbose output.\n"
+"  -c subopts   Change filesystem parameters - use xfs_admin.\n"
+"  -o subopts   Override default behaviour, refer to man page.\n"
+"  -t interval  Reporting interval in minutes.\n"
+"  -d           Repair dangerously.\n"
+"  -V           Reports version and exits.\n"), progname);
        exit(1);
 }
 
@@ -89,7 +114,7 @@ err_string(int err_code)
                err_message[XR_BAD_MAGIC] = _("bad magic number");
                err_message[XR_BAD_BLOCKSIZE] = _("bad blocksize field");
                err_message[XR_BAD_BLOCKLOG] = _("bad blocksize log field");
-               err_message[XR_BAD_VERSION] = _("bad version number");
+               err_message[XR_BAD_VERSION] = _("bad or unsupported version");
                err_message[XR_BAD_INPROGRESS] =
                        _("filesystem mkfs-in-progress bit set");
                err_message[XR_BAD_FS_SIZE_DATA] =
@@ -193,7 +218,7 @@ process_args(int argc, char **argv)
         * XXX have to add suboption processing here
         * attributes, quotas, nlinks, aligned_inos, sb_fbits
         */
-       while ((c = getopt(argc, argv, "o:fl:m:r:LnDvVdPt:")) != EOF)  {
+       while ((c = getopt(argc, argv, "c:o:fl:m:r:LnDvVdPt:")) != EOF)  {
                switch (c) {
                case 'D':
                        dumpcore = 1;
@@ -239,6 +264,22 @@ process_args(int argc, char **argv)
                                }
                        }
                        break;
+               case 'c':
+                       p = optarg;
+                       while (*p) {
+                               char *val;
+
+                               switch (getsubopt(&p, (constpp)c_opts, &val)) {
+                               case CONVERT_LAZY_COUNT:
+                                       lazy_count = (int)strtol(val, 0, 0);
+                                       convert_lazy_count = 1;
+                                       break;
+                               default:
+                                       unknown('c', val);
+                                       break;
+                               }
+                       }
+                       break;
                case 'l':
                        log_name = optarg;
                        log_spec = 1;