diff mbox series

[1/5] mkfs: allow users to specify rtinherit=0

Message ID 160375511989.879169.8816363379781873320.stgit@magnolia
State Superseded
Headers show
Series xfsprogs: fixes for 5.10 | expand

Commit Message

Darrick J. Wong Oct. 26, 2020, 11:31 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

mkfs has quite a few boolean options that can be specified in several
ways: "option=1" (turn it on), "option" (turn it on), or "option=0"
(turn it off).  For whatever reason, rtinherit sticks out as the only
mkfs parameter that doesn't behave that way.  Let's make it behave the
same as all the other boolean variables.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 mkfs/xfs_mkfs.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Allison Henderson Oct. 27, 2020, 5:35 a.m. UTC | #1
On 10/26/20 4:31 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> mkfs has quite a few boolean options that can be specified in several
> ways: "option=1" (turn it on), "option" (turn it on), or "option=0"
> (turn it off).  For whatever reason, rtinherit sticks out as the only
> mkfs parameter that doesn't behave that way.  Let's make it behave the
> same as all the other boolean variables.
> 
Looks ok
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>   mkfs/xfs_mkfs.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 8fe149d74b0a..908d520df909 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -349,7 +349,7 @@ static struct opt_params dopts = {
>   		},
>   		{ .index = D_RTINHERIT,
>   		  .conflicts = { { NULL, LAST_CONFLICT } },
> -		  .minval = 1,
> +		  .minval = 0,
>   		  .maxval = 1,
>   		  .defaultval = 1,
>   		},
> @@ -1429,6 +1429,8 @@ data_opts_parser(
>   	case D_RTINHERIT:
>   		if (getnum(value, opts, subopt))
>   			cli->fsx.fsx_xflags |= FS_XFLAG_RTINHERIT;
> +		else
> +			cli->fsx.fsx_xflags &= ~FS_XFLAG_RTINHERIT;
>   		break;
>   	case D_PROJINHERIT:
>   		cli->fsx.fsx_projid = getnum(value, opts, subopt);
>
Eric Sandeen Oct. 27, 2020, 5:22 p.m. UTC | #2
On 10/26/20 6:31 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> mkfs has quite a few boolean options that can be specified in several
> ways: "option=1" (turn it on), "option" (turn it on), or "option=0"
> (turn it off).  For whatever reason, rtinherit sticks out as the only
> mkfs parameter that doesn't behave that way.  Let's make it behave the
> same as all the other boolean variables.

Seems fine; tho looking over mkfs.xfs.8, I think we could clarify what all
the valid ${FOO}inherit=[value] values are, in general.

Reviewed-by: Eric Sandeen <sandeen@redhat.com> 

-Eric

> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  mkfs/xfs_mkfs.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 8fe149d74b0a..908d520df909 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -349,7 +349,7 @@ static struct opt_params dopts = {
>  		},
>  		{ .index = D_RTINHERIT,
>  		  .conflicts = { { NULL, LAST_CONFLICT } },
> -		  .minval = 1,
> +		  .minval = 0,
>  		  .maxval = 1,
>  		  .defaultval = 1,
>  		},
> @@ -1429,6 +1429,8 @@ data_opts_parser(
>  	case D_RTINHERIT:
>  		if (getnum(value, opts, subopt))
>  			cli->fsx.fsx_xflags |= FS_XFLAG_RTINHERIT;
> +		else
> +			cli->fsx.fsx_xflags &= ~FS_XFLAG_RTINHERIT;
>  		break;
>  	case D_PROJINHERIT:
>  		cli->fsx.fsx_projid = getnum(value, opts, subopt);
>
Christoph Hellwig Oct. 28, 2020, 7:32 a.m. UTC | #3
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 8fe149d74b0a..908d520df909 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -349,7 +349,7 @@  static struct opt_params dopts = {
 		},
 		{ .index = D_RTINHERIT,
 		  .conflicts = { { NULL, LAST_CONFLICT } },
-		  .minval = 1,
+		  .minval = 0,
 		  .maxval = 1,
 		  .defaultval = 1,
 		},
@@ -1429,6 +1429,8 @@  data_opts_parser(
 	case D_RTINHERIT:
 		if (getnum(value, opts, subopt))
 			cli->fsx.fsx_xflags |= FS_XFLAG_RTINHERIT;
+		else
+			cli->fsx.fsx_xflags &= ~FS_XFLAG_RTINHERIT;
 		break;
 	case D_PROJINHERIT:
 		cli->fsx.fsx_projid = getnum(value, opts, subopt);