Changeset 06d85e5 in mainline for uspace/lib/ext4/libext4_ialloc.c


Ignore:
Timestamp:
2012-06-18T11:09:34Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2616a75b
Parents:
9a487cc
Message:

Most of comments modified by current coding style

File:
1 edited

Legend:

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

    r9a487cc r06d85e5  
    9494        ext4_superblock_t *sb = fs->superblock;
    9595
    96         // Compute index of block group and load it
     96        /* Compute index of block group and load it */
    9797        uint32_t block_group = ext4_ialloc_get_bgid_of_inode(sb, index);
    9898
     
    103103        }
    104104
    105         // Load i-node bitmap
     105        /* Load i-node bitmap */
    106106        uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
    107107                        bg_ref->block_group, sb);
     
    112112        }
    113113
    114         // Free i-node in the bitmap
     114        /* Free i-node in the bitmap */
    115115        uint32_t index_in_group = ext4_ialloc_inode2index_in_group(sb, index);
    116116        ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
    117117        bitmap_block->dirty = true;
    118118
    119         // Put back the block with bitmap
     119        /* Put back the block with bitmap */
    120120        rc = block_put(bitmap_block);
    121121        if (rc != EOK) {
    122                 // Error in saving bitmap
     122                /* Error in saving bitmap */
    123123                ext4_filesystem_put_block_group_ref(bg_ref);
    124124                return rc;
    125125        }
    126126
    127         // If released i-node is a directory, decrement used directories count
     127        /* If released i-node is a directory, decrement used directories count */
    128128        if (is_dir) {
    129129                uint32_t bg_used_dirs = ext4_block_group_get_used_dirs_count(
     
    134134        }
    135135
    136         // Update block group free inodes count
     136        /* Update block group free inodes count */
    137137        uint32_t free_inodes = ext4_block_group_get_free_inodes_count(
    138138                        bg_ref->block_group, sb);
     
    141141                        sb, free_inodes);
    142142
    143         // Set unused i-nodes count if supported
     143        /* Set unused i-nodes count if supported */
    144144        if (ext4_block_group_has_flag(bg_ref->block_group, EXT4_BLOCK_GROUP_INODE_UNINIT)) {
    145145                uint32_t unused_inodes = ext4_block_group_get_itable_unused(
     
    151151        bg_ref->dirty = true;
    152152
    153         // Put back the modified block group
     153        /* Put back the modified block group */
    154154        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    155155        if (rc != EOK) {
     
    157157        }
    158158
    159         // Update superblock free inodes count
     159        /* Update superblock free inodes count */
    160160        uint32_t sb_free_inodes = ext4_superblock_get_free_inodes_count(sb);
    161161        sb_free_inodes++;
     
    185185        uint32_t avg_free_inodes = sb_free_inodes / bg_count;
    186186
    187         // Try to find free i-node in all block groups
     187        /* Try to find free i-node in all block groups */
    188188        while (bgid < bg_count) {
    189189
    190                 // Load block group to check
     190                /* Load block group to check */
    191191                ext4_block_group_ref_t *bg_ref;
    192192                rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
     
    197197                ext4_block_group_t *bg = bg_ref->block_group;
    198198
    199                 // Read necessary values for algorithm
     199                /* Read necessary values for algorithm */
    200200                uint32_t free_blocks = ext4_block_group_get_free_blocks_count(bg, sb);
    201201                uint32_t free_inodes = ext4_block_group_get_free_inodes_count(bg, sb);
    202202                uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
    203203
    204                 // Check if this block group is good candidate for allocation
     204                /* Check if this block group is good candidate for allocation */
    205205                if ((free_inodes >= avg_free_inodes) && (free_blocks > 0)) {
    206206
    207                         // Load block with bitmap
     207                        /* Load block with bitmap */
    208208                        uint32_t bitmap_block_addr =  ext4_block_group_get_inode_bitmap(
    209209                                        bg_ref->block_group, sb);
     
    216216                        }
    217217
    218                         // Try to allocate i-node in the bitmap
     218                        /* Try to allocate i-node in the bitmap */
    219219                        uint32_t inodes_in_group = ext4_superblock_get_inodes_in_group(sb, bgid);
    220220                        uint32_t index_in_group;
     
    222222                                        bitmap_block->data, 0, &index_in_group, inodes_in_group);
    223223
    224                         // Block group has not any free i-node
     224                        /* Block group has not any free i-node */
    225225                        if (rc == ENOSPC) {
    226226                                block_put(bitmap_block);
     
    229229                        }
    230230
    231                         // Free i-node found, save the bitmap
     231                        /* Free i-node found, save the bitmap */
    232232                        bitmap_block->dirty = true;
    233233
     
    237237                        }
    238238
    239                         // Modify filesystem counters
     239                        /* Modify filesystem counters */
    240240                        free_inodes--;
    241241                        ext4_block_group_set_free_inodes_count(bg, sb, free_inodes);
    242242
    243                         // Decrement unused i-nodes counter if supported
     243                        /* Decrement unused i-nodes counter if supported */
    244244                        if (ext4_block_group_has_flag(bg, EXT4_BLOCK_GROUP_INODE_UNINIT)) {
    245245                                uint16_t unused_inodes = ext4_block_group_get_itable_unused(bg, sb);
     
    248248                        }
    249249
    250                         // Increment used directories counter
     250                        /* Increment used directories counter */
    251251                        if (is_dir) {
    252252                                used_dirs++;
     
    254254                        }
    255255
    256                         // Save modified block group
     256                        /* Save modified block group */
    257257                        bg_ref->dirty = true;
    258258
     
    263263                        }
    264264
    265                         // Update superblock
     265                        /* Update superblock */
    266266                        sb_free_inodes--;
    267267                        ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
    268268
    269                         // Compute the absolute i-nodex number
     269                        /* Compute the absolute i-nodex number */
    270270                        *index = ext4_ialloc_index_in_group2inode(sb, index_in_group, bgid);
    271271
     
    274274                }
    275275
    276                 // Block group not modified, put it and jump to the next block group
     276                /* Block group not modified, put it and jump to the next block group */
    277277                ext4_filesystem_put_block_group_ref(bg_ref);
    278278                ++bgid;
Note: See TracChangeset for help on using the changeset viewer.