From: Nathan Scott Date: Thu, 18 May 2006 03:48:51 +0000 (+0000) Subject: Add code to xfs_db/admin to allow version 1 to version 2 log transition. X-Git-Tag: v2.8.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6699747336d0765d2e7c11fa2916af43fe404117;p=thirdparty%2Fxfsprogs-dev.git Add code to xfs_db/admin to allow version 1 to version 2 log transition. Merge of master-melb:xfs-cmds:25961a by kenmcd. --- diff --git a/db/sb.c b/db/sb.c index 746a72f4d..9f329584d 100644 --- a/db/sb.c +++ b/db/sb.c @@ -536,11 +536,12 @@ version_help(void) " 'version extflg' - enable unwritten extents\n" " 'version attr1' - enable v1 inline extended attributes\n" " 'version attr2' - enable v2 inline extended attributes\n" +" 'version log2' - enable v2 log format\n" "\n" "The version function prints currently enabled features for a filesystem\n" "according to its the version field of the primary superblock.\n" "It can also be used to enable selected features, such as support for\n" -"unwritten extents. The upated version is written into to all AGs.\n" +"unwritten extents. The upated version is written into all AGs.\n" "\n" ); } @@ -549,14 +550,21 @@ static int do_version(xfs_agnumber_t agno, __uint16_t version, __uint32_t features) { xfs_sb_t tsb; + __int64_t fields = 0; if (!get_sb(agno, &tsb)) return 0; + if ((version & XFS_SB_VERSION_LOGV2BIT) && + !XFS_SB_VERSION_HASLOGV2(&tsb)) { + tsb.sb_logsunit = 1; + fields |= (1LL << XFS_SBS_LOGSUNIT); + } + tsb.sb_versionnum = version; tsb.sb_features2 = features; - libxfs_xlate_sb(iocur_top->data, &tsb, -1, - (XFS_SB_VERSIONNUM | XFS_SBS_FEATURES2)); + fields |= XFS_SB_VERSIONNUM | XFS_SB_FEATURES2; + libxfs_xlate_sb(iocur_top->data, &tsb, -1, fields); write_cur(); return 1; } @@ -641,6 +649,26 @@ version_f( XFS_SB_VERSION_EXTFLGBIT; break; } + } else if (!strcasecmp(argv[1], "log2")) { + switch (XFS_SB_VERSION_NUM(&mp->m_sb)) { + case XFS_SB_VERSION_1: + version = 0x0004 | XFS_SB_VERSION_LOGV2BIT; + break; + case XFS_SB_VERSION_2: + version = 0x0014 | XFS_SB_VERSION_LOGV2BIT; + break; + case XFS_SB_VERSION_3: + version = 0x0034 | XFS_SB_VERSION_LOGV2BIT; + break; + case XFS_SB_VERSION_4: + if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) + dbprintf("version 2 log format" + " is already in use\n"); + else + version = mp->m_sb.sb_versionnum | + XFS_SB_VERSION_LOGV2BIT; + break; + } } else if (!strcasecmp(argv[1], "attr1")) { if (XFS_SB_VERSION_HASATTR2(&mp->m_sb)) { if (!(mp->m_sb.sb_features2 &= diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh index 1702a3158..ac86d128d 100755 --- a/db/xfs_admin.sh +++ b/db/xfs_admin.sh @@ -4,13 +4,14 @@ # OPTS="" -USAGE="Usage: xfs_admin [-efluV] [-L label] [-U uuid] special" +USAGE="Usage: xfs_admin [-efjluV] [-L label] [-U uuid] special" -while getopts "efluL:U:V" c +while getopts "efjluL: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";; diff --git a/doc/CHANGES b/doc/CHANGES index 9594e6f23..0d03a6611 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,7 @@ +[cvs] + - Added code to xfs_db and xfs_admin to allow conversion + from version 1 to version 2 logs. + xfsprogs-2.7.18 (16 May 2006) - Fixed a case where xfs_repair was reporting a valid used block as a duplicate during phase 4. diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 7034b5e5c..3cb42f598 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -32,6 +32,10 @@ already have this enabled. Specifies that the filesystem image to be processed is stored in a regular file (see the \f2mkfs.xfs\f1 \f3\-d\f1 \f2file\f1 option). .TP 5 +\f3\-j\f1 +Enables version 2 log format (journal format supporting larger +log buffers). +.TP 5 \f3\-l\f1 Print the current filesystem label. .TP 5 diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index dd7530e8f..2b28a1b55 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -436,13 +436,15 @@ superblock in the filesystem. to all secondary copies of the superblock. If no argument is given, the current filesystem UUID is printed. .TP -\f3version\f1 [ \f2extflg\f1 | [\f2versionnum\f1 \f2features2\f1 ] ] +\f3version\f1 [ \f2feature\f1 | [\f2versionnum\f1 \f2features2\f1 ] ] Enable selected features for a filesystem (certain features can be enabled on an unmounted filesystem, after .IR mkfs.xfs (8) has created the filesystem). Support for unwritten extents can be enabled using the \f2extflg\f1 option. +Support for version 2 log format can be enabled using the \f2log2\f1 +option. Support for extended attributes can be enabled using the \f2attr1\f1 or \f2attr2\f1 option. Once enabled, extended attributes cannot be disabled, but the user