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

Changeset be912f5 in mainline


Ignore:
Timestamp:
2018-12-12T18:11:14Z (19 months ago)
Author:
Maurizio Lombardi <mlombard@…>
Children:
6915335
Parents:
4f38ad77
git-author:
Maurizio Lombardi <mlombard@…> (2018-12-12 17:22:45)
git-committer:
Maurizio Lombardi <mlombard@…> (2018-12-12 18:11:14)
Message:

libext4: simplify ext4_balloc_get_first_data_block_in_group()

The first data block is ALWAYS after the inode table, FLEX_BG doesn't
change that.

File:
1 edited

Legend:

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

    r4f38ad77 rbe912f5  
    255255            bg_ref->index);
    256256
    257         if (!ext4_superblock_has_feature_incompatible(sb,
    258             EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
    259                 /*
    260                  * If we are not using FLEX_BG, the first data block
    261                  * is always after the inode table.
    262                  */
    263                 r = itable + itable_sz;
    264                 return ext4_filesystem_blockaddr2_index_in_group(sb, r);
    265         }
    266 
    267         uint64_t bbmap = ext4_block_group_get_block_bitmap(bg_ref->block_group,
    268             sb);
    269         uint64_t ibmap = ext4_block_group_get_inode_bitmap(bg_ref->block_group,
    270             sb);
    271 
    272         r = ext4_filesystem_index_in_group2blockaddr(sb, 0, bg_ref->index);
    273         r += ext4_filesystem_bg_get_backup_blocks(bg_ref);
    274 
    275         if (ext4_filesystem_blockaddr2group(sb, bbmap) != bg_ref->index)
    276                 bbmap = -1; /* Invalid */
    277 
    278         if (ext4_filesystem_blockaddr2group(sb, ibmap) != bg_ref->index)
    279                 ibmap = -1;
    280 
    281         while (true) {
    282                 if (r == bbmap || r == ibmap)
    283                         r++;
    284                 else if (r >= itable && r < (itable + itable_sz))
    285                         r = itable + itable_sz;
    286                 else
    287                         break;
    288         }
    289 
    290         return r;
     257        r = itable + itable_sz;
     258        return ext4_filesystem_blockaddr2_index_in_group(sb, r);
    291259}
    292260
Note: See TracChangeset for help on using the changeset viewer.