We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 19676

EDK 6.2 SP1, Xilfatfs - Reading large files into small structures from SystemACE results in very long run times


Keywords: Xilfatfs, Xilfat, read, file, ACE, System, run, time, run-time, buffered, character, file, IO

Urgency: Standard

General Description:
Reading large files into small structures (i.e., characters) from SystemACE using Xilfatfs results in very long read times.


Currently Xilfatfs is unbuffered, so reading data into small structures will result in very long read times for large files.

The following is a simple example which reads characters from a file, illustrating the effects of buffered versus unbuffered IO:

while ((c = getc(fd)) != EOF) {
/* do something with the character c */

If the IO is unbuffered, each getc() results in an fread() on the file system, resulting in a get_sector() on the disk. If the IO is buffered, the first getc() results in an fread() and get_sector(). However, the fread() is on a buffer of size 1024 or more, and subsequent calls to getc() simply access this buffer, instead of calling fread() and get_sector(). This speeds up getc() significantly because get_sector() on the hard disk or flash could be very slow.

Because Xilfatfs was developed for reading large image files where each read() caused several disk sectors to be stored in local memory, buffering was never an issue.

Xilinx is planning to support buffered read/write in the EDK 7.1
AR# 19676
Date 04/30/2007
Status Archive
Type General Article
Page Bookmarked