Changeset e2f20b9e in mainline
- Timestamp:
- 2018-12-13T13:29:38Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ea5e7a
- Parents:
- 91fcbabc
- Location:
- uspace/lib/ext4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/include/ext4/superblock.h
r91fcbabc re2f20b9e 147 147 extern void ext4_superblock_set_reserved_gdt_blocks(ext4_superblock_t *sb, 148 148 uint32_t n); 149 extern uint32_t ext4_superblock_get_flex_group_size(ext4_superblock_t *sb); 149 150 150 151 /* More complex superblock functions */ -
uspace/lib/ext4/src/balloc.c
r91fcbabc re2f20b9e 261 261 * is always after the inode table. 262 262 */ 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 263 271 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; 291 287 } 292 288 -
uspace/lib/ext4/src/superblock.c
r91fcbabc re2f20b9e 1394 1394 { 1395 1395 sb->reserved_gdt_blocks = host2uint32_t_le(n); 1396 } 1397 1398 /** Get the size of the flex groups 1399 * 1400 * @param sb Pointer to the superblock 1401 * 1402 * @return Size of the flex groups 1403 */ 1404 uint32_t ext4_superblock_get_flex_group_size(ext4_superblock_t *sb) 1405 { 1406 return 2 << sb->log_groups_per_flex; 1396 1407 } 1397 1408
Note:
See TracChangeset
for help on using the changeset viewer.