Index: ci/xfsprogs/repair/globals.h =================================================================== --- ci.orig/xfsprogs/repair/globals.h 2008-01-16 14:54:12.000000000 +1100 +++ ci/xfsprogs/repair/globals.h 2008-02-22 17:21:41.195651501 +1100 @@ -116,6 +116,8 @@ 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: ci/xfsprogs/repair/phase1.c =================================================================== --- ci.orig/xfsprogs/repair/phase1.c 2008-01-16 14:54:12.000000000 +1100 +++ ci/xfsprogs/repair/phase1.c 2008-02-22 17:29:38.285953524 +1100 @@ -91,6 +91,26 @@ primary_sb_modified = 1; } + /* + * apply any version changes or conversions after the primary + * superblock has been verified or repaired + */ + if (convert_lazy_count) { + if (lazy_count && !xfs_sb_version_haslazysbcount(sb)) { + sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; + sbp->sb_features2 |= XFS_SB_VERSION2_LAZYSBCOUNTBIT; + primary_sb_modified = 1; + do_log(_(" - Enabling lazy-counters\n")); + } else + if (!lazy_count && xfs_sb_version_haslazysbcount(sb)) { + sbp->sb_features2 &= ~XFS_SB_VERSION2_LAZYSBCOUNTBIT; + do_log(_(" - Disabling lazy-counters\n")); + primary_sb_modified = 1; + } else + do_log(_(" - Lazy-counters are already %s\n"), + lazy_count ? _("enabled") : _("disabled")); + } + if (primary_sb_modified) { if (!no_modify) { do_warn(_("writing modified primary superblock\n")); Index: ci/xfsprogs/repair/xfs_repair.c =================================================================== --- ci.orig/xfsprogs/repair/xfs_repair.c 2008-02-22 14:15:42.000000000 +1100 +++ ci/xfsprogs/repair/xfs_repair.c 2008-02-22 14:36:07.385247765 +1100 @@ -47,7 +47,7 @@ */ /* - * -o (user-supplied override options) + * -o: user-supplied override options */ char *o_opts[] = { @@ -64,15 +64,25 @@ 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 void usage(void) { - do_warn( -_("Usage: %s [-nLvV] [-o subopt[=value]] [-l logdev] [-r rtdev] devname\n"), - progname); + do_warn(_("Usage: %s [-nLPvV] [-c subopt=value] [-o subopt[=value]] " + "[-l logdev] [-r rtdev] devname\n"), progname); exit(1); } @@ -191,7 +201,7 @@ * XXX have to add suboption processing here * attributes, quotas, nlinks, aligned_inos, sb_fbits */ - while ((c = getopt(argc, argv, "o:fl:r:LnDvVdPMt:")) != EOF) { + while ((c = getopt(argc, argv, "c:o:fl:r:LnDvVdPMt:")) != EOF) { switch (c) { case 'D': dumpcore = 1; @@ -234,6 +244,22 @@ } } 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;