Changeset a4627c4 in mainline for uspace/srv/fs/fat/fat.c


Ignore:
Timestamp:
2007-09-22T20:08:12Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
56bc4a3
Parents:
8f9ede5
Message:

VFS work.

Describe the bottleneck of one VFS-FS connection in fat.c. Add a comment
outlining possible approaches.

Also in fat.c, the async_create_manager() _must_ be called as well as
async_set_client_connection(). The latter alows VFS to duplicate the connection.
Modify fat_connection() to ACK all IPC_M_CONNECT_ME_TO calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat.c

    r8f9ede5 ra4627c4  
    4242#include <errno.h>
    4343#include <unistd.h>
    44 #include <stdio.h>>
     44#include <stdio.h>
    4545#include "../../vfs/vfs.h"
    4646
     
    6363};
    6464
    65 /*
    66  * This fibril processes request from the VFS server.
     65/**
     66 * This connection fibril processes VFS requests from VFS.
     67 *
     68 * In order to support simultaneous VFS requests, our design is as follows.
     69 * The connection fibril accepts VFS requests from VFS. If there is only one
     70 * instance of the fibril, VFS will need to serialize all VFS requests it sends
     71 * to FAT. To overcome this bottleneck, VFS can send FAT the IPC_M_CONNECT_ME_TO
     72 * call. In that case, a new connection fibril will be created, which in turn
     73 * will accept the call. Thus, a new phone will be opened for VFS.
     74 *
     75 * There are few issues with this arrangement. First, VFS can run out of
     76 * available phones. In that case, VFS can close some other phones or use one
     77 * phone for more serialized requests. Similarly, FAT can refuse to duplicate
     78 * the connection. VFS should then just make use of already existing phones and
     79 * route its requests through them. To avoid paying the fibril creation price
     80 * upon each request, FAT might want to keep the connections open after the
     81 * request has been completed.
    6782 */
    68 void fat_connection(ipc_callid_t iid, ipc_call_t *icall)
     83static void fat_connection(ipc_callid_t iid, ipc_call_t *icall)
    6984{
    70         dprintf("Callback connection established.\n");
     85        if (iid) {
     86                /*
     87                 * This only happens for connections opened by
     88                 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections
     89                 * created by IPC_M_CONNECT_TO_ME.
     90                 */
     91                ipc_answer_fast(iid, EOK, 0, 0);
     92        }
     93       
     94        dprintf("VFS-FAT connection established.\n");
    7195        while (1) {
    7296                ipc_callid_t callid;
     
    7498       
    7599                callid = async_get_call(&call);
    76                 ipc_answer_fast(callid, ENOTSUP, 0, 0);
     100                switch  (IPC_GET_METHOD(call)) {
     101                default:
     102                        ipc_answer_fast(callid, ENOTSUP, 0, 0);
     103                        break;
     104                }
    77105        }
    78106}
     
    113141        ipc_connect_to_me(vfs_phone, 0, 0, &phonehash);
    114142
     143        /*
     144         * Create a connection fibril to handle the callback connection.
     145         */
    115146        async_new_connection(phonehash, 0, NULL, fat_connection);
     147       
     148        /*
     149         * Tell the async framework that other connections are to be handled by
     150         * the same connection fibril as well.
     151         */
     152        async_set_client_connection(fat_connection);
    116153
    117154        /*
     
    121158        dprintf("FAT filesystem registered.\n");
    122159
     160        async_create_manager();
     161
    123162        /*
    124163         * TODO: Interestingly, if we merely return, the only thread dies.
    125          *      If the only thread dies, the whole task is destroyed.
    126          *      Prevent the thread from exiting when there are active fibrils.
     164         *      If the only thread dies, the whole task is destroyed.
     165         *      Prevent the thread from exiting when there are active fibrils.
    127166         */
    128167        fibril_schedule_next_adv(FIBRIL_FROM_DEAD);
Note: See TracChangeset for help on using the changeset viewer.