Changeset 5cc1853 in mainline for uspace/lib/ext4/libext4_balloc.c


Ignore:
Timestamp:
2015-04-26T21:26:25Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24df0de6
Parents:
418f21d
Message:

libext4: ext4_balloc_get_first_data_block_in_group() should return an absolute block address, not relative to the block group it belongs to.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_balloc.c

    r418f21d r5cc1853  
    259259            sb);
    260260
    261         r = ext4_filesystem_bg_get_backup_blocks(bg_ref);
    262 
    263         if (ext4_filesystem_blockaddr2group(sb, bbmap) == bg_ref->index)
    264                 bbmap = ext4_filesystem_blockaddr2_index_in_group(sb, bbmap);
    265         else
     261        r = ext4_filesystem_index_in_group2blockaddr(sb, 0, bg_ref->index);
     262        r += ext4_filesystem_bg_get_backup_blocks(bg_ref);
     263
     264        if (ext4_filesystem_blockaddr2group(sb, bbmap) != bg_ref->index)
    266265                bbmap = -1; /* Invalid */
    267266
    268         if (ext4_filesystem_blockaddr2group(sb, ibmap) == bg_ref->index)
    269                 ibmap = ext4_filesystem_blockaddr2_index_in_group(sb, ibmap);
    270         else
     267        if (ext4_filesystem_blockaddr2group(sb, ibmap) != bg_ref->index)
    271268                ibmap = -1;
    272269
    273270        while (1) {
    274                 uint64_t r_abs = ext4_filesystem_index_in_group2blockaddr(sb,
    275                         r, bg_ref->index);
    276 
    277271                if (r == bbmap || r == ibmap)
    278272                        r++;
    279                 else if (r_abs >= itable && r_abs < itable_sz) {
    280                         r = ext4_filesystem_blockaddr2_index_in_group(sb,
    281                             itable + itable_sz);
    282                 } else
     273                else if (r >= itable && r < (itable + itable_sz))
     274                        r = itable + itable_sz;
     275                else
    283276                        break;
    284277        }
Note: See TracChangeset for help on using the changeset viewer.