Changeset 2764497 in mainline
- Timestamp:
- 2013-11-15T21:24:18Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 532f53d
- Parents:
- 7856d09
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_balloc.c
r7856d09 r2764497 264 264 * 265 265 */ 266 static uint32_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref)266 static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal) 267 267 { 268 uint32_t goal = 0; 269 268 *goal = 0; 270 269 ext4_superblock_t *sb = inode_ref->fs->superblock; 271 270 … … 280 279 if (inode_block_count > 0) { 281 280 int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 282 inode_block_count - 1, &goal);281 inode_block_count - 1, goal); 283 282 if (rc != EOK) 284 return 0;283 return rc; 285 284 286 285 if (goal != 0) { 287 goal++;288 return goal;286 (*goal)++; 287 return EOK; 289 288 } 290 289 … … 302 301 block_group, &bg_ref); 303 302 if (rc != EOK) 304 return 0;303 return rc; 305 304 306 305 /* Compute indexes */ … … 327 326 inode_table_blocks++; 328 327 329 goal = inode_table_first_block + inode_table_blocks;328 *goal = inode_table_first_block + inode_table_blocks; 330 329 331 330 ext4_filesystem_put_block_group_ref(bg_ref); 332 331 333 return goal;332 return EOK; 334 333 } 335 334 … … 349 348 block_t *bitmap_block; 350 349 uint32_t rel_block_idx = 0; 350 uint32_t goal; 351 351 352 352 /* Find GOAL */ 353 uint32_t goal = ext4_balloc_find_goal(inode_ref); 354 if (goal == 0) { 353 int rc = ext4_balloc_find_goal(inode_ref, &goal); 354 if (rc != EOK) 355 return rc; 356 else if (goal == 0) { 355 357 /* no goal found => partition is full */ 356 return ENO SPC;358 return ENOMEM; 357 359 } 358 360 … … 366 368 /* Load block group reference */ 367 369 ext4_block_group_ref_t *bg_ref; 368 intrc = ext4_filesystem_get_block_group_ref(inode_ref->fs,370 rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, 369 371 block_group, &bg_ref); 370 372 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.