aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/fatent.c
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2008-11-06 15:53:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-06 18:41:20 -0500
commit5e35dd4651002207948f10c576fc7d9bad448815 (patch)
treecf747b0dcbe5d86ed2d4f2bec4f581bc4b7e8335 /fs/fat/fatent.c
parentd3dfa8228f87ab9960ab8b4718013d68e3c25a43 (diff)
fat: Fix fat_ent_update_ptr() for FAT12
This fixes the missing update for bhs/nr_bhs in case the caller accessed from block boundary to first block of boundary. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/fatent.c')
-rw-r--r--fs/fat/fatent.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 5b5f49061b7c..13513992da3c 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -317,10 +317,20 @@ static inline int fat_ent_update_ptr(struct super_block *sb,
317 /* Is this fatent's blocks including this entry? */ 317 /* Is this fatent's blocks including this entry? */
318 if (!fatent->nr_bhs || bhs[0]->b_blocknr != blocknr) 318 if (!fatent->nr_bhs || bhs[0]->b_blocknr != blocknr)
319 return 0; 319 return 0;
320 /* Does this entry need the next block? */ 320 if (sbi->fat_bits == 12) {
321 if (sbi->fat_bits == 12 && (offset + 1) >= sb->s_blocksize) { 321 if ((offset + 1) < sb->s_blocksize) {
322 if (fatent->nr_bhs != 2 || bhs[1]->b_blocknr != (blocknr + 1)) 322 /* This entry is on bhs[0]. */
323 return 0; 323 if (fatent->nr_bhs == 2) {
324 brelse(bhs[1]);
325 fatent->nr_bhs = 1;
326 }
327 } else {
328 /* This entry needs the next block. */
329 if (fatent->nr_bhs != 2)
330 return 0;
331 if (bhs[1]->b_blocknr != (blocknr + 1))
332 return 0;
333 }
324 } 334 }
325 ops->ent_set_ptr(fatent, offset); 335 ops->ent_set_ptr(fatent, offset);
326 return 1; 336 return 1;