Changeset 2764497 in mainline


Ignore:
Timestamp:
2013-11-15T21:24:18Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
532f53d
Parents:
7856d09
Message:

libext4: modify ext4_balloc_find_goal() to report the correct error to the caller.

File:
1 edited

Legend:

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

    r7856d09 r2764497  
    264264 *
    265265 */
    266 static uint32_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref)
     266static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
    267267{
    268         uint32_t goal = 0;
    269        
     268        *goal = 0;
    270269        ext4_superblock_t *sb = inode_ref->fs->superblock;
    271270       
     
    280279        if (inode_block_count > 0) {
    281280                int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
    282                     inode_block_count - 1, &goal);
     281                    inode_block_count - 1, goal);
    283282                if (rc != EOK)
    284                         return 0;
     283                        return rc;
    285284               
    286285                if (goal != 0) {
    287                         goal++;
    288                         return goal;
     286                        (*goal)++;
     287                        return EOK;
    289288                }
    290289               
     
    302301            block_group, &bg_ref);
    303302        if (rc != EOK)
    304                 return 0;
     303                return rc;
    305304       
    306305        /* Compute indexes */
     
    327326                inode_table_blocks++;
    328327       
    329         goal = inode_table_first_block + inode_table_blocks;
     328        *goal = inode_table_first_block + inode_table_blocks;
    330329       
    331330        ext4_filesystem_put_block_group_ref(bg_ref);
    332331       
    333         return goal;
     332        return EOK;
    334333}
    335334
     
    349348        block_t *bitmap_block;
    350349        uint32_t rel_block_idx = 0;
     350        uint32_t goal;
    351351       
    352352        /* 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) {
    355357                /* no goal found => partition is full */
    356                 return ENOSPC;
     358                return ENOMEM;
    357359        }
    358360       
     
    366368        /* Load block group reference */
    367369        ext4_block_group_ref_t *bg_ref;
    368         int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
     370        rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
    369371            block_group, &bg_ref);
    370372        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.