* [PATCH] btrfs: unexport btrfs_compress_set_level()
@ 2020-05-12 5:37 Anand Jain
2020-05-12 8:05 ` Johannes Thumshirn
2020-05-18 18:27 ` David Sterba
0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2020-05-12 5:37 UTC (permalink / raw)
To: linux-btrfs; +Cc: dsterba
btrfs_compress_set_level() can be static function in the file
compression.c.
Fixes: b0c1fe1eaf5e (btrfs: compression: replace set_level callbacks by
a common helper)
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/compression.c | 32 ++++++++++++++++----------------
fs/btrfs/compression.h | 2 --
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 9ab610cc9114..e4ee724d47df 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -1141,6 +1141,22 @@ static void put_workspace(int type, struct list_head *ws)
}
}
+/*
+ * Adjust @level according to the limits of the compression algorithm or
+ * fallback to default
+ */
+static unsigned int btrfs_compress_set_level(int type, unsigned level)
+{
+ const struct btrfs_compress_op *ops = btrfs_compress_op[type];
+
+ if (level == 0)
+ level = ops->default_level;
+ else
+ level = min(level, ops->max_level);
+
+ return level;
+}
+
/*
* Given an address space and start and length, compress the bytes into @pages
* that are allocated on demand.
@@ -1748,19 +1764,3 @@ unsigned int btrfs_compress_str2level(unsigned int type, const char *str)
return level;
}
-
-/*
- * Adjust @level according to the limits of the compression algorithm or
- * fallback to default
- */
-unsigned int btrfs_compress_set_level(int type, unsigned level)
-{
- const struct btrfs_compress_op *ops = btrfs_compress_op[type];
-
- if (level == 0)
- level = ops->default_level;
- else
- level = min(level, ops->max_level);
-
- return level;
-}
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index d253f7aa8ed5..284a3ad31350 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -140,8 +140,6 @@ extern const struct btrfs_compress_op btrfs_zstd_compress;
const char* btrfs_compress_type2str(enum btrfs_compression_type type);
bool btrfs_compress_is_valid_type(const char *str, size_t len);
-unsigned int btrfs_compress_set_level(int type, unsigned level);
-
int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end);
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: unexport btrfs_compress_set_level()
2020-05-12 5:37 [PATCH] btrfs: unexport btrfs_compress_set_level() Anand Jain
@ 2020-05-12 8:05 ` Johannes Thumshirn
2020-05-12 8:14 ` Anand Jain
2020-05-18 18:27 ` David Sterba
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Thumshirn @ 2020-05-12 8:05 UTC (permalink / raw)
To: Anand Jain, linux-btrfs; +Cc: dsterba
On 12/05/2020 07:38, Anand Jain wrote:
[...]
> +/*
> + * Adjust @level according to the limits of the compression algorithm or
> + * fallback to default
> + */
> +static unsigned int btrfs_compress_set_level(int type, unsigned level)
> +{
> + const struct btrfs_compress_op *ops = btrfs_compress_op[type];
> +
> + if (level == 0)
> + level = ops->default_level;
> + else
> + level = min(level, ops->max_level);
> +
> + return level;
> +}
> +
[...]
> -/*
> - * Adjust @level according to the limits of the compression algorithm or
> - * fallback to default
> - */
> -unsigned int btrfs_compress_set_level(int type, unsigned level)
> -{
> - const struct btrfs_compress_op *ops = btrfs_compress_op[type];
> -
> - if (level == 0)
> - level = ops->default_level;
> - else
> - level = min(level, ops->max_level);
> -
> - return level;
> -}
Why did you move the function?
Apart from that,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: unexport btrfs_compress_set_level()
2020-05-12 8:05 ` Johannes Thumshirn
@ 2020-05-12 8:14 ` Anand Jain
2020-05-12 8:15 ` Johannes Thumshirn
0 siblings, 1 reply; 5+ messages in thread
From: Anand Jain @ 2020-05-12 8:14 UTC (permalink / raw)
To: Johannes Thumshirn, linux-btrfs; +Cc: dsterba
> Why did you move the function?
Oh. In the original code, in compression.c the function call
(in btrfs_compress_pages()) come first before the function definition.
So to avoid the re-declaration moved the function up.
> Apart from that,
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: unexport btrfs_compress_set_level()
2020-05-12 8:14 ` Anand Jain
@ 2020-05-12 8:15 ` Johannes Thumshirn
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2020-05-12 8:15 UTC (permalink / raw)
To: Anand Jain, linux-btrfs; +Cc: dsterba
On 12/05/2020 10:14, Anand Jain wrote:
>
>> Why did you move the function?
>
> Oh. In the original code, in compression.c the function call
> (in btrfs_compress_pages()) come first before the function definition.
> So to avoid the re-declaration moved the function up.
>
>> Apart from that,
>> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
> Thanks.
>
Ok, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: unexport btrfs_compress_set_level()
2020-05-12 5:37 [PATCH] btrfs: unexport btrfs_compress_set_level() Anand Jain
2020-05-12 8:05 ` Johannes Thumshirn
@ 2020-05-18 18:27 ` David Sterba
1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2020-05-18 18:27 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs, dsterba
On Mon, May 11, 2020 at 10:37:51PM -0700, Anand Jain wrote:
> btrfs_compress_set_level() can be static function in the file
> compression.c.
>
> Fixes: b0c1fe1eaf5e (btrfs: compression: replace set_level callbacks by
> a common helper)
Not really a candidate for Fixes, there's no bug. Otherwise ok, added to
misc-next.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-18 18:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 5:37 [PATCH] btrfs: unexport btrfs_compress_set_level() Anand Jain
2020-05-12 8:05 ` Johannes Thumshirn
2020-05-12 8:14 ` Anand Jain
2020-05-12 8:15 ` Johannes Thumshirn
2020-05-18 18:27 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).