linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features
@ 2013-11-14 13:30 David Sterba
  2013-11-14 13:56 ` Chris Mason
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2013-11-14 13:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

A way of disabling features that are on by default in case it's not
wanted, eg. due to lack of support in the used kernel.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 mkfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mkfs.c b/mkfs.c
index cd0af9ef8b4f..f825e1b6bc2d 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
 	int found = 0;
 
 	for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
-		if (!strcmp(mkfs_features[i].name, name)) {
+		if (name[0] == '^' &&
+			!strcmp(mkfs_features[i].name, name + 1)) {
+			*flags &= ~ mkfs_features[i].flag;
+			found = 1;
+		} else if (!strcmp(mkfs_features[i].name, name)) {
 			*flags |= mkfs_features[i].flag;
 			found = 1;
 		}
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features
  2013-11-14 13:30 [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features David Sterba
@ 2013-11-14 13:56 ` Chris Mason
  2013-11-14 14:14   ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Mason @ 2013-11-14 13:56 UTC (permalink / raw)
  To: David Sterba, linux-btrfs; +Cc: David Sterba

Quoting David Sterba (2013-11-14 08:30:45)
> A way of disabling features that are on by default in case it's not
> wanted, eg. due to lack of support in the used kernel.
> 
> Signed-off-by: David Sterba <dsterba@suse.cz>
> ---
>  mkfs.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/mkfs.c b/mkfs.c
> index cd0af9ef8b4f..f825e1b6bc2d 100644
> --- a/mkfs.c
> +++ b/mkfs.c
> @@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
>         int found = 0;
>  
>         for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
> -               if (!strcmp(mkfs_features[i].name, name)) {
> +               if (name[0] == '^' &&
> +                       !strcmp(mkfs_features[i].name, name + 1)) {
> +                       *flags &= ~ mkfs_features[i].flag;
> +                       found = 1;
> +               } else if (!strcmp(mkfs_features[i].name, name)) {
>                         *flags |= mkfs_features[i].flag;
>                         found = 1;
>                 }

Perfect, I was going to do this today so I can enable extrefs.

-chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features
  2013-11-14 13:56 ` Chris Mason
@ 2013-11-14 14:14   ` David Sterba
  2013-11-14 17:26     ` Chris Mason
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2013-11-14 14:14 UTC (permalink / raw)
  To: Chris Mason; +Cc: David Sterba, linux-btrfs

On Thu, Nov 14, 2013 at 08:56:13AM -0500, Chris Mason wrote:
> Quoting David Sterba (2013-11-14 08:30:45)
> > A way of disabling features that are on by default in case it's not
> > wanted, eg. due to lack of support in the used kernel.
> > 
> > Signed-off-by: David Sterba <dsterba@suse.cz>
> > ---
> >  mkfs.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/mkfs.c b/mkfs.c
> > index cd0af9ef8b4f..f825e1b6bc2d 100644
> > --- a/mkfs.c
> > +++ b/mkfs.c
> > @@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
> >         int found = 0;
> >  
> >         for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
> > -               if (!strcmp(mkfs_features[i].name, name)) {
> > +               if (name[0] == '^' &&
> > +                       !strcmp(mkfs_features[i].name, name + 1)) {
> > +                       *flags &= ~ mkfs_features[i].flag;
> > +                       found = 1;
> > +               } else if (!strcmp(mkfs_features[i].name, name)) {
> >                         *flags |= mkfs_features[i].flag;
> >                         found = 1;
> >                 }
> 
> Perfect, I was going to do this today so I can enable extrefs.

Just sent :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features
  2013-11-14 14:14   ` David Sterba
@ 2013-11-14 17:26     ` Chris Mason
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Mason @ 2013-11-14 17:26 UTC (permalink / raw)
  To: dsterba, David Sterba; +Cc: David Sterba, linux-btrfs

Quoting David Sterba (2013-11-14 09:14:14)
> On Thu, Nov 14, 2013 at 08:56:13AM -0500, Chris Mason wrote:
> > Quoting David Sterba (2013-11-14 08:30:45)
> > > A way of disabling features that are on by default in case it's not
> > > wanted, eg. due to lack of support in the used kernel.
> > > 
> > > Signed-off-by: David Sterba <dsterba@suse.cz>
> > > ---
> > >  mkfs.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/mkfs.c b/mkfs.c
> > > index cd0af9ef8b4f..f825e1b6bc2d 100644
> > > --- a/mkfs.c
> > > +++ b/mkfs.c
> > > @@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
> > >         int found = 0;
> > >  
> > >         for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
> > > -               if (!strcmp(mkfs_features[i].name, name)) {
> > > +               if (name[0] == '^' &&
> > > +                       !strcmp(mkfs_features[i].name, name + 1)) {
> > > +                       *flags &= ~ mkfs_features[i].flag;
> > > +                       found = 1;
> > > +               } else if (!strcmp(mkfs_features[i].name, name)) {
> > >                         *flags |= mkfs_features[i].flag;
> > >                         found = 1;
> > >                 }
> > 
> > Perfect, I was going to do this today so I can enable extrefs.
> 
> Just sent :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-14 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 13:30 [PATCH] btrfs-progs: mkfs: extend -O syntax to disable features David Sterba
2013-11-14 13:56 ` Chris Mason
2013-11-14 14:14   ` David Sterba
2013-11-14 17:26     ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).