Changes in / [a39aac7:5cd6c84] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_ops.c

    ra39aac7 r5cd6c84  
    935935uint64_t exfat_free_block_count(service_id_t service_id)
    936936{
    937         fs_node_t *node;
    938         exfat_node_t *bmap_node;
    939937        exfat_bs_t *bs;
    940         uint64_t free_block_count = 0;
    941         uint64_t block_count;
    942         unsigned sector;
    943         int rc;
    944 
    945         block_count = exfat_total_block_count(service_id);
    946 
    947938        bs = block_bb_get(service_id);
    948 
    949         rc = exfat_bitmap_get(&node, service_id);
    950         if (rc != EOK)
    951                 goto exit;
    952 
    953         bmap_node = (exfat_node_t *) node->data;
    954 
    955         for (sector = 0; sector < bmap_node->size / BPS(bs); ++sector) {
    956 
    957                 block_t *block;
    958                 uint8_t *bitmap;
    959                 unsigned bit;
    960 
    961                 rc = exfat_block_get_by_clst(&block, bs, service_id,
    962                     bmap_node->fragmented, bmap_node->firstc, NULL, sector,
    963                     BLOCK_FLAGS_NONE);
    964                 if (rc != EOK) {
    965                         free_block_count = 0;
    966                         goto exit;
    967                 }
    968 
    969                 bitmap = (uint8_t *) block->data;
    970 
    971                 for (bit = 0; bit < BPS(bs) * 8 && block_count > 0;
    972                     ++bit, --block_count) {
    973                         if (!(bitmap[bit / 8] & (1 << (bit % 8))))
    974                                 ++free_block_count;
    975                 }
    976 
    977                 block_put(block);
    978 
    979                 if (block_count == 0) {
    980                         /* Reached the end of the bitmap */
    981                         goto exit;
    982                 }
    983         }
    984 
    985 exit:
    986         exfat_node_put(node);
    987         return free_block_count;
     939       
     940        uint64_t block_count = (DATA_CNT(bs) / 100) *
     941                        bs->allocated_percent;
     942
     943        return block_count;
    988944}
    989945
Note: See TracChangeset for help on using the changeset viewer.