Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166583
b: refs/heads/master
c: ed248b2
h: refs/heads/master
i:
  166581: 662fce5
  166579: 1985f41
  166575: 80e8848
v: v3
  • Loading branch information
OGAWA Hirofumi committed Sep 19, 2009
1 parent b93df54 commit e5653ce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 955234755ce4a2c33cfc558912aa8f2148cc1fc6
refs/heads/master: ed248b290da7297c9b9a3ff180f5eee4db016224
2 changes: 1 addition & 1 deletion trunk/fs/fat/fat.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
/* fat/misc.c */
extern void fat_fs_error(struct super_block *s, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3))) __cold;
extern void fat_clusters_flush(struct super_block *sb);
extern int fat_clusters_flush(struct super_block *sb);
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
__le16 __time, __le16 __date, u8 time_cs);
Expand Down
14 changes: 9 additions & 5 deletions trunk/fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,16 @@ static void fat_write_super(struct super_block *sb)

static int fat_sync_fs(struct super_block *sb, int wait)
{
lock_super(sb);
fat_clusters_flush(sb);
sb->s_dirt = 0;
unlock_super(sb);
int err = 0;

return 0;
if (sb->s_dirt) {
lock_super(sb);
sb->s_dirt = 0;
err = fat_clusters_flush(sb);
unlock_super(sb);
}

return err;
}

static void fat_put_super(struct super_block *sb)
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/fat/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ EXPORT_SYMBOL_GPL(fat_fs_error);

/* Flushes the number of free clusters on FAT32 */
/* XXX: Need to write one per FSINFO block. Currently only writes 1 */
void fat_clusters_flush(struct super_block *sb)
int fat_clusters_flush(struct super_block *sb)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh;
struct fat_boot_fsinfo *fsinfo;

if (sbi->fat_bits != 32)
return;
return 0;

bh = sb_bread(sb, sbi->fsinfo_sector);
if (bh == NULL) {
printk(KERN_ERR "FAT: bread failed in fat_clusters_flush\n");
return;
return -EIO;
}

fsinfo = (struct fat_boot_fsinfo *)bh->b_data;
Expand All @@ -74,6 +74,8 @@ void fat_clusters_flush(struct super_block *sb)
mark_buffer_dirty(bh);
}
brelse(bh);

return 0;
}

/*
Expand Down

0 comments on commit e5653ce

Please sign in to comment.