* [PATCH] btrfs-progs: allow "no" to disable compression for convenience
@ 2017-09-17 0:36 Satoru Takeuchi
2017-09-17 13:08 ` Mike Fleetwood
0 siblings, 1 reply; 6+ messages in thread
From: Satoru Takeuchi @ 2017-09-17 0:36 UTC (permalink / raw)
To: linux-btrfs
It's messy to use "" to disable compression. Introduce the new value "no"
which can also be used for this purpose.
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
---
Documentation/btrfs-property.asciidoc | 2 +-
props.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/btrfs-property.asciidoc b/Documentation/btrfs-property.asciidoc
index 7ed6a7d..97b90d6 100644
--- a/Documentation/btrfs-property.asciidoc
+++ b/Documentation/btrfs-property.asciidoc
@@ -43,7 +43,7 @@ read-only flag of subvolume: true or false
label::::
label of device
compression::::
-compression setting for an inode: lzo, zlib, zstd, or "" (empty string)
+compression setting for an inode: lzo, zlib, zstd, no, or "" (empty string). Both no and "" are for disabling compression.
*list* [-t <type>] <object>::
Lists available properties with their descriptions for the given object.
diff --git a/props.c b/props.c
index a7e3e96..a2df868 100644
--- a/props.c
+++ b/props.c
@@ -142,9 +142,11 @@ static int prop_compression(enum prop_object_type type,
memcpy(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name));
xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0';
- if (value)
+ if (value) {
+ if (!strcmp(value, "no"))
+ value = "";
sret = fsetxattr(fd, xattr_name, value, strlen(value), 0);
- else
+ } else
sret = fgetxattr(fd, xattr_name, NULL, 0);
if (sret < 0) {
ret = -errno;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] btrfs-progs: allow "no" to disable compression for convenience
2017-09-17 0:36 [PATCH] btrfs-progs: allow "no" to disable compression for convenience Satoru Takeuchi
@ 2017-09-17 13:08 ` Mike Fleetwood
2017-09-18 0:41 ` [PATCH v2] btrfs-progs: allow "none" " Satoru Takeuchi
0 siblings, 1 reply; 6+ messages in thread
From: Mike Fleetwood @ 2017-09-17 13:08 UTC (permalink / raw)
To: Satoru Takeuchi; +Cc: linux-btrfs
On 17 September 2017 at 01:36, Satoru Takeuchi
<satoru.takeuchi@gmail.com> wrote:
> It's messy to use "" to disable compression. Introduce the new value "no"
> which can also be used for this purpose.
>From an English language point of view, "none" would be better. None
says the absence of, where as no is more general negative.
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] btrfs-progs: allow "none" to disable compression for convenience
2017-09-17 13:08 ` Mike Fleetwood
@ 2017-09-18 0:41 ` Satoru Takeuchi
2017-09-19 15:14 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Satoru Takeuchi @ 2017-09-18 0:41 UTC (permalink / raw)
To: Mike Fleetwood; +Cc: Satoru Takeuchi, linux-btrfs
At Sun, 17 Sep 2017 14:08:40 +0100,
Mike Fleetwood wrote:
>
> On 17 September 2017 at 01:36, Satoru Takeuchi
> <satoru.takeuchi@gmail.com> wrote:
> > It's messy to use "" to disable compression. Introduce the new value "no"
> > which can also be used for this purpose.
>
> From an English language point of view, "none" would be better. None
> says the absence of, where as no is more general negative.
Thank you for your comment. How about is it?
---
It's messy to use "" to disable compression. Introduce the new value "none"
which can also be used for this purpose.
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
---
Documentation/btrfs-property.asciidoc | 2 +-
props.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/btrfs-property.asciidoc b/Documentation/btrfs-property.asciidoc
index 7ed6a7d..786af9b 100644
--- a/Documentation/btrfs-property.asciidoc
+++ b/Documentation/btrfs-property.asciidoc
@@ -43,7 +43,7 @@ read-only flag of subvolume: true or false
label::::
label of device
compression::::
-compression setting for an inode: lzo, zlib, zstd, or "" (empty string)
+compression setting for an inode: lzo, zlib, zstd, none, or "" (empty string). Both none and "" are for disabling compression.
*list* [-t <type>] <object>::
Lists available properties with their descriptions for the given object.
diff --git a/props.c b/props.c
index a7e3e96..8d85181 100644
--- a/props.c
+++ b/props.c
@@ -142,9 +142,11 @@ static int prop_compression(enum prop_object_type type,
memcpy(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name));
xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0';
- if (value)
+ if (value) {
+ if (!strcmp(value, "none"))
+ value = "";
sret = fsetxattr(fd, xattr_name, value, strlen(value), 0);
- else
+ } else
sret = fgetxattr(fd, xattr_name, NULL, 0);
if (sret < 0) {
ret = -errno;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2] btrfs-progs: allow "none" to disable compression for convenience
2017-09-18 0:41 ` [PATCH v2] btrfs-progs: allow "none" " Satoru Takeuchi
@ 2017-09-19 15:14 ` David Sterba
2017-09-20 2:03 ` Satoru Takeuchi
2017-10-14 23:35 ` Satoru Takeuchi
0 siblings, 2 replies; 6+ messages in thread
From: David Sterba @ 2017-09-19 15:14 UTC (permalink / raw)
To: Satoru Takeuchi; +Cc: Mike Fleetwood, linux-btrfs
On Mon, Sep 18, 2017 at 09:41:17AM +0900, Satoru Takeuchi wrote:
> At Sun, 17 Sep 2017 14:08:40 +0100,
> Mike Fleetwood wrote:
> >
> > On 17 September 2017 at 01:36, Satoru Takeuchi
> > <satoru.takeuchi@gmail.com> wrote:
> > > It's messy to use "" to disable compression. Introduce the new value "no"
> > > which can also be used for this purpose.
> >
> > From an English language point of view, "none" would be better. None
> > says the absence of, where as no is more general negative.
>
> Thank you for your comment. How about is it?
>
> ---
> It's messy to use "" to disable compression. Introduce the new value "none"
> which can also be used for this purpose.
I'd allow both values, 'no' and 'none', similar to the mount options,
that also accept both (technically, the 'no' + anything is accepted for
disabling compression).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: allow "none" to disable compression for convenience
2017-09-19 15:14 ` David Sterba
@ 2017-09-20 2:03 ` Satoru Takeuchi
2017-10-14 23:35 ` Satoru Takeuchi
1 sibling, 0 replies; 6+ messages in thread
From: Satoru Takeuchi @ 2017-09-20 2:03 UTC (permalink / raw)
To: dsterba, Satoru Takeuchi, Mike Fleetwood, linux-btrfs
At Tue, 19 Sep 2017 17:14:27 +0200,
David Sterba wrote:
>
> On Mon, Sep 18, 2017 at 09:41:17AM +0900, Satoru Takeuchi wrote:
> > At Sun, 17 Sep 2017 14:08:40 +0100,
> > Mike Fleetwood wrote:
> > >
> > > On 17 September 2017 at 01:36, Satoru Takeuchi
> > > <satoru.takeuchi@gmail.com> wrote:
> > > > It's messy to use "" to disable compression. Introduce the new value "no"
> > > > which can also be used for this purpose.
> > >
> > > From an English language point of view, "none" would be better. None
> > > says the absence of, where as no is more general negative.
> >
> > Thank you for your comment. How about is it?
> >
> > ---
> > It's messy to use "" to disable compression. Introduce the new value "none"
> > which can also be used for this purpose.
>
> I'd allow both values, 'no' and 'none', similar to the mount options,
> that also accept both (technically, the 'no' + anything is accepted for
> disabling compression).
As a result of reading "man 5 btrfs", now I prefer "no". It's used
to mean disabling compression there. On the other hand, "none" is
not used at all.
>From man 5 btrfs:
===
...
FILE ATTRIBUTES
...
compress, compress=type, compress-force, compress-force=type
(default: off)
Control BTRFS file data compression. Type may be specified as zlib, lzo or no (for no compression, used for remounting). If no type is specified, zlib is used. If
compress-force is specified, all files will be compressed, whether or not they compress well.
...
X
no compression, permanently turn off compression on the given file, other compression mount options will not affect that
...
===
So David, please apply my v1 patcth if it looks good for you.
Thanks,
Satoru
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] btrfs-progs: allow "none" to disable compression for convenience
2017-09-19 15:14 ` David Sterba
2017-09-20 2:03 ` Satoru Takeuchi
@ 2017-10-14 23:35 ` Satoru Takeuchi
1 sibling, 0 replies; 6+ messages in thread
From: Satoru Takeuchi @ 2017-10-14 23:35 UTC (permalink / raw)
To: dsterba, Satoru Takeuchi, Mike Fleetwood, linux-btrfs
At Tue, 19 Sep 2017 17:14:27 +0200,
David Sterba wrote:
>
> On Mon, Sep 18, 2017 at 09:41:17AM +0900, Satoru Takeuchi wrote:
> > At Sun, 17 Sep 2017 14:08:40 +0100,
> > Mike Fleetwood wrote:
> > >
> > > On 17 September 2017 at 01:36, Satoru Takeuchi
> > > <satoru.takeuchi@gmail.com> wrote:
> > > > It's messy to use "" to disable compression. Introduce the new value "no"
> > > > which can also be used for this purpose.
> > >
> > > From an English language point of view, "none" would be better. None
> > > says the absence of, where as no is more general negative.
> >
> > Thank you for your comment. How about is it?
> >
> > ---
> > It's messy to use "" to disable compression. Introduce the new value "none"
> > which can also be used for this purpose.
>
> I'd allow both values, 'no' and 'none', similar to the mount options,
> that also accept both (technically, the 'no' + anything is accepted for
> disabling compression).
But only "no" is writtein in man 5 btrfs.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-14 23:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-17 0:36 [PATCH] btrfs-progs: allow "no" to disable compression for convenience Satoru Takeuchi
2017-09-17 13:08 ` Mike Fleetwood
2017-09-18 0:41 ` [PATCH v2] btrfs-progs: allow "none" " Satoru Takeuchi
2017-09-19 15:14 ` David Sterba
2017-09-20 2:03 ` Satoru Takeuchi
2017-10-14 23:35 ` Satoru Takeuchi
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).