Skip to contentSkip to conversation

Size of journal?

DISCUSSION Jeff Layton 2 participants 2 messages Jan 10, 2010 – Jan 11, 2010

lore
Share & tools
lore
#0 lore raw

Good afternoon!

I was wondering what the default journal size is for ext4 when it's built on a single partition? Or does it vary in size as needed?

TIA!

Jeff

#1 lore raw
Quoted 9 lines · Jeff Layton

Good afternoon!

I was wondering what the default journal size is for ext4 when it's built on a single partition? Or does it vary in size as needed?

TIA!

Jeff

See figure_journal_size() in mke2fs.c. It's called w/ size == -1 if no other size is specified on the commandline so that goes to ext2fs_default_journal_size(), which is pretty straightforward in its scaling with nr of filesystem blocks:

/*
* Find a reasonable journal file size (in blocks) given the number of blocks
* in the filesystem. For very small filesystems, it is not reasonable to
* have a journal that fills more than half of the filesystem.
*/
int ext2fs_default_journal_size(__u64 blocks)

{
        if (blocks < 2048)
                return -1;
        if (blocks < 32768)
                return (1024);
        if (blocks < 256*1024)
                return (4096);
        if (blocks < 512*1024)
                return (8192);
        if (blocks < 1024*1024)
                return (16384);
        return 32768;
}