summaryrefslogtreecommitdiff
path: root/fs/btrfs/compression.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-02-14 21:30:39 +0300
committerDavid Sterba <dsterba@suse.com>2017-02-28 16:26:35 +0300
commitff7638665c9a82894cabd18d26a9f8957f280f55 (patch)
treee7edeb798742e45df9e2966b2fb8c30e31a607a2 /fs/btrfs/compression.h
parent4d3a800ebb1299944408f3b40b5b6b996477fba2 (diff)
downloadlinux-ff7638665c9a82894cabd18d26a9f8957f280f55.tar.xz
btrfs: export compression buffer limits in a header
Move the buffer limit definitions out of compress_file_range. Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/compression.h')
-rw-r--r--fs/btrfs/compression.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index cfcec709c61b..619e64c27444 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -19,6 +19,21 @@
#ifndef __BTRFS_COMPRESSION_
#define __BTRFS_COMPRESSION_
+/*
+ * We want to make sure that amount of RAM required to uncompress an extent is
+ * reasonable, so we limit the total size in ram of a compressed extent to
+ * 128k. This is a crucial number because it also controls how easily we can
+ * spread reads across cpus for decompression.
+ *
+ * We also want to make sure the amount of IO required to do a random read is
+ * reasonably small, so we limit the size of a compressed extent to 128k.
+ */
+
+/* Maximum length of compressed data stored on disk */
+#define BTRFS_MAX_COMPRESSED (SZ_128K)
+/* Maximum size of data before compression */
+#define BTRFS_MAX_UNCOMPRESSED (SZ_128K)
+
void btrfs_init_compress(void);
void btrfs_exit_compress(void);