Changeset fd639b8 in rtems


Ignore:
Timestamp:
Jan 21, 2021, 3:53:55 PM (12 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
master
Children:
d4d2f64
Parents:
6ae79e6
git-author:
Christian Mauderer <christian.mauderer@…> (01/21/21 15:53:55)
git-committer:
Christian Mauderer <christian.mauderer@…> (03/26/21 13:25:56)
Message:

dosfs: Use peek support

This speeds up reading fragmented files.

Fix #3689

Location:
cpukit/libfs/src/dosfs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/dosfs/fat.c

    r6ae79e6 rfd639b8  
    199199    }
    200200    return cmpltd;
     201}
     202
     203void
     204fat_block_peek(
     205    fat_fs_info_t                        *fs_info,
     206    const uint32_t                        blk,
     207    const uint32_t                        blk_cnt
     208    )
     209{
     210    rtems_bdbuf_peek(fs_info->vol.dd, blk, blk_cnt);
    201211}
    202212
  • cpukit/libfs/src/dosfs/fat.h

    r6ae79e6 rfd639b8  
    500500                void                                 *buff);
    501501
     502void
     503fat_block_peek(fat_fs_info_t                        *fs_info,
     504               const uint32_t                        blk,
     505               const uint32_t                        blk_cnt);
     506
    502507ssize_t
    503508fat_cluster_write(fat_fs_info_t                    *fs_info,
  • cpukit/libfs/src/dosfs/fat_file.c

    r6ae79e6 rfd639b8  
    302302    uint32_t       save_ofs;
    303303    uint32_t       sec = 0;
     304    uint32_t       sec_peek = 0;
    304305    uint32_t       byte = 0;
    305306    uint32_t       c = 0;
     307    uint32_t       blk = 0;
     308    uint32_t       blk_cnt = 0;
    306309
    307310    /* it couldn't be removed - otherwise cache update will be broken */
     
    346349
    347350        sec = fat_cluster_num_to_sector_num(fs_info, cur_cln);
    348         sec += (ofs >> fs_info->vol.sec_log2);
    349         byte = ofs & (fs_info->vol.bps - 1);
    350 
    351         ret = _fat_block_read(fs_info, sec, byte, c, buf + cmpltd);
    352         if ( ret < 0 )
    353             return -1;
    354 
    355         count -= c;
    356         cmpltd += c;
     351
    357352        save_cln = cur_cln;
    358353        rc = fat_get_fat_cluster(fs_info, cur_cln, &cur_cln);
    359354        if ( rc != RC_OK )
    360355            return rc;
     356
     357        sec_peek = fat_cluster_num_to_sector_num(fs_info, cur_cln);
     358        blk = fat_sector_num_to_block_num (fs_info, sec_peek);
     359        blk_cnt = fs_info->vol.bpc >> fs_info->vol.bytes_per_block_log2;
     360        if (blk_cnt == 0)
     361            blk_cnt = 1;
     362        fat_block_peek(fs_info, blk, blk_cnt);
     363
     364        sec += (ofs >> fs_info->vol.sec_log2);
     365        byte = ofs & (fs_info->vol.bps - 1);
     366        ret = _fat_block_read(fs_info, sec, byte, c, buf + cmpltd);
     367        if ( ret < 0 )
     368            return -1;
     369
     370        count -= c;
     371        cmpltd += c;
    361372
    362373        ofs = 0;
Note: See TracChangeset for help on using the changeset viewer.