Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_balloc.c

    r7a46bfe rc2e50d7  
    3636static int
    3737find_free_bit_and_set(bitchunk_t *b, const int bsize,
    38                       const bool native, unsigned start_bit);
     38    const bool native, unsigned start_bit);
    3939
    4040static int
     
    122122        block_t *b;
    123123
    124         assert(inst != NULL);
    125124        sbi = inst->sbi;
    126         assert(sbi != NULL);
    127125
    128126        if (bid == BMAP_ZONE) {
     
    131129                if (idx > sbi->nzones) {
    132130                        printf(NAME ": Error! Trying to free beyond the" \
    133                                "bitmap max size\n");
     131                            "bitmap max size\n");
    134132                        return -1;
    135133                }
    136134        } else {
    137                 /*bid == BMAP_INODE*/
     135                /* bid == BMAP_INODE */
    138136                search = &sbi->isearch;
    139137                start_block = 2;
    140138                if (idx > sbi->ninodes) {
    141139                        printf(NAME ": Error! Trying to free beyond the" \
    142                                "bitmap max size\n");
     140                            "bitmap max size\n");
    143141                        return -1;
    144142                }
    145143        }
    146144
    147         /*Compute the bitmap block*/
     145        /* Compute the bitmap block */
    148146        uint32_t block = idx / (sbi->block_size * 8) + start_block;
    149147
     
    152150                goto out_err;
    153151
    154         /*Compute the bit index in the block*/
     152        /* Compute the bit index in the block */
    155153        idx %= (sbi->block_size * 8);
    156154        bitchunk_t *ptr = b->data;
     
    192190        int r, freebit;
    193191
    194         assert(inst != NULL);
    195192        sbi = inst->sbi;
    196         assert(sbi != NULL);
    197193
    198194        if (bid == BMAP_ZONE) {
     
    202198                limit = sbi->nzones - sbi->firstdatazone - 1;
    203199        } else {
    204                 /*bid == BMAP_INODE*/
     200                /* bid == BMAP_INODE */
    205201                search = &sbi->isearch;
    206202                start_block = 2;
     
    216212        for (i = *search / bits_per_block; i < nblocks; ++i) {
    217213                r = block_get(&b, inst->service_id, i + start_block,
    218                               BLOCK_FLAGS_NONE);
     214                    BLOCK_FLAGS_NONE);
    219215
    220216                if (r != EOK)
     
    224220
    225221                freebit = find_free_bit_and_set(b->data, sbi->block_size,
    226                                                 sbi->native, tmp);
     222                    sbi->native, tmp);
    227223                if (freebit == -1) {
    228                         /*No free bit in this block*/
     224                        /* No free bit in this block */
    229225                        r = block_put(b);
    230226                        if (r != EOK)
     
    233229                }
    234230
    235                 /*Free bit found in this block, compute the real index*/
     231                /* Free bit found in this block, compute the real index */
    236232                *idx = freebit + bits_per_block * i;
    237233                if (*idx > limit) {
    238                         /*Index is beyond the limit, it is invalid*/
     234                        /* Index is beyond the limit, it is invalid */
    239235                        r = block_put(b);
    240236                        if (r != EOK)
     
    250246
    251247        if (*search > 0) {
    252                 /*Repeat the search from the first bitmap block*/
     248                /* Repeat the search from the first bitmap block */
    253249                *search = 0;
    254250                goto retry;
    255251        }
    256252
    257         /*Free bit not found, return error*/
     253        /* Free bit not found, return error */
    258254        return ENOSPC;
    259255
     
    264260static int
    265261find_free_bit_and_set(bitchunk_t *b, const int bsize,
    266                       const bool native, unsigned start_bit)
     262    const bool native, unsigned start_bit)
    267263{
    268264        int r = -1;
     
    272268
    273269        for (i = start_bit / chunk_bits;
    274              i < bsize / sizeof(bitchunk_t); ++i) {
     270            i < bsize / sizeof(bitchunk_t); ++i) {
     271
    275272                if (!(~b[i])) {
    276                         /*No free bit in this chunk*/
     273                        /* No free bit in this chunk */
    277274                        continue;
    278275                }
Note: See TracChangeset for help on using the changeset viewer.