-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow tmpfile compression to be disabled #110
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
} | ||
Comment on lines
+518
to
+524
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is wrong as it won't prevent compression if the parent directory of the tmpfile has the compression attribute set. This would leave you with compression still active even when you said |
||
|
||
// 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' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation isn't correct |
||
{ "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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming could be better: What it actually wants to do is decompressing shared extents. Nobody cares if this is done through tmpfiles or other means. Options should try not exposing too many details of the internal workings so they can still be true after code redesigns.