Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5cef315 in mainline


Ignore:
Timestamp:
2018-10-01T23:41:49Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
dbcaa2d
Parents:
3f7fe9e
Message:

This makes us pass e2fsck -f, not entirely sure why.

Location:
uspace/lib/ext4/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/src/filesystem.c

    r3f7fe9e r5cef315  
    703703                /* One for block bitmap one for inode bitmap */
    704704                free_blocks = free_blocks - reserved - 2 - inode_table_blocks;
     705                if (bg_index == 0)
     706                        ++free_blocks; /* XXX Why? */
    705707
    706708                ext4_block_group_set_free_blocks_count(bg_ref->block_group,
  • uspace/lib/ext4/src/superblock.c

    r3f7fe9e r5cef315  
    12481248uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *sb)
    12491249{
    1250         uint64_t blocks_count = ext4_superblock_get_blocks_count(sb);
     1250        uint64_t blocks_count = ext4_superblock_get_blocks_count(sb) - 1;
    12511251        uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
    12521252
     
    12741274            ext4_superblock_get_blocks_per_group(sb);
    12751275        uint64_t total_blocks =
    1276             ext4_superblock_get_blocks_count(sb);
     1276            ext4_superblock_get_blocks_count(sb) - 1;
    12771277
    12781278        if (bgid < block_group_count - 1)
     
    15331533        ext4_superblock_set_magic(sb, EXT4_SUPERBLOCK_MAGIC);
    15341534        ext4_superblock_set_inodes_count(sb, inodes_count);
    1535         ext4_superblock_set_blocks_count(sb, blocks_count);
     1535        /* This seems to include the boot block, despite the ext2fs docs */
     1536        ext4_superblock_set_blocks_count(sb, fs_blocks);
    15361537        ext4_superblock_set_reserved_blocks_count(sb, res_blocks);
    15371538        ext4_superblock_set_free_blocks_count(sb, free_blocks);
     
    15831584        /* Compute free blocks */
    15841585        free_blocks = blocks_count;
     1586        ++free_blocks; // XXX Why?
    15851587        for (idx = 0; idx < ngroups; idx++) {
    15861588                free_blocks -= ext4_superblock_get_group_backup_blocks(sb, idx);
Note: See TracChangeset for help on using the changeset viewer.