Changeset 0ec862d in mainline


Ignore:
Timestamp:
2008-10-27T13:28:29Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9f95a80
Parents:
cb682eb
Message:

Add FAT allocation futex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_fat.c

    rcb682eb r0ec862d  
    3333/**
    3434 * @file        fat_fat.c
    35  * @brief       Functions that manipulate the file allocation tables.
     35 * @brief       Functions that manipulate the File Allocation Tables.
    3636 */
    3737
     
    4545#include <align.h>
    4646#include <assert.h>
     47#include <futex.h>
     48
     49/**
     50 * The fat_alloc_lock futex protects all copies of the File Allocation Table
     51 * during allocation of clusters. The lock does not have to be held durring
     52 * deallocation of clusters.
     53 */ 
     54static futex_t fat_alloc_lock = FUTEX_INITIALIZER;
    4755
    4856block_t *
     
    261269         * Search FAT1 for unused clusters.
    262270         */
     271        futex_down(&fat_alloc_lock);
    263272        for (b = 0, cl = 0; b < sf; blk++) {
    264273                blk = block_get(dev_handle, rscnt + b, bps);
     
    284293                                        *lcl = lifo[0];
    285294                                        free(lifo);
     295                                        futex_up(&fat_alloc_lock);
    286296                                        return EOK;
    287297                                }
     
    290300                block_put(blk);
    291301        }
     302        futex_up(&fat_alloc_lock);
    292303
    293304        /*
Note: See TracChangeset for help on using the changeset viewer.