Changeset 553492be in mainline for uspace/srv/vfs/vfs_node.c


Ignore:
Timestamp:
2009-06-17T22:33:08Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ac47b7c2
Parents:
ca093b3
Message:

Finish converting VFS to fibril synchronization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_node.c

    rca093b3 r553492be  
    3939#include <stdlib.h>
    4040#include <string.h>
    41 #include <futex.h>
    4241#include <fibril_sync.h>
    4342#include <adt/hash_table.h>
     
    4645#include <errno.h>
    4746
    48 /** Futex protecting the VFS node hash table. */
    49 futex_t nodes_futex = FUTEX_INITIALIZER;
     47/** Mutex protecting the VFS node hash table. */
     48FIBRIL_MUTEX_INITIALIZE(nodes_mutex);
    5049
    5150#define NODES_BUCKETS_LOG       8
     
    9089void vfs_node_addref(vfs_node_t *node)
    9190{
    92         futex_down(&nodes_futex);
     91        fibril_mutex_lock(&nodes_mutex);
    9392        _vfs_node_addref(node);
    94         futex_up(&nodes_futex);
     93        fibril_mutex_unlock(&nodes_mutex);
    9594}
    9695
     
    106105        bool free_fs_node = false;
    107106
    108         futex_down(&nodes_futex);
     107        fibril_mutex_lock(&nodes_mutex);
    109108        if (node->refcnt-- == 1) {
    110109                /*
     
    122121                        free_fs_node = true;
    123122        }
    124         futex_up(&nodes_futex);
     123        fibril_mutex_unlock(&nodes_mutex);
    125124
    126125        if (free_fs_node) {
     
    162161        vfs_node_t *node;
    163162
    164         futex_down(&nodes_futex);
     163        fibril_mutex_lock(&nodes_mutex);
    165164        tmp = hash_table_find(&nodes, key);
    166165        if (!tmp) {
    167166                node = (vfs_node_t *) malloc(sizeof(vfs_node_t));
    168167                if (!node) {
    169                         futex_up(&nodes_futex);
     168                        fibril_mutex_unlock(&nodes_mutex);
    170169                        return NULL;
    171170                }
     
    194193
    195194        _vfs_node_addref(node);
    196         futex_up(&nodes_futex);
     195        fibril_mutex_unlock(&nodes_mutex);
    197196
    198197        return node;
Note: See TracChangeset for help on using the changeset viewer.