Changeset 34ca870 in mainline
- Timestamp:
- 2009-06-17T21:07:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ebe721
- Parents:
- 61d2315
- Location:
- uspace/srv/vfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_lookup.c
r61d2315 r34ca870 164 164 (ipcarg_t) root->dev_handle, (ipcarg_t) lflag, (ipcarg_t) index, 165 165 &answer); 166 vfs_release_phone(phone);167 166 168 167 ipcarg_t rc; 169 168 async_wait_for(req, &rc); 169 vfs_release_phone(phone); 170 170 171 171 futex_down(&plb_futex); … … 209 209 (ipcarg_t) result->triplet.index, &answer); 210 210 211 vfs_release_phone(phone);212 211 213 212 ipcarg_t rc; 214 213 async_wait_for(req, &rc); 214 vfs_release_phone(phone); 215 215 216 216 if (rc == EOK) { -
uspace/srv/vfs/vfs_ops.c
r61d2315 r34ca870 144 144 str_size(opts)); 145 145 if (rc != EOK) { 146 async_wait_for(msg, NULL); 146 147 vfs_release_phone(phone); 147 async_wait_for(msg, NULL);148 148 fibril_rwlock_write_unlock(&namespace_rwlock); 149 149 ipc_answer_0(rid, rc); 150 150 return; 151 151 } 152 async_wait_for(msg, &rc); 152 153 vfs_release_phone(phone); 153 async_wait_for(msg, &rc);154 154 155 155 if (rc != EOK) { … … 198 198 int mountee_phone = vfs_grab_phone(fs_handle); 199 199 assert(mountee_phone >= 0); 200 vfs_release_phone(mountee_phone);201 200 202 201 phone = vfs_grab_phone(mp_res.triplet.fs_handle); … … 210 209 rc = async_req_1_0(phone, IPC_M_CONNECTION_CLONE, mountee_phone); 211 210 if (rc != EOK) { 211 async_wait_for(msg, NULL); 212 vfs_release_phone(mountee_phone); 212 213 vfs_release_phone(phone); 213 async_wait_for(msg, NULL);214 214 /* Mount failed, drop reference to mp_node. */ 215 215 if (mp_node) … … 219 219 return; 220 220 } 221 222 vfs_release_phone(mountee_phone); 221 223 222 224 /* send the mount options */ 223 225 rc = ipc_data_write_start(phone, (void *)opts, str_size(opts)); 224 226 if (rc != EOK) { 227 async_wait_for(msg, NULL); 225 228 vfs_release_phone(phone); 226 async_wait_for(msg, NULL);227 229 /* Mount failed, drop reference to mp_node. */ 228 230 if (mp_node) … … 232 234 return; 233 235 } 236 async_wait_for(msg, &rc); 234 237 vfs_release_phone(phone); 235 async_wait_for(msg, &rc);236 238 237 239 if (rc == EOK) { … … 756 758 msg = async_send_2(fs_phone, IPC_GET_METHOD(*request), 757 759 file->node->dev_handle, file->node->index, &answer); 758 759 vfs_release_phone(fs_phone);760 760 761 761 /* Wait for reply from the FS server. */ 762 762 ipcarg_t rc; 763 763 async_wait_for(msg, &rc); 764 764 765 vfs_release_phone(fs_phone); 765 766 fibril_mutex_unlock(&file->lock); 766 767 … … 792 793 file->node->dev_handle, file->node->index, &answer); 793 794 794 vfs_release_phone(fs_phone);795 796 795 /* Wait for reply from the FS server. */ 797 796 ipcarg_t rc; 798 797 async_wait_for(msg, &rc); 799 798 799 vfs_release_phone(fs_phone); 800 800 fibril_mutex_unlock(&file->lock); 801 801 … … 819 819 */ 820 820 fibril_mutex_lock(&file->lock); 821 822 821 int fs_phone = vfs_grab_phone(file->node->fs_handle); 823 822 … … 828 827 file->node->dev_handle, file->node->index, &answer); 829 828 830 vfs_release_phone(fs_phone);831 832 829 /* Wait for reply from the FS server. */ 833 830 ipcarg_t rc; 834 831 async_wait_for(msg, &rc); 835 832 833 vfs_release_phone(fs_phone); 836 834 fibril_mutex_unlock(&file->lock); 837 835 … … 924 922 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 925 923 926 vfs_release_phone(fs_phone);927 928 924 /* Wait for reply from the FS server. */ 929 925 ipcarg_t rc; 930 926 async_wait_for(msg, &rc); 927 928 vfs_release_phone(fs_phone); 931 929 932 930 size_t bytes = IPC_GET_ARG1(answer); -
uspace/srv/vfs/vfs_register.c
r61d2315 r34ca870 286 286 int vfs_grab_phone(fs_handle_t handle) 287 287 { 288 /* 289 * For now, we don't try to be very clever and very fast. 290 * We simply lookup the phone in the fs_head list. We currently don't 291 * open any additional phones (even though that itself would be pretty 292 * straightforward; housekeeping multiple open phones to a FS task would 293 * be more demanding). Instead, we simply take the respective 294 * phone_futex and keep it until vfs_release_phone(). 288 int phone; 289 290 /* 291 * For now, we don't try to be very clever and very fast. We simply 292 * lookup the phone in the fs_head list and duplicate it. The duplicate 293 * phone will be returned to the client and the client will use it for 294 * communication. In the future, we should cache the connections so 295 * that they do not have to be reestablished over and over again. 295 296 */ 296 297 fibril_mutex_lock(&fs_head_lock); … … 302 303 fibril_mutex_unlock(&fs_head_lock); 303 304 fibril_mutex_lock(&fs->phone_lock); 304 return fs->phone; 305 phone = ipc_connect_me_to(fs->phone, 0, 0, 0); 306 fibril_mutex_unlock(&fs->phone_lock); 307 308 assert(phone > 0); 309 return phone; 305 310 } 306 311 } … … 309 314 } 310 315 311 /** Tell VFS that the phone is in use for any request.316 /** Tell VFS that the phone is not needed anymore. 312 317 * 313 318 * @param phone Phone to FS task. … … 315 320 void vfs_release_phone(int phone) 316 321 { 317 bool found = false; 318 319 fibril_mutex_lock(&fs_head_lock); 320 link_t *cur; 321 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 322 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 323 if (fs->phone == phone) { 324 found = true; 325 fibril_mutex_unlock(&fs_head_lock); 326 fibril_mutex_unlock(&fs->phone_lock); 327 return; 328 } 329 } 330 fibril_mutex_unlock(&fs_head_lock); 331 332 /* 333 * Not good to get here. 334 */ 335 assert(found == true); 322 /* TODO: implement connection caching */ 323 ipc_hangup(phone); 336 324 } 337 325
Note:
See TracChangeset
for help on using the changeset viewer.