Changeset ab936440 in mainline for uspace/lib/ext4/src/balloc.c


Ignore:
Timestamp:
2019-02-12T20:42:42Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f31ca47
Parents:
7f7817a9 (diff), 4805495 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
Message:

Merge branch 'master' into bdsh_alias

Conflicts:

uspace/app/bdsh/Makefile
uspace/app/bdsh/cmds/modules/modules.h

Ccheck correction and removing header which includes itself

File:
1 edited

Legend:

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

    r7f7817a9 rab936440  
    261261                 * is always after the inode table.
    262262                 */
     263                return itable + itable_sz;
     264        }
     265
     266        uint32_t flex_group_size = ext4_superblock_get_flex_group_size(sb);
     267        if ((bg_ref->index % flex_group_size) == 0) {
     268                /* This is the base group */
     269                uint32_t i;
     270
    263271                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;
     272
     273                uint32_t total_groups = ext4_superblock_get_block_group_count(sb);
     274                for (i = bg_ref->index + 1;
     275                    i < min(total_groups, bg_ref->index + flex_group_size); ++i) {
     276                        r += ext4_filesystem_bg_get_itable_size(sb, i);
     277                }
     278
     279                return r;
     280        }
     281
     282        uint64_t base_addr = ext4_filesystem_index_in_group2blockaddr(sb, 0,
     283            bg_ref->index);
     284        uint32_t reserved = ext4_filesystem_bg_get_backup_blocks(bg_ref);
     285
     286        return base_addr + reserved;
    291287}
    292288
Note: See TracChangeset for help on using the changeset viewer.