Skip to contentSkip to conversation

btrfs-progs: allow "no" to disable compression for convenience

PATCH RESEND Applied Satoru Takeuchi 3 participants 5 messages Oct 14, 2017 – Oct 17, 2017

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 btrfs-progs: allow "no" to disable compression for convenience

It's messy to use "" to disable compression. Introduce the new value "no" which can also be used for this purpose.

---
 Documentation/btrfs-property.asciidoc | 2 +-
 props.c                               | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
Documentation/btrfs-property.asciidoc +1 -1
index 7ed6a7d..97b90d6 100644
@@ -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.
props.c +4 -2
index a7e3e96..a2df868 100644
@@ -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;
Signature · 1 line
2.7.4
#1 lore raw

Op 14-10-17 om 14:54 schreef Satoru Takeuchi:

Quoted 2 lines

It's messy to use "" to disable compression. Introduce the new value "no" which can also be used for this purpose.

Wouldn't 'none' be a better fit?

regards,

Koen

#2 lore raw

At Sat, 14 Oct 2017 18:19:14 +0200,

Quoted 6 lines · Koen Kooi

Op 14-10-17 om 14:54 schreef Satoru Takeuchi:

Quoted 2 lines

It's messy to use "" to disable compression. Introduce the new value "no" which can also be used for this purpose.

Wouldn't 'none' be a better fit?

I consider "no" is better because we use nocompress or compress=no mount option to disable compression. I want to unify the expression.

Thanks,
Satoru

Quoted 9 lines

regards,

Koen

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Koen Kooi
Quoted 5 lines · Koen Kooi

Op 14-10-17 om 14:54 schreef Satoru Takeuchi:

Quoted 2 lines

It's messy to use "" to disable compression. Introduce the new value "no" which can also be used for this purpose.

Wouldn't 'none' be a better fit?

'none' will be also accepted