Changes between Version 8 and Version 9 of file_system


Ignore:
Timestamp:
Jun 7, 2015, 1:52:12 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • file_system

    v8 v9  
    1111The max file size is 4 Gbytes.
    1212 
    13 In the context of the FAT32, a cluster is the smallest storage allocation unit on the block device : any file  (or directory) occupies at least one cluster, and one cluster cannot be shared by 2 different files.
     13In the context of the FAT32, a cluster is the smallest storage allocation unit on the block device : any file  (or directory) occupies at least one cluster, and a given cluster cannot be shared by 2 different files.
    1414
    15 This implementation supports only one cluster_size = 4 Kbytes (i.e. 8 blocks).
     15This implementation supports only cluster size = 4 Kbytes (i.e. 8 blocks).
    1616
    17 The FAT region on the block device is an array of 32 bits words defining the linked list of clusters allocated to given file in the DATA region of the block device.
    18 Each slot in this array contains a cluster_ptr, that is the index of the cluster on the block device. The cluster_ptr value cannot be larger than 0x0FFFFFFF (i.e. 256 M). The max addressable storage capacity in the DATA region on the block device is therefore (256 M * 4 Kbytes) = 1 Tbytes.
     17The FAT region on the block device is an array of 32 bits words defining the linked list of clusters allocated to given file in the DATA region of the block device, that is accessed as an array of 4Kbytes buffers.
     18Each slot in the FAT array contains a cluster index, that is the index of the next allocated cluster for a given file.
     19The cluster index in the FAT array is also the cluster index in the DATA region array. The cluster value cannot be larger than 0x0FFFFFFF (i.e. 256 M). The max addressable storage capacity in the DATA region on the block device is therefore (256 M * 4 Kbytes) = 1 Tbytes.
    1920
    20 This implementation uses define four data structures:
     21This implementation defines four data structures:
    2122 * The '''File-Cache''' and '''Fat-Cache''' are dynamically allocated memory caches, implemented in the distributed kernel heap.
    22 There is actually one cache per file (File_Cache), and one cache for the FAT itself (called '''Fat_Cache'''). The cache size is not fixed: it is dynamically increased from the kernel heap as required by the read / write access to the files or to the FAT itself. The memory allocated to a given cache_file is only released when the file is closed.
     23There is actually one independent cache per file (called File_Cache), and one cache for the FAT itself (called Fat_Cache'''). The cache size is not fixed: it is dynamically increased from the kernel heap as required by the read / write access to the files or to the FAT itself. The memory allocated to a given cache_file is only released when the file is closed by all tasks using it.
    2324
    24  * The '''Inode-Tree''' is an internal representation of the FAT. It is a sub-tree of the File System tree. Each node define a file or a directory, and contains a pointer on the associated File-Cache. This Inode-Tree is dynamically increased from the distributed kernel heap when a file or a directory is accessed. The memory allocated to the Inode-Tree is only released in case of system crash.
     25 * The '''Inode-Tree''' is an internal representation of the FAT. It is a sub-tree of the File System tree. Each node define a file or a directory, and contains a pointer on the associated File-Cache. This Inode-Tree is dynamically increased (from the distributed kernel heap) when a new file or a directory is accessed. The memory allocated to the Inode-Tree is only released in case of system crash.
    2526
    26  * The '''File-Descriptor-Array''' is a statically defined array of file descriptors. According to the UNIX semantic, a private file descriptor is allocated to a task requiring to open a file, and contains mainly the current file pointer (called ''offset''). The max number of file descriptors is defined by the GIET_OPEN_FILES_MAX global variable (in the ''get_config.h'' file).
     27 * The '''File-Descriptor-Array''' is a statically defined array of file descriptors. According to the UNIX semantic, a private file descriptor is allocated to each task requiring to open the file, and contains mainly the current file pointer (called ''offset''). The max number of file descriptors is defined by the GIET_OPEN_FILES_MAX global variable (in the ''get_config.h'' file).
    2728
    28  * The global Fat_Descriptor contains general information such as the FAT region lba and size, the DATA region lba and size, and pointers on the Fat-Cache or Inode-Tree.
     29 * The global Fat_Descriptor contains general information such as the FAT region lba and size, the DATA region lba and size,  pointers on the Fat-Cache or Inode-Tree, the File-Descriptor-Array, and the locks protecting the FAT shared structures. It
     30contains also a single block buffer (512 bytes) used in the initialization phase.
    2931
    30 To support various block device peripheral, this FAT32 implementation defines a generic function to access the physical block device, using the driver specified in the ''hard_config.h'' file. Five drivers are presently supported ( IOC_BDV / IOC_HBA / IOC_SDC / IOC_SPI / IOC_RDK ).
     32To support various block device peripheral, this FAT32 implementation defines a generic function to transparently access various physical block devices, using the driver specified in the ''hard_config.h'' file. Five drivers are presently supported ( IOC_BDV / IOC_HBA / IOC_SDC / IOC_SPI / IOC_RDK ).
    3133
    3234WARNING 1: A node name (file or directory) cannot be larger than 38 characters.
    3335
    34 WARNING 2: There is no rescue mechanism at the moment in case of heap overflow: The system crash with a nice error message on the kernel terminal...
     36WARNING 2: There is no rescue mechanism (at the moment) in case of heap overflow: The system crash with a nice error message on the kernel terminal if the heap defined in the mapping is too small...
    3537
    3638== 2) Cache Structure & Write Policy ==
    3739
    38 The fat_cache and the file_cache have the same organisation.
     40The Fat_Cache and the File_Cache have the same organisation.
    3941Each cache contains an integer number of clusters, as the cluster is the smallest unit of data that can be
    40 loaded from the block device to the cache. To reduce the access time, this set of clusters is organized as 
     42loaded from the block device to a cache. To reduce the access time, this set of clusters is organized as 
    4143a 64-Tree: each node has one single parent and (up to) 64 children. The leaf nodes are the cluster descriptors.
    42 To access a given cluster in a given file, we use the cluster_id (index of cluster inside the file), that is different
    43 from the cluster_ptr  index of cluster on the block device. This cluster_id must be split in pieces
    44 of 6 bits, that are used to access the proper children at a given level in the 64-Tree.
     44
     45WARNING: To access a given cluster in a given file, we use the ''cluster_id'' variable, that is the index of cluster inside the file.
     46This ''cluster_id'' variable is different from the ''cluster'' variable,  that is used to index both the FAT and the DATA region on block device.
     47
     48The cluster_id variable must be split in pieces of 6 bits, that are used to access the proper children at a given level in the 64-Tree.
    4549The depth (number of levels) of the 64-Tree depends on the file size :
    4650||  File Size                                  || levels  ||