Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1261993pxa; Thu, 20 Aug 2020 07:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3iN3H43zw6Carx/luCyG00wwcQnoHGXu3F60+t3VFMPkJgy5sBXyuYKfKuGHkBmjGGaHT X-Received: by 2002:a50:9358:: with SMTP id n24mr1570752eda.7.1597932173434; Thu, 20 Aug 2020 07:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597932173; cv=none; d=google.com; s=arc-20160816; b=ejvy+Q2GFRdK2H7WTCY797jkP180twlALuowZeZGxIXc1N8F3wELRcyRrkacyudk8r zXaRRpW1gX20jhBrzTRfG3U4IrL9X+V8VORA0AIwFhnaFaBe1T8O2Yuw6D8woVa/QHai 03JRO3q8XUB2QZoGndZWUWvM3jFSzCXVWuEhVnf7e4Cmtu9beURrMv7EzIJrnrXnR0o+ lQfbTPg86R4qMPpHYlUzSVj7OpZC3HnlKz6Qe0IlioXK9MWpsAHA2EZOJ2x+PirffMyR 9pN58BCBHfMtLKbVQL+uQHLahstM4r9miF8Y0iEOCEdU3EPtZrlECfX+O2hnBkiGOPGC ItrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZwbEtq6Kt0FMzxjt3fV0oDoGSQLPVeP67sJ3pzt2qcw=; b=kRbYFObMUKQlN48SLKW7WsF2eBr+Ff2QBE2Nx+PqYwoYATssaXUeGD5t1VAhETak9Y TYSIF0Q5IrcXQDrnV7AD1q0en4Wuv5rcBcl8tCJn9BqYFcaZNhifny5jHZpSo0AQWZ9+ eGWdGHVPWnndw3WxJcKj8R4r5IqdSR6PqukB7Wu+qLbe4sA9bkY3DOFVxLwDQkKgSBg2 g6a8N/dlFMVwh+nJELN6WFrHvKpSfQ+B5Gj84RAcHVj6+oG3/qgUr3Fj+Q5xxx2Hk2+q YcZja5+suhhKb8/Hv/QCWtZjYrwYg8yH9cUmK+tClzbIkhowgt+997nBV/7KEHj5bwLZ ai3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eMaVGDUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si1262288ejj.386.2020.08.20.07.02.28; Thu, 20 Aug 2020 07:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eMaVGDUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727911AbgHTOAM (ORCPT + 99 others); Thu, 20 Aug 2020 10:00:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:33352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727875AbgHTJ0V (ORCPT ); Thu, 20 Aug 2020 05:26:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 310962173E; Thu, 20 Aug 2020 09:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915581; bh=3MdOltG8YQMna49ftWkPa7aprubDtN2/vcl8KDI5weg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eMaVGDUf7arVHt/cQ5aQHelyz9vrEfUXc6HRhbipZ8AMRslJQmsfEdOhNGJ8GUWbm T+CCEv+op9NjiX49eCjcD2+mGjtB/+t5PDHtJHOW1CdZcaNHwSNZFC6InQo2wme7PN 4uqF+KRnvh+K9SXtHFHYeYy+ibiRlvnhT5EPDogo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Sterba Subject: [PATCH 5.8 034/232] btrfs: fix messages after changing compression level by remount Date: Thu, 20 Aug 2020 11:18:05 +0200 Message-Id: <20200820091614.418036047@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Sterba commit 27942c9971cc405c60432eca9395e514a2ae9f5e upstream. Reported by Forza on IRC that remounting with compression options does not reflect the change in level, or at least it does not appear to do so according to the messages: mount -o compress=zstd:1 /dev/sda /mnt mount -o remount,compress=zstd:15 /mnt does not print the change to the level to syslog: [ 41.366060] BTRFS info (device vda): use zstd compression, level 1 [ 41.368254] BTRFS info (device vda): disk space caching is enabled [ 41.390429] BTRFS info (device vda): disk space caching is enabled What really happens is that the message is lost but the level is actualy changed. There's another weird output, if compression is reset to 'no': [ 45.413776] BTRFS info (device vda): use no compression, level 4 To fix that, save the previous compression level and print the message in that case too and use separate message for 'no' compression. CC: stable@vger.kernel.org # 4.19+ Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/super.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -449,6 +449,7 @@ int btrfs_parse_options(struct btrfs_fs_ char *compress_type; bool compress_force = false; enum btrfs_compression_type saved_compress_type; + int saved_compress_level; bool saved_compress_force; int no_compress = 0; @@ -531,6 +532,7 @@ int btrfs_parse_options(struct btrfs_fs_ info->compress_type : BTRFS_COMPRESS_NONE; saved_compress_force = btrfs_test_opt(info, FORCE_COMPRESS); + saved_compress_level = info->compress_level; if (token == Opt_compress || token == Opt_compress_force || strncmp(args[0].from, "zlib", 4) == 0) { @@ -575,6 +577,8 @@ int btrfs_parse_options(struct btrfs_fs_ no_compress = 0; } else if (strncmp(args[0].from, "no", 2) == 0) { compress_type = "no"; + info->compress_level = 0; + info->compress_type = 0; btrfs_clear_opt(info->mount_opt, COMPRESS); btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); compress_force = false; @@ -595,11 +599,11 @@ int btrfs_parse_options(struct btrfs_fs_ */ btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); } - if ((btrfs_test_opt(info, COMPRESS) && - (info->compress_type != saved_compress_type || - compress_force != saved_compress_force)) || - (!btrfs_test_opt(info, COMPRESS) && - no_compress == 1)) { + if (no_compress == 1) { + btrfs_info(info, "use no compression"); + } else if ((info->compress_type != saved_compress_type) || + (compress_force != saved_compress_force) || + (info->compress_level != saved_compress_level)) { btrfs_info(info, "%s %s compression, level %d", (compress_force) ? "force" : "use", compress_type, info->compress_level);