From dc4e2bce542ec0ad5b170131cca89ec090c9066c Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Tue, 26 Feb 2019 12:35:45 -0600 Subject: [PATCH] Allow tmpfile compression to be disabled --- src/bees.cc | 18 +++++++++++++----- src/bees.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/bees.cc b/src/bees.cc index 183d6bad3..1d484419a 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -31,6 +31,7 @@ using namespace crucible; using namespace std; int bees_log_level = 8; +bool bees_tmpfile_compression_disabled = false; void do_cmd_help(char *argv[]) @@ -56,6 +57,7 @@ do_cmd_help(char *argv[]) "\n" "Workarounds:\n" " -a, --workaround-btrfs-send Workaround for btrfs send\n" + " -N, --no-tmpfile-compression Disable compression for temporary files\n" "\n" "Logging options:\n" " -t, --timestamps Show timestamps in log output (default)\n" @@ -513,11 +515,13 @@ BeesTempFile::create() m_ctx->insert_root_ino(m_fd); // Set compression attribute - BEESTRACE("Getting FS_COMPR_FL on m_fd " << name_fd(m_fd)); - int flags = ioctl_iflags_get(m_fd); - flags |= FS_COMPR_FL; - BEESTRACE("Setting FS_COMPR_FL on m_fd " << name_fd(m_fd) << " flags " << to_hex(flags)); - ioctl_iflags_set(m_fd, flags); + if(!bees_tmpfile_compression_disabled) { + BEESTRACE("Getting FS_COMPR_FL on m_fd " << name_fd(m_fd)); + int flags = ioctl_iflags_get(m_fd); + flags |= FS_COMPR_FL; + BEESTRACE("Setting FS_COMPR_FL on m_fd " << name_fd(m_fd) << " flags " << to_hex(flags)); + ioctl_iflags_set(m_fd, flags); + } // Always leave first block empty to avoid creating a file with an inline extent m_end_offset = BLOCK_SIZE_CLONE; @@ -779,6 +783,7 @@ bees_main(int argc, char *argv[]) { "strip-paths", no_argument, NULL, 'P' }, { "no-timestamps", no_argument, NULL, 'T' }, { "workaround-btrfs-send", no_argument, NULL, 'a' }, + { "no-tmpfile-compression", no_argument, NULL, 'N' }, { "thread-count", required_argument, NULL, 'c' }, { "loadavg-target", required_argument, NULL, 'g' }, { "help", no_argument, NULL, 'h' }, @@ -832,6 +837,9 @@ bees_main(int argc, char *argv[]) case 'a': workaround_btrfs_send = true; break; + case 'N': + bees_tmpfile_compression_disabled = true; + break; case 'c': thread_count = stoul(optarg); break; diff --git a/src/bees.h b/src/bees.h index f2b6a0459..51ae884b0 100644 --- a/src/bees.h +++ b/src/bees.h @@ -857,6 +857,7 @@ class BeesTooLong : public Timer { // And now, a giant pile of extern declarations extern int bees_log_level; +extern bool bees_tmpfile_compression_disabled; extern const char *BEES_VERSION; string pretty(double d); void bees_sync(int fd);