Changeset c31d773 in mainline


Ignore:
Timestamp:
2008-03-09T19:55:42Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
088cecc
Parents:
c089919
Message:

Grab the nodes_futex when manipulating node link counts in rename() and
_unlink().

Fix VFS futex definitions and declarations by replacing atomic_t by futex_t.

Location:
uspace/srv/vfs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    rc089919 rc31d773  
    3636#include <ipc/ipc.h>
    3737#include <libadt/list.h>
    38 #include <atomic.h>
     38#include <futex.h>
    3939#include <rwlock.h>
    4040#include <sys/types.h>
     
    108108        vfs_info_t vfs_info;
    109109        int fs_handle;
    110         atomic_t phone_futex;   /**< Phone serializing futex. */
     110        futex_t phone_futex;    /**< Phone serializing futex. */
    111111        ipcarg_t phone;
    112112} fs_info_t;
     
    233233} vfs_file_t;
    234234
     235extern futex_t nodes_futex;
     236
    235237extern link_t fs_head;          /**< List of registered file systems. */
    236238
     
    248250} plb_entry_t;
    249251
    250 extern atomic_t plb_futex;      /**< Futex protecting plb and plb_head. */
     252extern futex_t plb_futex;       /**< Futex protecting plb and plb_head. */
    251253extern uint8_t *plb;            /**< Path Lookup Buffer */
    252254extern link_t plb_head;         /**< List of active PLB entries. */
  • uspace/srv/vfs/vfs_lookup.c

    rc089919 rc31d773  
    4545#include <futex.h>
    4646#include <libadt/list.h>
    47 #include <atomic.h>
    4847#include <vfs/canonify.h>
    4948
    5049#define min(a, b)       ((a) < (b) ? (a) : (b))
    5150
    52 atomic_t plb_futex = FUTEX_INITIALIZER;
     51futex_t plb_futex = FUTEX_INITIALIZER;
    5352link_t plb_head;        /**< PLB entry ring buffer. */
    5453uint8_t *plb = NULL;
  • uspace/srv/vfs/vfs_node.c

    rc089919 rc31d773  
    3939#include <stdlib.h>
    4040#include <string.h>
    41 #include <atomic.h>
    4241#include <futex.h>
    4342#include <rwlock.h>
     
    4847
    4948/** Futex protecting the VFS node hash table. */
    50 atomic_t nodes_futex = FUTEX_INITIALIZER;
     49futex_t nodes_futex = FUTEX_INITIALIZER;
    5150
    5251#define NODES_BUCKETS_LOG       8
  • uspace/srv/vfs/vfs_ops.c

    rc089919 rc31d773  
    5151#include <fcntl.h>
    5252#include <assert.h>
    53 #include <atomic.h>
    5453#include <vfs/canonify.h>
    5554
     
    6362RWLOCK_INITIALIZE(namespace_rwlock);
    6463
    65 atomic_t rootfs_futex = FUTEX_INITIALIZER;
     64futex_t rootfs_futex = FUTEX_INITIALIZER;
    6665vfs_triplet_t rootfs = {
    6766        .fs_handle = 0,
     
    687686         */
    688687        vfs_node_t *node = vfs_node_get(&lr);
     688        futex_down(&nodes_futex);
    689689        node->lnkcnt--;
     690        futex_up(&nodes_futex);
    690691        rwlock_write_unlock(&namespace_rwlock);
    691692        vfs_node_put(node);
     
    811812                        return;
    812813                }
     814                futex_down(&nodes_futex);
    813815                new_node->lnkcnt--;
     816                futex_up(&nodes_futex);
    814817                break;
    815818        default:
     
    831834                return;
    832835        }
     836        futex_down(&nodes_futex);
    833837        old_node->lnkcnt++;
     838        futex_up(&nodes_futex);
    834839        /* Destroy the link for the old name. */
    835840        rc = vfs_lookup_internal(oldc, L_UNLINK, NULL, NULL);
     
    844849                return;
    845850        }
     851        futex_down(&nodes_futex);
    846852        old_node->lnkcnt--;
     853        futex_up(&nodes_futex);
    847854        rwlock_write_unlock(&namespace_rwlock);
    848855        vfs_node_put(old_node);
Note: See TracChangeset for help on using the changeset viewer.