提交 025421ea 编写于 作者: S Sergei Shtylyov 提交者: Wolfgang Denk

fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS

Currently in do_fat_read() when reading FAT sectors, we have to divide down
LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors
worth of bytes. In order to avoid redundant multiplication/division, introduce
#define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE.
Signed-off-by: NSergei Shtylyov <sshtylyov@mvista.com>
上级 40e21916
...@@ -440,10 +440,9 @@ get_vfatname (fsdata *mydata, int curclust, __u8 *cluster, ...@@ -440,10 +440,9 @@ get_vfatname (fsdata *mydata, int curclust, __u8 *cluster,
{ {
dir_entry *realdent; dir_entry *realdent;
dir_slot *slotptr = (dir_slot *)retdent; dir_slot *slotptr = (dir_slot *)retdent;
__u8 *buflimit = cluster + ((curclust == 0) ? __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?
LINEAR_PREFETCH_SIZE : PREFETCH_BLOCKS :
(mydata->clust_size * mydata->sect_size) mydata->clust_size);
);
__u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff; __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
int idx = 0; int idx = 0;
...@@ -880,7 +879,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, ...@@ -880,7 +879,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
if (disk_read(cursect, if (disk_read(cursect,
(mydata->fatsize == 32) ? (mydata->fatsize == 32) ?
(mydata->clust_size) : (mydata->clust_size) :
LINEAR_PREFETCH_SIZE / mydata->sect_size, PREFETCH_BLOCKS,
do_fat_read_block) < 0) { do_fat_read_block) < 0) {
debug("Error: reading rootdir block\n"); debug("Error: reading rootdir block\n");
goto exit; goto exit;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/* Maximum Long File Name length supported here is 128 UTF-16 code units */ /* Maximum Long File Name length supported here is 128 UTF-16 code units */
#define VFAT_MAXLEN_BYTES 256 /* Maximum LFN buffer in bytes */ #define VFAT_MAXLEN_BYTES 256 /* Maximum LFN buffer in bytes */
#define VFAT_MAXSEQ 9 /* Up to 9 of 13 2-byte UTF-16 entries */ #define VFAT_MAXSEQ 9 /* Up to 9 of 13 2-byte UTF-16 entries */
#define LINEAR_PREFETCH_SIZE (mydata->sect_size*2) /* Prefetch buffer size */ #define PREFETCH_BLOCKS 2
#define MAX_CLUSTSIZE 65536 #define MAX_CLUSTSIZE 65536
#define DIRENTSPERBLOCK (mydata->sect_size / sizeof(dir_entry)) #define DIRENTSPERBLOCK (mydata->sect_size / sizeof(dir_entry))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册