Changeset 3842a955 in mainline for uspace/srv/fs/fat/fat_idx.c
- Timestamp:
- 2011-06-19T15:59:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 26e7d6d
- Parents:
- 9724d7f (diff), 74464e8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_idx.c
r9724d7f r3842a955 67 67 68 68 /** Sorted list of intervals of freed indices. */ 69 li nk_t freed_head;69 list_t freed_list; 70 70 } unused_t; 71 71 … … 74 74 75 75 /** List of unused structures. */ 76 static LIST_INITIALIZE(unused_ head);76 static LIST_INITIALIZE(unused_list); 77 77 78 78 static void unused_initialize(unused_t *u, devmap_handle_t devmap_handle) … … 82 82 u->next = 0; 83 83 u->remaining = ((uint64_t)((fs_index_t)-1)) + 1; 84 list_initialize(&u->freed_ head);84 list_initialize(&u->freed_list); 85 85 } 86 86 … … 88 88 { 89 89 unused_t *u; 90 link_t *l;91 90 92 91 if (lock) 93 92 fibril_mutex_lock(&unused_lock); 94 for (l = unused_head.next; l != &unused_head; l = l->next) { 93 94 list_foreach(unused_list, l) { 95 95 u = list_get_instance(l, unused_t, link); 96 96 if (u->devmap_handle == devmap_handle) 97 97 return u; 98 98 } 99 99 100 if (lock) 100 101 fibril_mutex_unlock(&unused_lock); … … 249 250 return false; 250 251 251 if (list_empty(&u->freed_ head)) {252 if (list_empty(&u->freed_list)) { 252 253 if (u->remaining) { 253 254 /* … … 262 263 } else { 263 264 /* There are some freed indices which we can reuse. */ 264 freed_t *f = list_get_instance( u->freed_head.next, freed_t,265 link);265 freed_t *f = list_get_instance(list_first(&u->freed_list), 266 freed_t, link); 266 267 *index = f->first; 267 268 if (f->first++ == f->last) { … … 320 321 link_t *lnk; 321 322 freed_t *n; 322 for (lnk = u->freed_ head.next; lnk != &u->freed_head;323 for (lnk = u->freed_list.head.next; lnk != &u->freed_list.head; 323 324 lnk = lnk->next) { 324 325 freed_t *f = list_get_instance(lnk, freed_t, link); 325 326 if (f->first == index + 1) { 326 327 f->first--; 327 if (lnk->prev != &u->freed_ head)328 if (lnk->prev != &u->freed_list.head) 328 329 try_coalesce_intervals(lnk->prev, lnk, 329 330 lnk); … … 333 334 if (f->last == index - 1) { 334 335 f->last++; 335 if (lnk->next != &u->freed_ head)336 if (lnk->next != &u->freed_list.head) 336 337 try_coalesce_intervals(lnk, lnk->next, 337 338 lnk); … … 359 360 n->first = index; 360 361 n->last = index; 361 list_append(&n->link, &u->freed_ head);362 list_append(&n->link, &u->freed_list); 362 363 } 363 364 fibril_mutex_unlock(&unused_lock); … … 558 559 fibril_mutex_lock(&unused_lock); 559 560 if (!unused_find(devmap_handle, false)) { 560 list_append(&u->link, &unused_ head);561 list_append(&u->link, &unused_list); 561 562 } else { 562 563 free(u); … … 594 595 fibril_mutex_unlock(&unused_lock); 595 596 596 while (!list_empty(&u->freed_ head)) {597 while (!list_empty(&u->freed_list)) { 597 598 freed_t *f; 598 f = list_get_instance( u->freed_head.next, freed_t, link);599 f = list_get_instance(list_first(&u->freed_list), freed_t, link); 599 600 list_remove(&f->link); 600 601 free(f);
Note:
See TracChangeset
for help on using the changeset viewer.