Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/libblock.c

    r5716e9a r96b02eb9  
    4444#include <sys/mman.h>
    4545#include <async.h>
     46#include <ipc/ipc.h>
    4647#include <as.h>
    4748#include <assert.h>
     
    176177        if (rc != EOK) {
    177178                munmap(comm_area, comm_size);
    178                 async_hangup(dev_phone);
     179                ipc_hangup(dev_phone);
    179180                return rc;
    180181        }
     
    182183        if (get_block_size(dev_phone, &bsize) != EOK) {
    183184                munmap(comm_area, comm_size);
    184                 async_hangup(dev_phone);
     185                ipc_hangup(dev_phone);
    185186                return rc;
    186187        }
     
    189190        if (rc != EOK) {
    190191                munmap(comm_area, comm_size);
    191                 async_hangup(dev_phone);
     192                ipc_hangup(dev_phone);
    192193                return rc;
    193194        }
     
    210211
    211212        munmap(devcon->comm_area, devcon->comm_size);
    212         async_hangup(devcon->dev_phone);
     213        ipc_hangup(devcon->dev_phone);
    213214
    214215        free(devcon);   
     
    294295
    295296        /* Allow 1:1 or small-to-large block size translation */
    296         if (cache->lblock_size % devcon->pblock_size != 0) {
    297                 free(cache);
     297        if (cache->lblock_size % devcon->pblock_size != 0)
    298298                return ENOTSUP;
    299         }
    300299
    301300        cache->blocks_cluster = cache->lblock_size / devcon->pblock_size;
     
    411410        l = hash_table_find(&cache->block_hash, &key);
    412411        if (l) {
    413 found:
    414412                /*
    415413                 * We found the block in the cache.
     
    439437                        if (!b->data) {
    440438                                free(b);
    441                                 b = NULL;
    442439                                goto recycle;
    443440                        }
     
    495492                                        goto retry;
    496493                                }
    497                                 l = hash_table_find(&cache->block_hash, &key);
    498                                 if (l) {
    499                                         /*
    500                                          * Someone else must have already
    501                                          * instantiated the block while we were
    502                                          * not holding the cache lock.
    503                                          * Leave the recycled block on the
    504                                          * freelist and continue as if we
    505                                          * found the block of interest during
    506                                          * the first try.
    507                                          */
    508                                         fibril_mutex_unlock(&b->lock);
    509                                         goto found;
    510                                 }
    511494
    512495                        }
     
    581564        assert(devcon);
    582565        assert(devcon->cache);
    583         assert(block->refcnt >= 1);
    584566
    585567        cache = devcon->cache;
     
    641623                        unsigned long key = block->lba;
    642624                        hash_table_remove(&cache->block_hash, &key, 1);
    643                         fibril_mutex_unlock(&block->lock);
     625                        free(block);
    644626                        free(block->data);
    645                         free(block);
    646627                        cache->blocks_cached--;
    647628                        fibril_mutex_unlock(&cache->lock);
Note: See TracChangeset for help on using the changeset viewer.