Changeset 7b47fa2 in mainline


Ignore:
Timestamp:
2009-06-25T21:30:25Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9593bc8
Parents:
d4b9d28
Message:

Do not use the "pending" fibril mechanism in VFS

Location:
uspace/srv/vfs
Files:
5 edited

Legend:

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

    rd4b9d28 r7b47fa2  
    4444#include <string.h>
    4545#include <as.h>
    46 #include <adt/list.h>
    4746#include <atomic.h>
    48 #include <assert.h>
    4947#include "vfs.h"
    5048
     
    142140       
    143141        /*
    144          * Initialize the list of registered file systems.
    145          */
    146         list_initialize(&fs_head);
    147        
    148         /*
    149142         * Initialize VFS node hash table.
    150143         */
     
    157150         * Allocate and initialize the Path Lookup Buffer.
    158151         */
    159         list_initialize(&plb_head);
    160152        plb = as_get_mappable_page(PLB_SIZE);
    161153        if (!plb) {
     
    177169
    178170        /*
    179          * Add a fibril for handling pending mounts.
    180          */
    181         fid_t fid = fibril_create(vfs_process_pending_mount, NULL);
    182         assert(fid);
    183         fibril_add_ready(fid);
    184        
    185         /*
    186171         * Register at the naming service.
    187172         */
  • uspace/srv/vfs/vfs.h

    rd4b9d28 r7b47fa2  
    147147extern fibril_mutex_t nodes_mutex;
    148148
     149extern fibril_condvar_t fs_head_cv;
     150extern fibril_mutex_t fs_head_lock;
    149151extern link_t fs_head;          /**< List of registered file systems. */
    150152
     
    170172extern void vfs_release_phone(int);
    171173
    172 extern fibril_mutex_t fs_head_lock;
    173 extern bool pending_new_fs;
    174 extern fibril_condvar_t pending_cv;
    175 
    176174extern fs_handle_t fs_name_to_handle(char *, bool);
    177175
     
    197195extern void vfs_node_delref(vfs_node_t *);
    198196
    199 extern void vfs_process_pending_mount(void);
    200197extern void vfs_register(ipc_callid_t, ipc_call_t *);
    201198extern void vfs_mount(ipc_callid_t, ipc_call_t *);
  • uspace/srv/vfs/vfs_lookup.c

    rd4b9d28 r7b47fa2  
    5050
    5151FIBRIL_MUTEX_INITIALIZE(plb_mutex);
    52 link_t plb_head;  /**< PLB entry ring buffer. */
     52LIST_INITIALIZE(plb_head);      /**< PLB entry ring buffer. */
    5353uint8_t *plb = NULL;
    5454
  • uspace/srv/vfs/vfs_ops.c

    rd4b9d28 r7b47fa2  
    5454/* Forward declarations of static functions. */
    5555static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t);
    56 
    57 /** Pending mount structure. */
    58 typedef struct {
    59         link_t link;
    60         char *fs_name;            /**< File system name */
    61         char *mp;                 /**< Mount point */
    62         char *opts;               /**< Mount options. */
    63         ipc_callid_t callid;      /**< Call ID waiting for the mount */
    64         ipc_callid_t rid;         /**< Request ID */
    65         dev_handle_t dev_handle;  /**< Device handle */
    66 } pending_req_t;
    67 
    68 FIBRIL_CONDVAR_INITIALIZE(pending_cv);
    69 bool pending_new_fs = false;    /**< True if a new file system was mounted. */
    70 LIST_INITIALIZE(pending_req);
    7156
    7257/**
     
    261246}
    262247
    263 /** Process pending mount requests */
    264 void vfs_process_pending_mount(void)
    265 {
    266         link_t *cur;
    267        
    268         while (true) {
    269                 fibril_mutex_lock(&fs_head_lock);
    270                 while (!pending_new_fs)
    271                         fibril_condvar_wait(&pending_cv, &fs_head_lock);
    272 rescan:
    273                 for (cur = pending_req.next; cur != &pending_req;
    274                     cur = cur->next) {
    275                         pending_req_t *pr = list_get_instance(cur,
    276                             pending_req_t, link);
    277                         fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name,
    278                             false);
    279                         if (!fs_handle)
    280                                 continue;
    281                
    282                         /* Acknowledge that we know fs_name. */
    283                         ipc_answer_0(pr->callid, EOK);
    284                
    285                         list_remove(cur);
    286                         fibril_mutex_unlock(&fs_head_lock);
    287                        
    288                         /* Do the mount */
    289                         vfs_mount_internal(pr->rid, pr->dev_handle, fs_handle,
    290                             pr->mp, pr->opts);
    291 
    292                         free(pr->fs_name);
    293                         free(pr->mp);
    294                         free(pr->opts);
    295                         free(pr);
    296                
    297                         fibril_mutex_lock(&fs_head_lock);
    298                         goto rescan;
    299                 }
    300                 pending_new_fs = false;
    301                 fibril_mutex_unlock(&fs_head_lock);
    302         }
    303 }
    304 
    305248void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
    306249{
     
    457400         */
    458401        fibril_mutex_lock(&fs_head_lock);
    459         fs_handle_t fs_handle = fs_name_to_handle(fs_name, false);
     402        fs_handle_t fs_handle;
     403recheck:
     404        fs_handle = fs_name_to_handle(fs_name, false);
    460405        if (!fs_handle) {
    461406                if (flags & IPC_FLAG_BLOCKING) {
    462                         pending_req_t *pr;
    463 
    464                         /* Blocking mount, add to pending list */
    465                         pr = (pending_req_t *) malloc(sizeof(pending_req_t));
    466                         if (!pr) {
    467                                 fibril_mutex_unlock(&fs_head_lock);
    468                                 ipc_answer_0(callid, ENOMEM);
    469                                 ipc_answer_0(rid, ENOMEM);
    470                                 free(mp);
    471                                 free(fs_name);
    472                                 free(opts);
    473                                 return;
    474                         }
    475                        
    476                         pr->fs_name = fs_name;
    477                         pr->mp = mp;
    478                         pr->opts = opts;
    479                         pr->callid = callid;
    480                         pr->rid = rid;
    481                         pr->dev_handle = dev_handle;
    482                         link_initialize(&pr->link);
    483                         list_append(&pr->link, &pending_req);
    484                         fibril_mutex_unlock(&fs_head_lock);
    485                         return;
     407                        fibril_condvar_wait(&fs_head_cv, &fs_head_lock);
     408                        goto recheck;
    486409                }
    487410               
  • uspace/srv/vfs/vfs_register.c

    rd4b9d28 r7b47fa2  
    5353#include "vfs.h"
    5454
     55FIBRIL_CONDVAR_INITIALIZE(fs_head_cv);
    5556FIBRIL_MUTEX_INITIALIZE(fs_head_lock);
    56 link_t fs_head;
     57LIST_INITIALIZE(fs_head);
    5758
    5859atomic_t fs_handle_next = {
     
    269270        ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);
    270271       
    271         pending_new_fs = true;
    272         fibril_condvar_signal(&pending_cv);
     272        fibril_condvar_signal(&fs_head_cv);
    273273        fibril_mutex_unlock(&fs_head_lock);
    274274       
Note: See TracChangeset for help on using the changeset viewer.