Ignore:
Timestamp:
May 1, 2019, 5:13:47 PM (5 years ago)
Author:
alain
Message:

Replace the queuelock protectingthe FAT by a rwlock in the FATFS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/fatfs.h

    r626 r627  
    3232
    3333
    34 ///////////////////////////////////////////////////////////////////////////////////////////
    35 // The FATFS File System implements a FAT32 read/write file system.
    36 //
    37 // The FATFS specific extensions to the generic VFS are the following:
    38 //
    39 // 1) The vfs_ctx_t "extend" field is a void* pointing on the fatfs_ctx_t structure.
    40 //    This structure contains various general informations such as the total
    41 //    number of sectors in FAT region, the number of bytes per sector, the number
    42 //    of sectors per cluster, the lba of FAT region, the lba of data region, or the
    43 //    cluster index for the root directory. It contains also an extended pointer
    44 //    on the FAT mapper.
    45 //
    46 // 2) The vfs_inode_t "extend" contains, for each inode,
    47 //    the first FAT cluster index (after cast to intptr).
    48 //
    49 // 3) The vfs_dentry_t "extend" field contains, for each dentry, the entry index
    50 //    in the FATFS directory (32 bytes per FATFS entry).
     34/**************************************************************************************
     35 * The FATFS File System implements a FAT32 read/write file system.
     36 *
     37 * The FATFS specific extensions to the generic VFS are the following:
     38 * 1) The vfs_ctx_t "extend" field is a void* pointing on the fatfs_ctx_t structure.
     39 *    This structure contains various general informations such as the total
     40 *    number of sectors in FAT region, the number of bytes per sector, the number
     41 *    of sectors per cluster, the lba of FAT region, the lba of data region, or the
     42 *    cluster index for the root directory. It contains also an extended pointer
     43 *    on the FAT mapper.
     44 * 2) The vfs_inode_t "extend" contains, for each inode,
     45 *    the first FAT cluster index (after cast to intptr).
     46 * 3) The vfs_dentry_t "extend" field contains, for each dentry, the entry index
     47 *    in the FATFS directory (32 bytes per FATFS entry).
     48 *************************************************************************************/
     49 
    5150///////////////////////////////////////////////////////////////////////////////////////////
    5251
     
    175174 * This fatfs context is replicated in all clusters.
    176175 *
    177  * WARNING : Almost all fields are constant values, but the <free_cluster_hint>,
    178  * <free_clusters> and <free_lock> are shared variables. Moreover, the <fs_info_buffer>,
    179  * only allocated in cluster 0, contains a copy of the FS_INFO sector. It is used by all
     176 * WARNING 1 : All access to the FAT are protected by a remote_rwlock.
     177 * - it is taken in READ mode by the fatfs_get_cluster() function to scan the
     178 *   linked list associated to a given inode.
     179 * - it is taken in WRITE mode by the fatfs_cluster_alloc() and fatfs_release_inode()
     180 *   functions to modify the FAT in both the FAT mapper and on IOC device.
     181 *
     182 * WARNING é : Almost all fields are constant values, but the <free_cluster_hint>,
     183 * <free_clusters> and <lock> are shared variables. The <fs_info_buffer>, only
     184 * allocated in cluster 0, contains a copy of the FS_INFO sector. It is used by all
    180185 * kernel instances to synchronously update the free clusters info on IOC device.
    181186 * For these four variables, all kernel instances must use the values in cluster 0,
    182  * and take the <free_lock> stored in this cluster for exclusive access to FAT.
     187 * containing the FAT mapper.
    183188 ****************************************************************************************/
    184189
     
    198203    uint32_t            free_cluster_hint;     /*! cluster[hint+1] is the first free    */
    199204    uint32_t            free_clusters;         /*! free clusters number                 */
    200     remote_queuelock_t  free_lock;             /*! exclusive access to FAT              */
     205    remote_rwlock_t     lock;                  /*! exclusive access to FAT              */
    201206    uint8_t           * fs_info_buffer;        /*! local pointer on FS_INFO buffer      */
    202207}
Note: See TracChangeset for help on using the changeset viewer.