Changeset df908b3 in mainline for uspace/srv/vfs/vfs_register.c


Ignore:
Timestamp:
2010-08-27T17:04:29Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3249673, ecd2775
Parents:
ddd7118
Message:

Use async relations introduced in the previous changeset to implement
vfs_grab_phone() and vfs_release_phone().

With this change, VFS will not be pointlessly connecting and disconnecting
phones on each VFS request.

Judging from the output of the top utility, this reduces the share of VFS on
kernel time by about 7% (from 25% down to 18%) and DEVFS kernel time by about 5%
(from 28% to 23%). This also makes CONSOLE the biggest consumer of kernel time,
while it used to be third after DEVFS and VFS.

File:
1 edited

Legend:

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

    rddd7118 rdf908b3  
    3939#include <ipc/services.h>
    4040#include <async.h>
     41#include <async_rel.h>
    4142#include <fibril.h>
     43#include <fibril_synch.h>
    4244#include <errno.h>
    4345#include <stdio.h>
     
    4648#include <ctype.h>
    4749#include <bool.h>
    48 #include <fibril_synch.h>
    4950#include <adt/list.h>
    5051#include <as.h>
     
    252253int vfs_grab_phone(fs_handle_t handle)
    253254{
     255        link_t *cur;
     256        fs_info_t *fs;
    254257        int phone;
    255258
     
    262265         */
    263266        fibril_mutex_lock(&fs_head_lock);
    264         link_t *cur;
    265         fs_info_t *fs;
    266267        for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
    267268                fs = list_get_instance(cur, fs_info_t, fs_link);
     
    269270                        fibril_mutex_unlock(&fs_head_lock);
    270271                        fibril_mutex_lock(&fs->phone_lock);
    271                         phone = ipc_connect_me_to(fs->phone, 0, 0, 0);
     272                        phone = async_relation_create(fs->phone);
    272273                        fibril_mutex_unlock(&fs->phone_lock);
    273274
     
    284285 * @param phone         Phone to FS task.
    285286 */
    286 void vfs_release_phone(int phone)
    287 {
    288         /* TODO: implement connection caching */
    289         ipc_hangup(phone);
     287void vfs_release_phone(fs_handle_t handle, int phone)
     288{
     289        link_t *cur;
     290        fs_info_t *fs;
     291
     292        fibril_mutex_lock(&fs_head_lock);
     293        for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
     294                fs = list_get_instance(cur, fs_info_t, fs_link);
     295                if (fs->fs_handle == handle) {
     296                        fibril_mutex_unlock(&fs_head_lock);
     297                        fibril_mutex_lock(&fs->phone_lock);
     298                        async_relation_destroy(fs->phone, phone);
     299                        fibril_mutex_unlock(&fs->phone_lock);
     300                        return;
     301                }
     302        }
     303        /* should not really get here */
     304        abort();
     305        fibril_mutex_unlock(&fs_head_lock);
    290306}
    291307
Note: See TracChangeset for help on using the changeset viewer.