From patchwork Wed Aug 19 14:16:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 11724273 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 353F4618 for ; Wed, 19 Aug 2020 14:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DE1820639 for ; Wed, 19 Aug 2020 14:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846627; bh=vTJUHVdF35cnboLxY4OxDfXFZrXo8IGxmY/aGjhnyJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tybnhSvlIL8ZdJBEzrOJaVj5gD7zhMIEchAbGlpGou8khK3ihi8Y+Ph0u2+lVbFRi 3BmNYNZK9ru0KdRvY2hl4HzB98IzrkF7vxwC/Stxy7shFfm/lReXYpNHZxZJptweu3 pUAZibIdqMTTn7IQ58lxCwUn6yyOmBiE+rgbDigI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbgHSOQq (ORCPT ); Wed, 19 Aug 2020 10:16:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:36616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgHSOQj (ORCPT ); Wed, 19 Aug 2020 10:16:39 -0400 Received: from localhost (unknown [213.57.247.131]) (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 AB0E82076E; Wed, 19 Aug 2020 14:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846599; bh=vTJUHVdF35cnboLxY4OxDfXFZrXo8IGxmY/aGjhnyJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XKi/GbBN5RqAlPUl9kLaBnPLwd6i67sIOjkR/rjij9RIXaYtwmzGzdtYUspZOgk6f UgzyYXdRJly1tMaVpE5bq+VQyhEXTf4pdCYSEwRfqjWH9FoBSAHAnbmKXBlQjGbhKP cX/JGDjq8TnBD3spLj5MFlebOrlrW4N87sL3hbfs= From: Leon Romanovsky To: Chris Mason , David Sterba , Josef Bacik Cc: Leon Romanovsky , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings Date: Wed, 19 Aug 2020 17:16:28 +0300 Message-Id: <20200819141630.1338693-2-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200819141630.1338693-1-leon@kernel.org> References: <20200819141630.1338693-1-leon@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Leon Romanovsky The compilation with W=1 generates the following warnings: fs/btrfs/sysfs.c:1630:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 1630 | int ret; | ^~~ fs/btrfs/sysfs.c:1629:6: warning: variable 'features' set but not used [-Wunused-but-set-variable] 1629 | u64 features; | ^~~~~~~~ Signed-off-by: Leon Romanovsky --- fs/btrfs/sysfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.26.2 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index c8df2edafd85..d3652bcc2a86 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1626,13 +1626,12 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, { struct btrfs_fs_devices *fs_devs; struct kobject *fsid_kobj; - u64 features; - int ret; + int __maybe_unused ret; if (!fs_info) return; - features = get_features(fs_info, set); + get_features(fs_info, set); ASSERT(bit & supported_feature_masks[set]); fs_devs = fs_info->fs_devices; From patchwork Wed Aug 19 14:16:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 11724271 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EE19618 for ; Wed, 19 Aug 2020 14:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6730F20B1F for ; Wed, 19 Aug 2020 14:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846614; bh=8DPsRnor12v9Pb8VDrFGF+YIO51Lu+LBxl/J6UN3O4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ncq73qSh7xPPHW+68rLAsnX1fPvO7mpme9BY41DIBqwrH/YKA1CwHsoitJTllTAuo +X2iuh5t3Qtr4Fwl3pFokePtlJA3IAiA6FE3pOKhZHOJCLNj8f/ZSFA01fgR0DOVGX AZPLsmp0wZ2k02pArzxvSOtgN2sbHRcKrFRS6bdc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728499AbgHSOQv (ORCPT ); Wed, 19 Aug 2020 10:16:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:36754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgHSOQs (ORCPT ); Wed, 19 Aug 2020 10:16:48 -0400 Received: from localhost (unknown [213.57.247.131]) (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 760CC2076E; Wed, 19 Aug 2020 14:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846607; bh=8DPsRnor12v9Pb8VDrFGF+YIO51Lu+LBxl/J6UN3O4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LK1hSdAZVL/0Fd4AtD1pI03/B05OF5KwmVX3n3qHNLzWJZNg8PfXbq3mxZkh5pSk3 uYxq2MtVx1Pvkhm7ZvhJkjkXBAGCMxVQCqA3jS/pRjhwbX074PffRSEnhw4k9h+HKW qAOwuCNbAeQQoqi02Viv8jvVUfxPpirf8664fxp4= From: Leon Romanovsky To: Chris Mason , David Sterba , Josef Bacik Cc: Leon Romanovsky , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] fs/btrfs: Fix -Wignored-qualifiers warnings Date: Wed, 19 Aug 2020 17:16:29 +0300 Message-Id: <20200819141630.1338693-3-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200819141630.1338693-1-leon@kernel.org> References: <20200819141630.1338693-1-leon@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Leon Romanovsky Change function declarations to avoid the following GCC warnings while compiling with W=1 level. In file included from fs/btrfs/volumes.c:28: fs/btrfs/sysfs.h:16:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 16 | const char * const btrfs_feature_set_name(enum btrfs_feature_set set); | ^~~~~ In file included from fs/btrfs/ioctl.c:29: fs/btrfs/ctree.h:2265:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2265 | size_t __const btrfs_get_num_csums(void); | ^~~~~~~ Fixes: f7cea56c0fff ("btrfs: sysfs: export supported checksums") Signed-off-by: Leon Romanovsky --- fs/btrfs/ctree.c | 2 +- fs/btrfs/ctree.h | 2 +- fs/btrfs/sysfs.c | 2 +- fs/btrfs/sysfs.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 70e49d8d4f6c..9d71d44137a5 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -68,7 +68,7 @@ const char *btrfs_super_csum_driver(u16 csum_type) btrfs_csums[csum_type].name; } -size_t __const btrfs_get_num_csums(void) +__attribute_const__ size_t btrfs_get_num_csums(void) { return ARRAY_SIZE(btrfs_csums); } diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9c7e466f27a9..e4fd6ad48799 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2262,7 +2262,7 @@ BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block, int btrfs_super_csum_size(const struct btrfs_super_block *s); const char *btrfs_super_csum_name(u16 csum_type); const char *btrfs_super_csum_driver(u16 csum_type); -size_t __const btrfs_get_num_csums(void); +__attribute_const__ size_t btrfs_get_num_csums(void); /* diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index d3652bcc2a86..c22b7f47f6f8 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -973,7 +973,7 @@ static const char * const btrfs_feature_set_names[FEAT_MAX] = { [FEAT_INCOMPAT] = "incompat", }; -const char * const btrfs_feature_set_name(enum btrfs_feature_set set) +const char *btrfs_feature_set_name(enum btrfs_feature_set set) { return btrfs_feature_set_names[set]; } diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index cf839c46a131..e6eac2811f92 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h @@ -13,7 +13,7 @@ enum btrfs_feature_set { }; char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); -const char * const btrfs_feature_set_name(enum btrfs_feature_set set); +const char *btrfs_feature_set_name(enum btrfs_feature_set set); int btrfs_sysfs_add_devices_dir(struct btrfs_fs_devices *fs_devices, struct btrfs_device *one_device); int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices, From patchwork Wed Aug 19 14:16:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 11724269 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0480739 for ; Wed, 19 Aug 2020 14:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C583C2078D for ; Wed, 19 Aug 2020 14:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846609; bh=0CwqqpI/doCNdLbaPsaZaTuQDib4tuZ/A83w7/3MMDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LDC3xwZ8v/olbmj3IebmDct9t6TkF3z2YN4s9bWbA3l3GiPlu/YMLGTkR/unrde3g Zenad242pfB2ZYUw08PIW8IgFH0TSgT5B53hOdmzKcKmhna7XFC/bMglA8ZeOj4Zen bNJ3wPeWejf3Pq3TP3byAOMwkTPxs/w6jn2vs9fc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbgHSOQr (ORCPT ); Wed, 19 Aug 2020 10:16:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:36712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbgHSOQo (ORCPT ); Wed, 19 Aug 2020 10:16:44 -0400 Received: from localhost (unknown [213.57.247.131]) (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 A24EE2078D; Wed, 19 Aug 2020 14:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597846603; bh=0CwqqpI/doCNdLbaPsaZaTuQDib4tuZ/A83w7/3MMDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2eskXGibcBkg54wYhLtn6iK6N3yjHMgqcWmYdY5HTeTZWOy/hQpA0iA99BGxN7E1 aF0gsXiyBaPO9Svm8/EwjWV0hOwO0BxH05pJQBpcLZb6mxlKeUCJIYC2cTOimkRENn oPMo0JD2UtQn6i9nPrgqRAVh2rkzGVec1Qa6eejM= From: Leon Romanovsky To: Chris Mason , David Sterba , Josef Bacik Cc: Leon Romanovsky , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] fs/btrfs: Fix -Wmissing-prototypes warnings Date: Wed, 19 Aug 2020 17:16:30 +0300 Message-Id: <20200819141630.1338693-4-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200819141630.1338693-1-leon@kernel.org> References: <20200819141630.1338693-1-leon@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Leon Romanovsky Move function declaration to shared header file to fix multiple -Wmissing-prototypes warnings like below: fs/btrfs/zstd.c:369:5: warning: no previous prototype for ‘zstd_compress_pages’ [-Wmissing-prototypes] 369 | int zstd_compress_pages(struct list_head *ws, struct address_space *mapping, | ^~~~~~~~~~~~~~~~~~~ Signed-off-by: Leon Romanovsky --- fs/btrfs/compression.c | 35 ----------------------------------- fs/btrfs/compression.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) -- 2.26.2 diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 1ab56a734e70..eeface30facd 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -29,41 +29,6 @@ #include "extent_io.h" #include "extent_map.h" -int zlib_compress_pages(struct list_head *ws, struct address_space *mapping, - u64 start, struct page **pages, unsigned long *out_pages, - unsigned long *total_in, unsigned long *total_out); -int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb); -int zlib_decompress(struct list_head *ws, unsigned char *data_in, - struct page *dest_page, unsigned long start_byte, size_t srclen, - size_t destlen); -struct list_head *zlib_alloc_workspace(unsigned int level); -void zlib_free_workspace(struct list_head *ws); -struct list_head *zlib_get_workspace(unsigned int level); - -int lzo_compress_pages(struct list_head *ws, struct address_space *mapping, - u64 start, struct page **pages, unsigned long *out_pages, - unsigned long *total_in, unsigned long *total_out); -int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb); -int lzo_decompress(struct list_head *ws, unsigned char *data_in, - struct page *dest_page, unsigned long start_byte, size_t srclen, - size_t destlen); -struct list_head *lzo_alloc_workspace(unsigned int level); -void lzo_free_workspace(struct list_head *ws); - -int zstd_compress_pages(struct list_head *ws, struct address_space *mapping, - u64 start, struct page **pages, unsigned long *out_pages, - unsigned long *total_in, unsigned long *total_out); -int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb); -int zstd_decompress(struct list_head *ws, unsigned char *data_in, - struct page *dest_page, unsigned long start_byte, size_t srclen, - size_t destlen); -void zstd_init_workspace_manager(void); -void zstd_cleanup_workspace_manager(void); -struct list_head *zstd_alloc_workspace(unsigned int level); -void zstd_free_workspace(struct list_head *ws); -struct list_head *zstd_get_workspace(unsigned int level); -void zstd_put_workspace(struct list_head *ws); - static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" }; const char* btrfs_compress_type2str(enum btrfs_compression_type type) diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 9f3dbe372631..8001b700ea3a 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -144,4 +144,39 @@ bool btrfs_compress_is_valid_type(const char *str, size_t len); int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end); +int zlib_compress_pages(struct list_head *ws, struct address_space *mapping, + u64 start, struct page **pages, unsigned long *out_pages, + unsigned long *total_in, unsigned long *total_out); +int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb); +int zlib_decompress(struct list_head *ws, unsigned char *data_in, + struct page *dest_page, unsigned long start_byte, size_t srclen, + size_t destlen); +struct list_head *zlib_alloc_workspace(unsigned int level); +void zlib_free_workspace(struct list_head *ws); +struct list_head *zlib_get_workspace(unsigned int level); + +int lzo_compress_pages(struct list_head *ws, struct address_space *mapping, + u64 start, struct page **pages, unsigned long *out_pages, + unsigned long *total_in, unsigned long *total_out); +int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb); +int lzo_decompress(struct list_head *ws, unsigned char *data_in, + struct page *dest_page, unsigned long start_byte, size_t srclen, + size_t destlen); +struct list_head *lzo_alloc_workspace(unsigned int level); +void lzo_free_workspace(struct list_head *ws); + +int zstd_compress_pages(struct list_head *ws, struct address_space *mapping, + u64 start, struct page **pages, unsigned long *out_pages, + unsigned long *total_in, unsigned long *total_out); +int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb); +int zstd_decompress(struct list_head *ws, unsigned char *data_in, + struct page *dest_page, unsigned long start_byte, size_t srclen, + size_t destlen); +void zstd_init_workspace_manager(void); +void zstd_cleanup_workspace_manager(void); +struct list_head *zstd_alloc_workspace(unsigned int level); +void zstd_free_workspace(struct list_head *ws); +struct list_head *zstd_get_workspace(unsigned int level); +void zstd_put_workspace(struct list_head *ws); + #endif