Commit bf285b86 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] fat_clusters_flush() cleanup (4/5)

This patch cleans up fat_clusters_flush().
parent 17005aed
......@@ -388,14 +388,11 @@ int fat_free(struct inode *inode,int skip)
nr = -EIO;
goto error;
}
if (MSDOS_SB(sb)->free_clusters != -1) {
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters++;
if (MSDOS_SB(sb)->fat_bits == 32) {
fat_clusters_flush(sb);
}
}
inode->i_blocks -= (1 << MSDOS_SB(sb)->cluster_bits) >> 9 ;
inode->i_blocks -= (1 << MSDOS_SB(sb)->cluster_bits) >> 9;
}
fat_clusters_flush(sb);
nr = 0;
error:
unlock_fat(sb);
......
......@@ -178,9 +178,7 @@ void fat_put_super(struct super_block *sb)
dec_cvf_format_use_count_by_version(sbi->cvf_format->cvf_version);
sbi->cvf_format->unmount_cvf(sb);
}
if (sbi->fat_bits == 32) {
fat_clusters_flush(sb);
}
fat_cache_inval_dev(sb);
if (sbi->nls_disk) {
unload_nls(sbi->nls_disk);
......
......@@ -97,6 +97,11 @@ void fat_clusters_flush(struct super_block *sb)
struct buffer_head *bh;
struct fat_boot_fsinfo *fsinfo;
if (MSDOS_SB(sb)->fat_bits != 32)
return;
if (MSDOS_SB(sb)->free_clusters == -1)
return;
bh = fat_bread(sb, MSDOS_SB(sb)->fsinfo_sector);
if (bh == NULL) {
printk("FAT bread failed in fat_clusters_flush\n");
......@@ -185,7 +190,6 @@ int fat_add_cluster(struct inode *inode)
fat_access(sb, nr, FAT_ENT_EOF);
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters--;
if (MSDOS_SB(sb)->fat_bits == 32)
fat_clusters_flush(sb);
unlock_fat(sb);
......
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