All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level
@ 2020-08-19 14:16 Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings Leon Romanovsky
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-19 14:16 UTC (permalink / raw)
  To: Chris Mason, David Sterba, Josef Bacik
  Cc: Leon Romanovsky, linux-btrfs, linux-kernel

From: Leon Romanovsky <leonro@nvidia.com>

Hi,

The series of trivial fixes for GCC warnings seen while compiling with W=1.

Thanks

Leon Romanovsky (3):
  fs/btfrs: Fix -Wunused-but-set-variable warnings
  fs/btrfs: Fix -Wignored-qualifiers warnings
  fs/btrfs: Fix -Wmissing-prototypes warnings

 fs/btrfs/compression.c | 35 -----------------------------------
 fs/btrfs/compression.h | 35 +++++++++++++++++++++++++++++++++++
 fs/btrfs/ctree.c       |  2 +-
 fs/btrfs/ctree.h       |  2 +-
 fs/btrfs/sysfs.c       |  7 +++----
 fs/btrfs/sysfs.h       |  2 +-
 6 files changed, 41 insertions(+), 42 deletions(-)

--
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings
  2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
@ 2020-08-19 14:16 ` Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 2/3] fs/btrfs: Fix -Wignored-qualifiers warnings Leon Romanovsky
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-19 14:16 UTC (permalink / raw)
  To: Chris Mason, David Sterba, Josef Bacik
  Cc: Leon Romanovsky, linux-btrfs, linux-kernel

From: Leon Romanovsky <leonro@nvidia.com>

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 <leonro@nvidia.com>
---
 fs/btrfs/sysfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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;
--
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] fs/btrfs: Fix -Wignored-qualifiers warnings
  2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings Leon Romanovsky
@ 2020-08-19 14:16 ` Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 3/3] fs/btrfs: Fix -Wmissing-prototypes warnings Leon Romanovsky
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-19 14:16 UTC (permalink / raw)
  To: Chris Mason, David Sterba, Josef Bacik
  Cc: Leon Romanovsky, linux-btrfs, linux-kernel

From: Leon Romanovsky <leonro@nvidia.com>

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 <leonro@nvidia.com>
---
 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(-)

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,
--
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] fs/btrfs: Fix -Wmissing-prototypes warnings
  2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings Leon Romanovsky
  2020-08-19 14:16 ` [PATCH 2/3] fs/btrfs: Fix -Wignored-qualifiers warnings Leon Romanovsky
@ 2020-08-19 14:16 ` Leon Romanovsky
  2020-08-19 14:21 ` [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
  2020-08-19 15:39 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-19 14:16 UTC (permalink / raw)
  To: Chris Mason, David Sterba, Josef Bacik
  Cc: Leon Romanovsky, linux-btrfs, linux-kernel

From: Leon Romanovsky <leonro@nvidia.com>

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 <leonro@nvidia.com>
---
 fs/btrfs/compression.c | 35 -----------------------------------
 fs/btrfs/compression.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 35 deletions(-)

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
--
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level
  2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
                   ` (2 preceding siblings ...)
  2020-08-19 14:16 ` [PATCH 3/3] fs/btrfs: Fix -Wmissing-prototypes warnings Leon Romanovsky
@ 2020-08-19 14:21 ` Leon Romanovsky
  2020-08-19 15:39 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-19 14:21 UTC (permalink / raw)
  To: Chris Mason, David Sterba, Josef Bacik; +Cc: linux-btrfs, linux-kernel

On Wed, Aug 19, 2020 at 05:16:27PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> Hi,
>
> The series of trivial fixes for GCC warnings seen while compiling with W=1.
>
> Thanks
>
> Leon Romanovsky (3):
>   fs/btfrs: Fix -Wunused-but-set-variable warnings
      ^^^ this is typo - btrfs

>   fs/btrfs: Fix -Wignored-qualifiers warnings
>   fs/btrfs: Fix -Wmissing-prototypes warnings
>
>  fs/btrfs/compression.c | 35 -----------------------------------
>  fs/btrfs/compression.h | 35 +++++++++++++++++++++++++++++++++++
>  fs/btrfs/ctree.c       |  2 +-
>  fs/btrfs/ctree.h       |  2 +-
>  fs/btrfs/sysfs.c       |  7 +++----
>  fs/btrfs/sysfs.h       |  2 +-
>  6 files changed, 41 insertions(+), 42 deletions(-)
>
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level
  2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
                   ` (3 preceding siblings ...)
  2020-08-19 14:21 ` [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
@ 2020-08-19 15:39 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2020-08-19 15:39 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Chris Mason, David Sterba, Josef Bacik, Leon Romanovsky,
	linux-btrfs, linux-kernel

On Wed, Aug 19, 2020 at 05:16:27PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> The series of trivial fixes for GCC warnings seen while compiling with W=1.
> 
> Leon Romanovsky (3):
>   fs/btfrs: Fix -Wunused-but-set-variable warnings
>   fs/btrfs: Fix -Wignored-qualifiers warnings
>   fs/btrfs: Fix -Wmissing-prototypes warnings

The warnings from patch 2 and 3 got fixed recently, it's in the
development branch that hasn't been pushed to linux-next yet.

Patch 1 reports unused variables, we get occasional patches that just
silence the warning but it needs to be fixed properly (move setting
feature bits out of sysfs context).  As it's probably the last code
warning with W=1 left I guess I'll apply it, I don't have ETA for the
proper fix but at least this would save people time reporing it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-19 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 14:16 [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
2020-08-19 14:16 ` [PATCH 1/3] fs/btfrs: Fix -Wunused-but-set-variable warnings Leon Romanovsky
2020-08-19 14:16 ` [PATCH 2/3] fs/btrfs: Fix -Wignored-qualifiers warnings Leon Romanovsky
2020-08-19 14:16 ` [PATCH 3/3] fs/btrfs: Fix -Wmissing-prototypes warnings Leon Romanovsky
2020-08-19 14:21 ` [PATCH 0/3] Fixes to GCC warnings while compiling with W=1 level Leon Romanovsky
2020-08-19 15:39 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.