Commit 24fbf4c4 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] fat_access cleanup (6/11)

This reads ->free_clusters without lock_fat() in fat_statfs().
parent b2ef7d8a
...@@ -1024,19 +1024,23 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, ...@@ -1024,19 +1024,23 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
int fat_statfs(struct super_block *sb, struct kstatfs *buf) int fat_statfs(struct super_block *sb, struct kstatfs *buf)
{ {
int free,nr; int free, nr;
lock_fat(sb);
if (MSDOS_SB(sb)->free_clusters != -1) if (MSDOS_SB(sb)->free_clusters != -1)
free = MSDOS_SB(sb)->free_clusters; free = MSDOS_SB(sb)->free_clusters;
else { else {
free = 0; lock_fat(sb);
for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++) if (MSDOS_SB(sb)->free_clusters != -1)
if (fat_access(sb, nr, -1) == FAT_ENT_FREE) free = MSDOS_SB(sb)->free_clusters;
free++; else {
MSDOS_SB(sb)->free_clusters = free; free = 0;
for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++)
if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
free++;
MSDOS_SB(sb)->free_clusters = free;
}
unlock_fat(sb);
} }
unlock_fat(sb);
buf->f_type = sb->s_magic; buf->f_type = sb->s_magic;
buf->f_bsize = 1 << MSDOS_SB(sb)->cluster_bits; buf->f_bsize = 1 << MSDOS_SB(sb)->cluster_bits;
......
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