Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309726
b: refs/heads/master
c: 7849118
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Linus Torvalds committed Jun 1, 2012
1 parent a8d02e7 commit 49ad61a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 32 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: 330fe3c4c6509e0418c434b5bcf80e65cffab477
refs/heads/master: 78491189ddb6d84d4a4abae992ed891a236d0263
7 changes: 6 additions & 1 deletion trunk/fs/fat/fatent.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ void fat_ent_access_init(struct super_block *sb)

static void mark_fsinfo_dirty(struct super_block *sb)
{
sb->s_dirt = 1;
struct msdos_sb_info *sbi = MSDOS_SB(sb);

if (sb->s_flags & MS_RDONLY || sbi->fat_bits != 32)
return;

__mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC);
}

static inline int fat_ent_update_ptr(struct super_block *sb,
Expand Down
42 changes: 12 additions & 30 deletions trunk/fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,37 +459,10 @@ static void fat_evict_inode(struct inode *inode)
fat_detach(inode);
}

static void fat_write_super(struct super_block *sb)
{
lock_super(sb);
sb->s_dirt = 0;

if (!(sb->s_flags & MS_RDONLY))
fat_clusters_flush(sb);
unlock_super(sb);
}

static int fat_sync_fs(struct super_block *sb, int wait)
{
int err = 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)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);

if (sb->s_dirt)
fat_write_super(sb);

iput(sbi->fsinfo_inode);
iput(sbi->fat_inode);

Expand Down Expand Up @@ -662,7 +635,18 @@ static int __fat_write_inode(struct inode *inode, int wait)

static int fat_write_inode(struct inode *inode, struct writeback_control *wbc)
{
return __fat_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
int err;

if (inode->i_ino == MSDOS_FSINFO_INO) {
struct super_block *sb = inode->i_sb;

lock_super(sb);
err = fat_clusters_flush(sb);
unlock_super(sb);
} else
err = __fat_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);

return err;
}

int fat_sync_inode(struct inode *inode)
Expand All @@ -679,8 +663,6 @@ static const struct super_operations fat_sops = {
.write_inode = fat_write_inode,
.evict_inode = fat_evict_inode,
.put_super = fat_put_super,
.write_super = fat_write_super,
.sync_fs = fat_sync_fs,
.statfs = fat_statfs,
.remount_fs = fat_remount,

Expand Down

0 comments on commit 49ad61a

Please sign in to comment.