public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* EXT4: About the method of compute journal blocks
@ 2017-01-17  3:50 yu xing
  2017-01-17 17:10 ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: yu xing @ 2017-01-17  3:50 UTC (permalink / raw)
  To: linux-ext4

Hello All,

         Currently, I am seeing the the make_ext4fs code of
android,the source code is located at system/extras/ext4_utils

I have some question, as following, can somebody help me to explain
these questions? Thanks a lot!

1. The method of compute journal blocks, why  divide 64 :

          static u32 compute_journal_blocks()
{
    u32 journal_blocks = DIV_ROUND_UP(info.len, info.block_size) / 64;
   // is here, why divide 64 ???
    if (journal_blocks < 1024)
        journal_blocks = 1024;
    if (journal_blocks > 32768)
        journal_blocks = 32768;
    return journal_blocks;
}

2. The method of compute jbg_desc_reserve_blocks , why multiply by 1024:
static u32 compute_bg_desc_reserve_blocks()
{
    u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
    u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
    u32 bg_desc_blocks = DIV_ROUND_UP(block_groups * sizeof(struct
ext2_group_desc),
            info.block_size);

    u32 bg_desc_reserve_blocks =
            DIV_ROUND_UP(block_groups * 1024 * sizeof(struct
ext2_group_desc),      // is here , why multiply by 1024 ???
                    info.block_size) - bg_desc_blocks;

    if (bg_desc_reserve_blocks > info.block_size / sizeof(u32))
        bg_desc_reserve_blocks = info.block_size / sizeof(u32);

    return bg_desc_reserve_blocks;
}

3. About compute_inodes function , why divide 4 ??
static u32 compute_inodes()
{
    return DIV_ROUND_UP(info.len, info.block_size) / 4;  // is here
why divide 4 ??
}


yu.xing

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-18 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17  3:50 EXT4: About the method of compute journal blocks yu xing
2017-01-17 17:10 ` Theodore Ts'o
2017-01-18  5:06   ` yu xing
2017-01-18 15:41     ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox