From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,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 ADCDAC31E40 for ; Fri, 9 Aug 2019 14:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83F942085B for ; Fri, 9 Aug 2019 14:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfHIOyd (ORCPT ); Fri, 9 Aug 2019 10:54:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:39736 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726140AbfHIOyd (ORCPT ); Fri, 9 Aug 2019 10:54:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 426BAACBA for ; Fri, 9 Aug 2019 14:54:32 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 3B2ACDA7C5; Fri, 9 Aug 2019 16:55:03 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 1/2] btrfs: define compression levels statically Date: Fri, 9 Aug 2019 16:55:03 +0200 Message-Id: <78207f6784c457dad6583f7bc7eecc495c7d5d54.1565362438.git.dsterba@suse.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The maximum and default levels do not change and can be defined directly. The set_level callback was a temporary solution and will be removed. Signed-off-by: David Sterba --- fs/btrfs/compression.h | 4 ++++ fs/btrfs/lzo.c | 2 ++ fs/btrfs/zlib.c | 2 ++ fs/btrfs/zstd.c | 2 ++ 4 files changed, 10 insertions(+) diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 2035b8eb1290..07b2009dc63f 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -162,6 +162,10 @@ struct btrfs_compress_op { * if the level is out of bounds or the default if 0 is passed in. */ unsigned int (*set_level)(unsigned int level); + + /* Maximum level supported by the compression algorithm */ + int max_level; + int default_level; }; /* The heuristic workspaces are managed via the 0th workspace manager */ diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 579d53ae256f..adac6cb30d65 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c @@ -523,4 +523,6 @@ const struct btrfs_compress_op btrfs_lzo_compress = { .decompress_bio = lzo_decompress_bio, .decompress = lzo_decompress, .set_level = lzo_set_level, + .max_level = 1, + .default_level = 1, }; diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index b86b7ad6b900..03d6c3683bd9 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c @@ -437,4 +437,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = { .decompress_bio = zlib_decompress_bio, .decompress = zlib_decompress, .set_level = zlib_set_level, + .max_level = 9, + .default_level = BTRFS_ZLIB_DEFAULT_LEVEL, }; diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c index 3837ca180d52..b2b23a6a497d 100644 --- a/fs/btrfs/zstd.c +++ b/fs/btrfs/zstd.c @@ -729,4 +729,6 @@ const struct btrfs_compress_op btrfs_zstd_compress = { .decompress_bio = zstd_decompress_bio, .decompress = zstd_decompress, .set_level = zstd_set_level, + .max_level = ZSTD_BTRFS_MAX_LEVEL, + .default_level = ZSTD_BTRFS_DEFAULT_LEVEL, }; -- 2.22.0