linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: li zhang <zhanglikernel@gmail.com>
To: David Sterba <dsterba@suse.cz>,
	Li Zhang <zhanglikernel@gmail.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: allow user to insert property compression=none to file.
Date: Wed, 19 Jan 2022 18:49:24 +0800	[thread overview]
Message-ID: <CAAa-AGm4VUDFNZwe_rY4cJ0XZfXGdGRh0tPhSq-WOZYLVcPgDg@mail.gmail.com> (raw)
In-Reply-To: <20220117134441.GG14046@twin.jikos.cz>

Old behavior:
# Insert compressed none in the file
$ btrfs property set file compression none
$ btrfs property gets file
# no output, (none value converted to empty string)

New behavior:
# Insert compressed none in the file
$ btrfs property set file compression none
$ btrfs property gets file
compression=none
(with compression=none inserted in the file's xattr)


Convert the attribute compression=none to an empty string "", which was
introduced in commit df11e2787b5b57ecdb313f2725dc5c9a5e549576(btrfs-progs),
according to the comments, in the past it seemed that the empty string
"" represented
no compression, but after commit 5548c8c6f55b(btrfs-devel), the
character The string
"none" means no compression. so the command
"btrfs property set <file> compression none" is not working.

David Sterba <dsterba@suse.cz> 于2022年1月17日周一 21:45写道:
>
> On Sun, Jan 16, 2022 at 04:52:43PM +0800, Li Zhang wrote:
> > 1. If the user adds the property "compression=none" to the file,
> > remove the code that converts the None string to an empty string.
>
> This is related to 5548c8c6f55b ("btrfs: props: change how empty value
> is interpreted") and needs some explanation that what it does on old and
> new kernel. Maybe some backward compatibility code in progs is needed to
> take the version into account.
>
> >
> > Signed-off-by: Li Zhang <zhanglikernel@gmail.com>
> > ---
> >  cmds/property.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/cmds/property.c b/cmds/property.c
> > index b3ccc0f..ec1b408 100644
> > --- a/cmds/property.c
> > +++ b/cmds/property.c
> > @@ -190,8 +190,6 @@ static int prop_compression(enum prop_object_type type,
> >       xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0';
> >
> >       if (value) {
> > -             if (strcmp(value, "no") == 0 || strcmp(value, "none") == 0)
> > -                     value = "";
> >               sret = fsetxattr(fd, xattr_name, value, strlen(value), 0);
> >       } else {
> >               sret = fgetxattr(fd, xattr_name, NULL, 0);
> > --
> > 1.8.3.1

  reply	other threads:[~2022-01-19 10:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16  8:52 [PATCH] btrfs-progs: allow user to insert property compression=none to file Li Zhang
2022-01-17 13:44 ` David Sterba
2022-01-19 10:49   ` li zhang [this message]
2022-02-16 10:44     ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAa-AGm4VUDFNZwe_rY4cJ0XZfXGdGRh0tPhSq-WOZYLVcPgDg@mail.gmail.com \
    --to=zhanglikernel@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).