Changeset 246 for trunk/kernel/mm


Ignore:
Timestamp:
Jul 20, 2017, 12:55:23 PM (7 years ago)
Author:
alain
Message:

Fix a major bug in FATFS : miss handling in the FAT mapper.

Location:
trunk/kernel/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/mapper.c

    r238 r246  
    4040#include <mapper.h>
    4141
    42 //////////////////////////
    43 mapper_t * mapper_create()
     42//////////////////////////////////////////////
     43mapper_t * mapper_create( vfs_fs_type_t type )
    4444{
    4545    mapper_t * mapper;
     
    7878    }
    7979
     80    // initialize mapper type
     81    mapper->type = type;
     82
    8083    // initialize mapper lock
    8184    rwlock_init(  &mapper->lock );
     
    139142    error_t       error;
    140143
    141     mapper_dmsg("\n[INFO] %s : enter for page %d / mapper = %x\n",
     144    mapper_dmsg("\n[INFO] %s : enters for page %d in mapper %x\n",
    142145                __FUNCTION__ , index , mapper );
    143146
     
    254257    }
    255258
    256     mapper_dmsg("\n[INFO] %s : exit for page %d / page desc = %x\n",
    257                 __FUNCTION__ , index , page );
     259    mapper_dmsg("\n[INFO] %s : exit for page %d in mapper %x / page_desc = %x\n",
     260                __FUNCTION__ , index , mapper , page );
    258261
    259262    return page;
  • trunk/kernel/mm/mapper.h

    r238 r246  
    4949 * - The mapper is protected by a blocking "rwlock", to support several simultaneous
    5050 *   readers, and only one writer. This lock implement a busy waiting policy.
    51  * - The vfs_mapper_move_page() and vfs_mapper_load_all() functions are used to move
    52  *   pages to or from the file system on device.
     51 * - The mapper_get_page() function that return a page descriptor pointer from a page
     52 *   index in file is in charge of handling the miss on the mapper cache.
     53 * - The vfs_mapper_move_page() function is used to handle miss on one specific page,
     54 *   or update a dirty page on device.
     55 * - The vfs_mapper_load_all() functions is used to load all pages of a given directory
     56 *   into the mapper.
    5357 * - the mapper_move() function is used to move data to or from an user buffer.
    5458 *   This user space buffer can be physically distributed in several clusters.
    55  * - The mapper_get_page() function that return a page descriptor pointer from a page
    56  *   index in file is in charge of handling the miss on the mapper cache.
    57  * - In the present implementation the cache size increases on demand, and the
    58  *   allocated memory is only released when the mapper/inode is destroyed.
     59 * - In the present implementation the cache size for a given file increases on demand,
     60 *   and the  allocated memory is only released when the mapper/inode is destroyed.
    5961 ******************************************************************************************/
    6062
     
    6769{
    6870        struct vfs_inode_s * inode;           /*! owner inode                                     */
     71    uint32_t             type;        /*! file system type                                */
    6972        grdxt_t              radix;           /*! pages cache implemented as a radix tree         */
    7073        rwlock_t             lock;        /*! several readers / only one writer               */
Note: See TracChangeset for help on using the changeset viewer.