diff mbox series

[1/2] xfs_admin: support external log devices

Message ID 157530823862.128859.3517412709152067366.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfs_admin: unify online/offline fs label setting | expand

Commit Message

Darrick J. Wong Dec. 2, 2019, 5:37 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Add to xfs_admin the ability to pass external log devices to xfs_db.
This is necessary to make changes on such filesystems.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 db/xfs_admin.sh      |   12 ++++++++++--
 man/man8/xfs_admin.8 |    3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Eric Sandeen Dec. 2, 2019, 5:41 p.m. UTC | #1
On 12/2/19 11:37 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Add to xfs_admin the ability to pass external log devices to xfs_db.
> This is necessary to make changes on such filesystems.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  db/xfs_admin.sh      |   12 ++++++++++--
>  man/man8/xfs_admin.8 |    3 +++
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
> index 305ef2b7..bd325da2 100755
> --- a/db/xfs_admin.sh
> +++ b/db/xfs_admin.sh
> @@ -7,7 +7,7 @@
>  status=0
>  DB_OPTS=""
>  REPAIR_OPTS=""
> -USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
> +USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device [logdev]"
>  
>  while getopts "efjlpuc:L:U:V" c
>  do
> @@ -33,7 +33,15 @@ done
>  set -- extra $@
>  shift $OPTIND
>  case $# in
> -	1)	if [ -n "$DB_OPTS" ]
> +	1|2)
> +		# Pick up the log device, if present
> +		if [ -n "$2" ]; then
> +			DB_OPTS=$DB_OPTS" -l '$2'"
> +			test -n "$REPAIR_OPTS" && \
> +				REPAIR_OPTS=$REPAIR_OPTS" -l '$2'"
> +		fi
> +
> +		if [ -n "$DB_OPTS" ]
>  		then
>  			eval xfs_db -x -p xfs_admin $DB_OPTS $1
>  			status=$?
> diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
> index 20a114f5..d7942418 100644
> --- a/man/man8/xfs_admin.8
> +++ b/man/man8/xfs_admin.8
> @@ -15,6 +15,9 @@ xfs_admin \- change parameters of an XFS filesystem
>  .I uuid
>  ]
>  .I device
> +[
> +.I logdev
> +]

logdev should be marked as optional, right?  [logdev] ?
And documented as to when this arg should (or should not be) used?

-Eric
Darrick J. Wong Dec. 2, 2019, 5:43 p.m. UTC | #2
On Mon, Dec 02, 2019 at 11:41:13AM -0600, Eric Sandeen wrote:
> 
> 
> On 12/2/19 11:37 AM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Add to xfs_admin the ability to pass external log devices to xfs_db.
> > This is necessary to make changes on such filesystems.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  db/xfs_admin.sh      |   12 ++++++++++--
> >  man/man8/xfs_admin.8 |    3 +++
> >  2 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
> > index 305ef2b7..bd325da2 100755
> > --- a/db/xfs_admin.sh
> > +++ b/db/xfs_admin.sh
> > @@ -7,7 +7,7 @@
> >  status=0
> >  DB_OPTS=""
> >  REPAIR_OPTS=""
> > -USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
> > +USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device [logdev]"
> >  
> >  while getopts "efjlpuc:L:U:V" c
> >  do
> > @@ -33,7 +33,15 @@ done
> >  set -- extra $@
> >  shift $OPTIND
> >  case $# in
> > -	1)	if [ -n "$DB_OPTS" ]
> > +	1|2)
> > +		# Pick up the log device, if present
> > +		if [ -n "$2" ]; then
> > +			DB_OPTS=$DB_OPTS" -l '$2'"
> > +			test -n "$REPAIR_OPTS" && \
> > +				REPAIR_OPTS=$REPAIR_OPTS" -l '$2'"
> > +		fi
> > +
> > +		if [ -n "$DB_OPTS" ]
> >  		then
> >  			eval xfs_db -x -p xfs_admin $DB_OPTS $1
> >  			status=$?
> > diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
> > index 20a114f5..d7942418 100644
> > --- a/man/man8/xfs_admin.8
> > +++ b/man/man8/xfs_admin.8
> > @@ -15,6 +15,9 @@ xfs_admin \- change parameters of an XFS filesystem
> >  .I uuid
> >  ]
> >  .I device
> > +[
> > +.I logdev
> > +]
> 
> logdev should be marked as optional, right?  [logdev] ?

It is.

> And documented as to when this arg should (or should not be) used?

Yes.  Will fix that.

--D

> -Eric
diff mbox series

Patch

diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
index 305ef2b7..bd325da2 100755
--- a/db/xfs_admin.sh
+++ b/db/xfs_admin.sh
@@ -7,7 +7,7 @@ 
 status=0
 DB_OPTS=""
 REPAIR_OPTS=""
-USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
+USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device [logdev]"
 
 while getopts "efjlpuc:L:U:V" c
 do
@@ -33,7 +33,15 @@  done
 set -- extra $@
 shift $OPTIND
 case $# in
-	1)	if [ -n "$DB_OPTS" ]
+	1|2)
+		# Pick up the log device, if present
+		if [ -n "$2" ]; then
+			DB_OPTS=$DB_OPTS" -l '$2'"
+			test -n "$REPAIR_OPTS" && \
+				REPAIR_OPTS=$REPAIR_OPTS" -l '$2'"
+		fi
+
+		if [ -n "$DB_OPTS" ]
 		then
 			eval xfs_db -x -p xfs_admin $DB_OPTS $1
 			status=$?
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index 20a114f5..d7942418 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -15,6 +15,9 @@  xfs_admin \- change parameters of an XFS filesystem
 .I uuid
 ]
 .I device
+[
+.I logdev
+]
 .br
 .B xfs_admin \-V
 .SH DESCRIPTION