Commit d97a5110 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] FAT: Fix ->prev_free of fat (6/10)

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

The -1 was documented as "there is no hint", so this patch uses -1 instead
of 0 for FAT32 fsinfo.
parent 5af71cb2
...@@ -885,7 +885,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, ...@@ -885,7 +885,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
sbi->fat_length = CF_LE_W(b->fat_length); sbi->fat_length = CF_LE_W(b->fat_length);
sbi->root_cluster = 0; sbi->root_cluster = 0;
sbi->free_clusters = -1; /* Don't know yet */ sbi->free_clusters = -1; /* Don't know yet */
sbi->prev_free = 0; sbi->prev_free = -1;
if (!sbi->fat_length && b->fat32_length) { if (!sbi->fat_length && b->fat32_length) {
struct fat_boot_fsinfo *fsinfo; struct fat_boot_fsinfo *fsinfo;
......
...@@ -74,7 +74,7 @@ void fat_clusters_flush(struct super_block *sb) ...@@ -74,7 +74,7 @@ void fat_clusters_flush(struct super_block *sb)
} else { } else {
if (sbi->free_clusters != -1) if (sbi->free_clusters != -1)
fsinfo->free_clusters = CF_LE_L(sbi->free_clusters); fsinfo->free_clusters = CF_LE_L(sbi->free_clusters);
if (sbi->prev_free) if (sbi->prev_free != -1)
fsinfo->next_cluster = CF_LE_L(sbi->prev_free); fsinfo->next_cluster = CF_LE_L(sbi->prev_free);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
} }
......
...@@ -49,7 +49,7 @@ struct msdos_sb_info { ...@@ -49,7 +49,7 @@ struct msdos_sb_info {
unsigned long root_cluster; /* first cluster of the root directory */ unsigned long root_cluster; /* first cluster of the root directory */
unsigned long fsinfo_sector; /* FAT32 fsinfo offset from start of disk */ unsigned long fsinfo_sector; /* FAT32 fsinfo offset from start of disk */
struct semaphore fat_lock; struct semaphore fat_lock;
int prev_free; /* previously returned free cluster number */ int prev_free; /* previously allocated cluster number */
int free_clusters; /* -1 if undefined */ int free_clusters; /* -1 if undefined */
struct fat_mount_options options; struct fat_mount_options options;
struct nls_table *nls_disk; /* Codepage used on disk */ struct nls_table *nls_disk; /* Codepage used on disk */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment