diff options
author | Theodore Ts'o <tytso@mit.edu> | 2007-06-21 11:59:06 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-06-21 11:59:06 -0400 |
commit | 56d1236726d8e4624d2f3a2f4713864c1e66bb40 (patch) | |
tree | 51bb49283246533ad69b9cc818381e6b692952a0 /misc/util.c | |
parent | cb0c5d701a8852f72fe75c9bd223643fb5222399 (diff) | |
download | e2fsprogs-56d1236726d8e4624d2f3a2f4713864c1e66bb40.tar.gz |
Add default journal size function
Factor out the code which sets the default journal size and move it
into libext2fs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/util.c')
-rw-r--r-- | misc/util.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/misc/util.c b/misc/util.c index 53f36136..7522e9b0 100644 --- a/misc/util.c +++ b/misc/util.c @@ -251,9 +251,10 @@ void parse_journal_opts(const char *opts) */ int figure_journal_size(int size, ext2_filsys fs) { - blk_t j_blocks; + int j_blocks; - if (fs->super->s_blocks_count < 2048) { + j_blocks = ext2fs_default_journal_size(fs->super->s_blocks_count); + if (j_blocks < 0) { fputs(_("\nFilesystem too small for a journal\n"), stderr); return 0; } @@ -273,21 +274,7 @@ int figure_journal_size(int size, ext2_filsys fs) stderr); exit(1); } - return j_blocks; } - - if (fs->super->s_blocks_count < 32768) - j_blocks = 1400; - else if (fs->super->s_blocks_count < 256*1024) - j_blocks = 4096; - else if (fs->super->s_blocks_count < 512*1024) - j_blocks = 8192; - else if (fs->super->s_blocks_count < 1024*1024) - j_blocks = 16384; - else - j_blocks = 32768; - - return j_blocks; } |