From patchwork Tue Sep 1 15:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 333D2C433E2 for ; Tue, 1 Sep 2020 16:54:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00BCE20767 for ; Tue, 1 Sep 2020 16:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598979264; bh=+W9iQQDIkEYtWUq1ITmOocl10kxxbkvUppl0NQHHlos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Uu3sgUnTGfSEX0lFdxiWzQXXZeREc+K/jVA2pzt6Y3rFEY8amcdIn/f5Wuk/XZFtb DaNakxxEWdQcAN3/0YAg+txo2rpcJhvBlrpkFGHuJ+BKOHjCH/KPCa+oqB5BlAbQck x0tSCP3Lb4BkWc+PQ7+oRo+EYMdO2l0zzkhye1pE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728894AbgIAQyX (ORCPT ); Tue, 1 Sep 2020 12:54:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:48546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729259AbgIAPYj (ORCPT ); Tue, 1 Sep 2020 11:24:39 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A911120BED; Tue, 1 Sep 2020 15:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973879; bh=+W9iQQDIkEYtWUq1ITmOocl10kxxbkvUppl0NQHHlos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3gRMKjqRnAl89GYo3ZZIxwTC0Ejf5ncBrWXXkXoIMea5HKTIe8lkcGv4GY+1ruk4 zNUU9CpkXwRbZIPeKJILzpON7Bcx+pKUXaO3NSX/cpYmdPxrQS6QDm7/lie/QLvzZE p+mf++SRh4tNa5WDDmH2HOJNwh6wvVeB0H1FfRq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcos Paulo de Souza , David Sterba Subject: [PATCH 4.19 083/125] btrfs: reset compression level for lzo on remount Date: Tue, 1 Sep 2020 17:10:38 +0200 Message-Id: <20200901150938.639962714@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150934.576210879@linuxfoundation.org> References: <20200901150934.576210879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marcos Paulo de Souza commit 282dd7d7718444679b046b769d872b188818ca35 upstream. Currently a user can set mount "-o compress" which will set the compression algorithm to zlib, and use the default compress level for zlib (3): relatime,compress=zlib:3,space_cache If the user remounts the fs using "-o compress=lzo", then the old compress_level is used: relatime,compress=lzo:3,space_cache But lzo does not expose any tunable compression level. The same happens if we set any compress argument with different level, also with zstd. Fix this by resetting the compress_level when compress=lzo is specified. With the fix applied, lzo is shown without compress level: relatime,compress=lzo,space_cache CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Marcos Paulo de Souza Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -539,6 +539,7 @@ int btrfs_parse_options(struct btrfs_fs_ } else if (strncmp(args[0].from, "lzo", 3) == 0) { compress_type = "lzo"; info->compress_type = BTRFS_COMPRESS_LZO; + info->compress_level = 0; btrfs_set_opt(info->mount_opt, COMPRESS); btrfs_clear_opt(info->mount_opt, NODATACOW); btrfs_clear_opt(info->mount_opt, NODATASUM);