Changeset b3c38750 in mainline


Ignore:
Timestamp:
2008-01-06T13:08:32Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4db6eaf
Parents:
9413c0d
Message:

Turn the namespace futex into rwlock.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/include/rwlock.h

    r9413c0d rb3c38750  
    4545typedef atomic_t rwlock_t;
    4646
     47#define RWLOCK_INITIALIZE(rwlock)       \
     48    rwlock_t rwlock = FUTEX_INITIALIZER
     49
    4750#define rwlock_initialize(rwlock)       futex_initialize((rwlock), 1)
    4851#define rwlock_reader_lock(rwlock)      futex_down((rwlock))
  • uspace/srv/vfs/vfs.h

    r9413c0d rb3c38750  
    174174extern link_t plb_head;         /**< List of active PLB entries. */
    175175
    176 /** Holding this futex prevents extern changes in file system namespace. */
    177 atomic_t namespace_futex;
     176/** Holding this rwlock prevents changes in file system namespace. */
     177extern rwlock_t namespace_rwlock;
    178178
    179179extern int vfs_grab_phone(int);
  • uspace/srv/vfs/vfs_mount.c

    r9413c0d rb3c38750  
    183183                 * We already have the root FS.
    184184                 */
    185                 futex_down(&namespace_futex);
     185                rwlock_writer_lock(&namespace_rwlock);
    186186                rc = vfs_lookup_internal(buf, size, &mp, NULL);
    187187                if (rc != EOK) {
     
    189189                         * The lookup failed for some reason.
    190190                         */
    191                         futex_up(&namespace_futex);
     191                        rwlock_writer_unlock(&namespace_rwlock);
    192192                        futex_up(&rootfs_futex);
    193193                        vfs_node_put(mr_node);  /* failed -> drop reference */
     
    198198                mp_node = vfs_node_get(&mp);
    199199                if (!mp_node) {
    200                         futex_up(&namespace_futex);
     200                        rwlock_writer_unlock(&namespace_rwlock);
    201201                        futex_up(&rootfs_futex);
    202202                        vfs_node_put(mr_node);  /* failed -> drop reference */
     
    210210                 * This prevents the mount point from being deleted.
    211211                 */
    212                 futex_up(&namespace_futex);
     212                rwlock_writer_unlock(&namespace_rwlock);
    213213        } else {
    214214                /*
  • uspace/srv/vfs/vfs_open.c

    r9413c0d rb3c38750  
    3939#include <async.h>
    4040#include <errno.h>
    41 #include <futex.h>
     41#include <rwlock.h>
    4242#include <sys/types.h>
    4343#include <stdlib.h>
     
    9494         * triplet.
    9595         */
    96         futex_down(&namespace_futex);
     96        rwlock_reader_lock(&namespace_rwlock);
    9797
    9898        /*
     
    102102        rc = vfs_lookup_internal(path, size, &triplet, NULL);
    103103        if (rc) {
    104                 futex_up(&namespace_futex);
     104                rwlock_reader_unlock(&namespace_rwlock);
    105105                ipc_answer_0(rid, rc);
    106106                free(path);
     
    114114
    115115        vfs_node_t *node = vfs_node_get(&triplet);
    116         futex_up(&namespace_futex);
     116        rwlock_reader_unlock(&namespace_rwlock);
    117117
    118118        /*
  • uspace/srv/vfs/vfs_unlink.c

    r9413c0d rb3c38750  
    3636 */
    3737
    38 #include <atomic.h>
    39 #include <futex.h>
     38#include <rwlock.h>
    4039
    4140/**
    42  * This futex prevents the race between a triplet-to-VFS-node resolution and a
     41 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
    4342 * concurrent VFS operation which modifies the file system namespace.
    4443 */
    45 atomic_t namespace_futex = FUTEX_INITIALIZER;
     44RWLOCK_INITIALIZE(namespace_rwlock);
    4645
    4746/**
Note: See TracChangeset for help on using the changeset viewer.