Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2944 → Rev 2943

/trunk/uspace/srv/fs/fat/fat_idx.c
68,10 → 68,6
link_t freed_head;
} unused_t;
 
/** Futex protecting the list of unused structures. */
static futex_t unused_futex = FUTEX_INITIALIZER;
 
/** List of unused structures. */
static LIST_INITIALIZE(unused_head);
 
/**
191,14 → 187,12
unused_t *u;
assert(index);
futex_down(&unused_futex);
for (l = unused_head.next; l != &unused_head; l = l->next) {
u = list_get_instance(l, unused_t, link);
if (u->dev_handle == dev_handle)
goto hit;
}
futex_up(&unused_futex);
 
/* dev_handle not found */
return false;
 
211,7 → 205,6
*/
*index = u->next++;
--u->remaining;
futex_up(&unused_futex);
return true;
}
} else {
224,7 → 217,6
list_remove(&f->link);
free(f);
}
futex_up(&unused_futex);
return true;
}
/*
232,7 → 224,6
* theoretically still possible (e.g. too many open unlinked nodes or
* too many zero-sized nodes).
*/
futex_up(&unused_futex);
return false;
}
 
261,13 → 252,11
link_t *l;
unused_t *u;
 
futex_down(&unused_futex);
for (l = unused_head.next; l != &unused_head; l = l->next) {
u = list_get_instance(l, unused_t, link);
if (u->dev_handle == dev_handle)
goto hit;
}
futex_up(&unused_futex);
 
/* should not happen */
assert(0);
277,6 → 266,7
/* The index can be returned directly to the counter. */
u->next--;
u->remaining++;
return;
} else {
/*
* The index must be returned either to an existing freed
292,7 → 282,6
if (lnk->prev != &u->freed_head)
try_coalesce_intervals(lnk->prev, lnk,
lnk);
futex_up(&unused_futex);
return;
}
if (f->last == index - 1) {
300,7 → 289,6
if (lnk->next != &u->freed_head)
try_coalesce_intervals(lnk, lnk->next,
lnk);
futex_up(&unused_futex);
return;
}
if (index > f->first) {
311,7 → 299,6
n->first = index;
n->last = index;
list_insert_before(&n->link, lnk);
futex_up(&unused_futex);
return;
}
 
325,7 → 312,6
n->last = index;
list_append(&n->link, &u->freed_head);
}
futex_up(&unused_futex);
}
 
fat_idx_t *