diff -ur linux-2.6.13_orig/fs/fat/cache.c linux-2.6.13/fs/fat/cache.c --- linux-2.6.13_orig/fs/fat/cache.c 2005-07-31 21:15:16.000000000 +0200 +++ linux-2.6.13/fs/fat/cache.c 2005-08-02 13:55:50.000000000 +0200 @@ -320,5 +320,5 @@ return cluster; else if (cluster) *phys = fat_clus_to_blknr(sbi, cluster) + offset; - return 0; + return offset; } diff -ur linux-2.6.13_orig/fs/fat/dir.c linux-2.6.13/fs/fat/dir.c --- linux-2.6.13_orig/fs/fat/dir.c 2005-07-31 21:14:20.000000000 +0200 +++ linux-2.6.13/fs/fat/dir.c 2005-07-31 21:53:28.000000000 +0200 @@ -46,7 +46,7 @@ struct super_block *sb = dir->i_sb; sector_t phys, iblock; int offset; - int err; + int clu_sector; next: if (*bh) @@ -54,10 +54,21 @@ *bh = NULL; iblock = *pos >> sb->s_blocksize_bits; - err = fat_bmap(dir, iblock, &phys); - if (err || !phys) + clu_sector = fat_bmap(dir, iblock, &phys); + if (clu_sector < 0 || !phys) return -1; /* beyond EOF or error */ + if (0 == clu_sector) { + struct buffer_head *bh = __getblk(sb->s_bdev, phys, sb->s_blocksize); + if (!buffer_uptodate(bh)) { + int sec; + int sec_per_clus = MSDOS_SB(sb)->sec_per_clus; + for (sec = 0; sec < sec_per_clus; sec++) + sb_breadahead(sb, phys + sec); + } + brelse(bh); + } + *bh = sb_bread(sb, phys); if (*bh == NULL) { printk(KERN_ERR "FAT: Directory bread(block %llu) failed\n", @@ -635,8 +646,7 @@ EODir: filp->f_pos = cpos; FillFailed: - if (bh) - brelse(bh); + brelse(bh); if (unicode) free_page((unsigned long)unicode); out: diff -ur linux-2.6.13_orig/fs/fat/inode.c linux-2.6.13/fs/fat/inode.c --- linux-2.6.13_orig/fs/fat/inode.c 2005-07-31 21:15:16.000000000 +0200 +++ linux-2.6.13/fs/fat/inode.c 2005-08-02 13:55:50.000000000 +0200 @@ -56,7 +56,7 @@ int err; err = fat_bmap(inode, iblock, &phys); - if (err) + if (err < 0) return err; if (phys) { map_bh(bh_result, sb, phys); @@ -76,7 +76,7 @@ } MSDOS_I(inode)->mmu_private += sb->s_blocksize; err = fat_bmap(inode, iblock, &phys); - if (err) + if (err < 0) return err; if (!phys) BUG();