* [REVIEW] Add lazy-counter conversion to xfs_repair
@ 2008-02-22 6:45 Barry Naujok
2008-02-22 17:37 ` Eric Sandeen
0 siblings, 1 reply; 5+ messages in thread
From: Barry Naujok @ 2008-02-22 6:45 UTC (permalink / raw)
To: xfs@oss.sgi.com
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
In response to the thread "Differences in mkfs.xfs and xfs_info output.",
xfs_repair has been improved to allow version changes/conversion of
filesystems.
So, this patch introduces the first in an ongoing series of in-place
filesystem version changes with xfs_repair and the "-c" (convert) option.
To turn on/off the lazy-superblock feature, run the following xfs_repair
commmand on your filesystem:
# xfs_repair -c lazycount=[0|1] <device>
It is advised to run Dave Chinner's "detect and correct bad features2
superblock field" patch with this patch as lazy-counters are stored in the
features2 field in the superblock.
The next round of case-insensitive support patches will allow xfs_repair
to convert filesystems to different CI versions (ie. -c
name=[raw|ascii|unicode]).
Barry.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: convert.patch --]
[-- Type: text/x-patch; name=convert.patch, Size: 3457 bytes --]
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [REVIEW] Add lazy-counter conversion to xfs_repair
2008-02-22 6:45 [REVIEW] Add lazy-counter conversion to xfs_repair Barry Naujok
@ 2008-02-22 17:37 ` Eric Sandeen
2008-02-23 5:06 ` David Chinner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Eric Sandeen @ 2008-02-22 17:37 UTC (permalink / raw)
To: Barry Naujok; +Cc: xfs@oss.sgi.com
Barry Naujok wrote:
> In response to the thread "Differences in mkfs.xfs and xfs_info output.",
> xfs_repair has been improved to allow version changes/conversion of
> filesystems.
>
> So, this patch introduces the first in an ongoing series of in-place
> filesystem version changes with xfs_repair and the "-c" (convert) option.
>
> To turn on/off the lazy-superblock feature, run the following xfs_repair
> commmand on your filesystem:
>
> # xfs_repair -c lazycount=[0|1] <device>
How about adding this to xfs_admin as well, since some flag changes are
already in there?
i.e. xfs_admin -<something... l and L are taken> could invoke xfs_repair
-c lazycount ...?
It just strikes me as a tad confusing that to change v2 logs or
unwritten extent support, you use xfs_admin, and to change lazy sb
counters, you must run repair...
(I understand that repair must be run post-change, but a common tool to
invoke all feature changes seems good to me)
-Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [REVIEW] Add lazy-counter conversion to xfs_repair
2008-02-22 17:37 ` Eric Sandeen
@ 2008-02-23 5:06 ` David Chinner
2008-02-24 23:55 ` Barry Naujok
2008-02-25 0:05 ` Barry Naujok
2 siblings, 0 replies; 5+ messages in thread
From: David Chinner @ 2008-02-23 5:06 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Barry Naujok, xfs@oss.sgi.com
On Fri, Feb 22, 2008 at 11:37:29AM -0600, Eric Sandeen wrote:
> Barry Naujok wrote:
> > In response to the thread "Differences in mkfs.xfs and xfs_info output.",
> > xfs_repair has been improved to allow version changes/conversion of
> > filesystems.
> >
> > So, this patch introduces the first in an ongoing series of in-place
> > filesystem version changes with xfs_repair and the "-c" (convert) option.
> >
> > To turn on/off the lazy-superblock feature, run the following xfs_repair
> > commmand on your filesystem:
> >
> > # xfs_repair -c lazycount=[0|1] <device>
>
> How about adding this to xfs_admin as well, since some flag changes are
> already in there?
>
> i.e. xfs_admin -<something... l and L are taken> could invoke xfs_repair
> -c lazycount ...?
>
> It just strikes me as a tad confusing that to change v2 logs or
> unwritten extent support, you use xfs_admin, and to change lazy sb
> counters, you must run repair...
*nod*
> (I understand that repair must be run post-change, but a common tool to
> invoke all feature changes seems good to me)
I have to say I agree with Eric here - xfs_admin is the interface that
should be used for changing feature bits in the filesystem. The mechanism
it invokes to acheive the change can be anything, but we should have a
single tool that we direct ppl to use to to change how their filesystem
behaves.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [REVIEW] Add lazy-counter conversion to xfs_repair
2008-02-22 17:37 ` Eric Sandeen
2008-02-23 5:06 ` David Chinner
@ 2008-02-24 23:55 ` Barry Naujok
2008-02-25 0:05 ` Barry Naujok
2 siblings, 0 replies; 5+ messages in thread
From: Barry Naujok @ 2008-02-24 23:55 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs@oss.sgi.com
On Sat, 23 Feb 2008 04:37:29 +1100, Eric Sandeen <sandeen@sandeen.net>
wrote:
> Barry Naujok wrote:
>> In response to the thread "Differences in mkfs.xfs and xfs_info
>> output.",
>> xfs_repair has been improved to allow version changes/conversion of
>> filesystems.
>>
>> So, this patch introduces the first in an ongoing series of in-place
>> filesystem version changes with xfs_repair and the "-c" (convert)
>> option.
>>
>> To turn on/off the lazy-superblock feature, run the following xfs_repair
>> commmand on your filesystem:
>>
>> # xfs_repair -c lazycount=[0|1] <device>
>
> How about adding this to xfs_admin as well, since some flag changes are
> already in there?
Yep, I can do that, it would be:
-c for disabling and +c for enabling lazy counters.
> i.e. xfs_admin -<something... l and L are taken> could invoke xfs_repair
> -c lazycount ...?
>
> It just strikes me as a tad confusing that to change v2 logs or
> unwritten extent support, you use xfs_admin, and to change lazy sb
> counters, you must run repair...
>
> (I understand that repair must be run post-change, but a common tool to
> invoke all feature changes seems good to me)
>
> -Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [REVIEW] Add lazy-counter conversion to xfs_repair
2008-02-22 17:37 ` Eric Sandeen
2008-02-23 5:06 ` David Chinner
2008-02-24 23:55 ` Barry Naujok
@ 2008-02-25 0:05 ` Barry Naujok
2 siblings, 0 replies; 5+ messages in thread
From: Barry Naujok @ 2008-02-25 0:05 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs@oss.sgi.com
On Sat, 23 Feb 2008 04:37:29 +1100, Eric Sandeen <sandeen@sandeen.net>
wrote:
> Barry Naujok wrote:
>> In response to the thread "Differences in mkfs.xfs and xfs_info
>> output.",
>> xfs_repair has been improved to allow version changes/conversion of
>> filesystems.
>>
>> So, this patch introduces the first in an ongoing series of in-place
>> filesystem version changes with xfs_repair and the "-c" (convert)
>> option.
>>
>> To turn on/off the lazy-superblock feature, run the following xfs_repair
>> commmand on your filesystem:
>>
>> # xfs_repair -c lazycount=[0|1] <device>
>
> How about adding this to xfs_admin as well, since some flag changes are
> already in there?
>
> i.e. xfs_admin -<something... l and L are taken> could invoke xfs_repair
> -c lazycount ...?
Ah... should have read this bit :) Yes, will do! (Was thinking initially
to add the support to xfs_db then telling the user to run repair rather
than the xfs_admin script running repair directly!)
> It just strikes me as a tad confusing that to change v2 logs or
> unwritten extent support, you use xfs_admin, and to change lazy sb
> counters, you must run repair...
>
> (I understand that repair must be run post-change, but a common tool to
> invoke all feature changes seems good to me)
>
> -Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-25 0:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-22 6:45 [REVIEW] Add lazy-counter conversion to xfs_repair Barry Naujok
2008-02-22 17:37 ` Eric Sandeen
2008-02-23 5:06 ` David Chinner
2008-02-24 23:55 ` Barry Naujok
2008-02-25 0:05 ` Barry Naujok
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox