From patchwork Mon Sep 18 00:41:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satoru Takeuchi X-Patchwork-Id: 9955321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CCB5760568 for ; Mon, 18 Sep 2017 00:41:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF27728AA2 for ; Mon, 18 Sep 2017 00:41:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B414728ACD; Mon, 18 Sep 2017 00:41:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC41528AD2 for ; Mon, 18 Sep 2017 00:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbdIRAlS (ORCPT ); Sun, 17 Sep 2017 20:41:18 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36877 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067AbdIRAlQ (ORCPT ); Sun, 17 Sep 2017 20:41:16 -0400 Received: by mail-pg0-f68.google.com with SMTP id v5so4400524pgn.4 for ; Sun, 17 Sep 2017 17:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:from:to:cc:subject:in-reply-to:references :user-agent:mime-version; bh=EGIzn7Q2bb5mU2LGQNPtg/FYK/6teRf34bYvIKMSN74=; b=dpdiqgWfJxgORx9/1fDZCfnUE6zpR6lWp/yUb//b2clmRJ4QM3aiZogfIevShWH+xT jY8M8HIWCHVq5i1M1b9eXStBbY/E9SY+tRZnfA0b/z2/0yOHx4UIc08nCsFL7SK6S5q8 umTt3qCvSNiySvPyGYxtZIuyFoCRGDSQf7EzLP0b1HTvCrnijYvnvcaJgkiUqdu2VWSJ Z+uNHJfcPKA3X/MBpb0wPSbcyzO09mxA9QoiLA282HzEq+1W4sYGAaxQS97lXf5d+oKn pQL/3zx5ts7otWWfpbW7tjT6eu4MpeJpCSefzVgrEl0cQmH4qtUn0z6e/Q88jH4I/Dxd GV4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:from:to:cc:subject:in-reply-to :references:user-agent:mime-version; bh=EGIzn7Q2bb5mU2LGQNPtg/FYK/6teRf34bYvIKMSN74=; b=uStZUy/C0R4AWfXDkbdD09N+Mz6TuB69e3uviFaKKM504LJb/HWl5vLlEtkXelsPgC HEMYuTM5nX+Jw8v5+awJJkFlUqZ24LOnQUoYlGLOxRAGP6lPTsgoUXIxaN9ZZE6sgZlN B+RJb/em5WVTjnpiO2pDH/yQEtzq9yW0ZxG8cCCB/HScCIHwQavAu63QAdqYPdv5spPt KY8+P6gyewEYQY5n3E4l4UsUMwGo5ICkSl3lFtagTfSr9uoPHgfBJ2YSybyntTUegjY7 1brUpcn3LVX4VaXds1DCPQA/L4aTn3FCnpZCxrZO/3lVHZEYbKVQeY0jtL0kVtSaT4Xw c9eQ== X-Gm-Message-State: AHPjjUjgi7QfgkbScd1YH90ijBaf6q99a0Zz5dz/ULrAgJX5iE8K/z1G Rv0YB63LKOCxhQ== X-Google-Smtp-Source: ADKCNb4W4DG7LwaIL0unXhJdGxRl8iDZv8M29kO5D+SDIUPY9fG906yZl8fJNpuG1HbSE5Lqo+s9nA== X-Received: by 10.101.90.207 with SMTP id d15mr30298918pgt.423.1505695275528; Sun, 17 Sep 2017 17:41:15 -0700 (PDT) Received: from gopher.gmail.com (58-189-215-38f1.hyg2.eonet.ne.jp. [58.189.215.38]) by smtp.gmail.com with ESMTPSA id j1sm11552090pfc.169.2017.09.17.17.41.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Sep 2017 17:41:14 -0700 (PDT) Date: Mon, 18 Sep 2017 09:41:17 +0900 Message-ID: <8760cgalea.wl-satoru.takeuchi@gmail.com> From: Satoru Takeuchi To: Mike Fleetwood Cc: Satoru Takeuchi , linux-btrfs Subject: [PATCH v2] btrfs-progs: allow "none" to disable compression for convenience In-Reply-To: References: <87poaqyxdi.wl-satoru.takeuchi@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/24.5 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP At Sun, 17 Sep 2017 14:08:40 +0100, Mike Fleetwood wrote: > > On 17 September 2017 at 01:36, Satoru Takeuchi > 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 --- 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 ] :: 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;