[PATCH] fat_access cleanup (6/11)

From: OGAWA Hirofumi (hirofumi@mail.parknet.co.jp)
Date: Mon Jul 21 2003 - 10:55:10 EST


First, this reads ->free_clusters without lock_fat() in fat_statfs().

 fs/fat/inode.c | 20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff -puN fs/fat/inode.c~fat_access-cleanup3 fs/fat/inode.c
--- linux-2.6.0-test1/fs/fat/inode.c~fat_access-cleanup3 2003-07-21 02:48:21.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/fat/inode.c 2003-07-21 02:48:21.000000000 +0900
@@ -1024,19 +1024,23 @@ out_fail:
 
 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)
                 free = MSDOS_SB(sb)->free_clusters;
         else {
- 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;
+ lock_fat(sb);
+ if (MSDOS_SB(sb)->free_clusters != -1)
+ free = MSDOS_SB(sb)->free_clusters;
+ else {
+ 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_bsize = 1 << MSDOS_SB(sb)->cluster_bits;

_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:43 EST