385 |
dn->last = dn->first = *table; |
dn->last = dn->first = *table; |
386 |
return 0; |
return 0; |
387 |
} |
} |
|
|
|
|
spin_lock(&dn->chain_extension_lock); |
|
388 |
|
|
389 |
|
spin_lock(&dn->chain_extension_lock); |
390 |
|
|
391 |
/* If we already have what we need, or we have all clusters that are |
/* If we already have what we need, or we have all clusters that are |
392 |
available without allocating new ones, go out. */ |
available without allocating new ones, go out. */ |
393 |
if (new_last_cluster < dn->length_of_chain |
if (new_last_cluster < dn->length_of_chain |
394 |
|| (!create && dn->chain_complete)) |
|| (!create && dn->chain_complete)) |
395 |
return 0; |
{ |
396 |
|
spin_unlock(&dn->chain_extension_lock); |
397 |
|
return 0; |
398 |
|
} |
399 |
|
|
400 |
left = new_last_cluster + 1 - dn->length_of_chain; |
left = new_last_cluster + 1 - dn->length_of_chain; |
401 |
|
|
520 |
/* Deallocate the complete file. */ |
/* Deallocate the complete file. */ |
521 |
node->dn->start_cluster = 0; |
node->dn->start_cluster = 0; |
522 |
pos = count = offs = 0; |
pos = count = offs = 0; |
523 |
|
node->dn->last = 0; |
524 |
} |
} |
525 |
else |
else |
526 |
{ |
{ |
529 |
while (count-- > 0) |
while (count-- > 0) |
530 |
{ |
{ |
531 |
assert (next); |
assert (next); |
532 |
|
|
533 |
|
/* This cluster is now the last cluster in the chain. */ |
534 |
|
if (count == 0) |
535 |
|
node->dn->last = next; |
536 |
|
|
537 |
next = next->next; |
next = next->next; |
538 |
} |
} |
539 |
assert (next); |
assert (next); |
575 |
free (next); |
free (next); |
576 |
next = next_next; |
next = next_next; |
577 |
} |
} |
578 |
|
|
579 |
|
if (clusters_to_keep == 0) |
580 |
|
node->dn->first = 0; |
581 |
|
|
582 |
|
node->dn->length_of_chain = clusters_to_keep; |
583 |
} |
} |
584 |
|
|
585 |
|
|