Skip to content

Commit

Permalink
added data journaling cmdline switch
Browse files Browse the repository at this point in the history
  • Loading branch information
i-rinat committed Nov 19, 2012
1 parent c5ef137 commit 40d2534
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2012-11-19 Rinat Ibragimov <ibragimovrinat@mail.ru>

* rfsd: add command-line switch controlling data journaling. Specify
--journal-data to enable journaling not only meta-data but data also.

2012-11-15 Rinat Ibragimov <ibragimovrinat@mail.ru>

* rfsd: use own assertion macroses (assert{1,2}) both in release
Expand Down
13 changes: 12 additions & 1 deletion entry.cpp
Expand Up @@ -16,6 +16,7 @@ struct params_struct {
int pass_count;
bool do_squeeze;
int squeeze_threshold;
bool journal_data;
} params;

static const char *opt_string = "p:st:h";
Expand All @@ -24,6 +25,7 @@ static const struct option long_opts[] = {
{ "squeeze", no_argument, NULL, 's' },
{ "squeeze-threshold", required_argument, NULL, 128 },
{ "type", required_argument, NULL, 't' },
{ "journal-data", no_argument, NULL, 129 },
{ 0, 0, 0, 0}
};

Expand All @@ -36,6 +38,7 @@ display_usage()
printf("Usage: reiserfs-defrag [options] <reiserfs partition>\n"
"\n"
" -h, --help show usage (this screen)\n"
" --journal-data journal data in unformatted blocks\n"
" -p <passcount> incremental defrag pass count\n"
" -s, --squeeze squeeze AGs\n"
" --squeeze-threshold <value> squeeze AGs with more than 'value' gaps\n"
Expand All @@ -52,6 +55,7 @@ void default_params()
params.pass_count = 3;
params.do_squeeze = false;
params.squeeze_threshold = 7;
params.journal_data = false;
}

int
Expand Down Expand Up @@ -108,6 +112,9 @@ main (int argc, char *argv[])
params.do_squeeze = true;
}
break;
case 129: // journal-data
params.journal_data = true;
break;
}

opt = getopt_long(argc, argv, opt_string, long_opts, &long_index);
Expand All @@ -132,7 +139,11 @@ main (int argc, char *argv[])
throw no_error();
}

fs.useDataJournaling(false);
fs.useDataJournaling(params.journal_data);
if (params.journal_data)
std::cout << "journaling mode: data" << std::endl;
else
std::cout << "journaling mode: metadata only" << std::endl;

switch (params.defrag_type) {
case DEFRAG_TYPE_INCREMENTAL:
Expand Down

0 comments on commit 40d2534

Please sign in to comment.