Sanitize ->fsync() for FAT
* mark directory data blocks as assoc. metadata * add new inode to deal with FAT, mark FAT blocks as assoc. metadata of that * now ->fsync() is trivial both for files and directories Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@ -73,6 +73,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent,
|
||||
struct buffer_head **bhs = fatent->bhs;
|
||||
|
||||
WARN_ON(blocknr < MSDOS_SB(sb)->fat_start);
|
||||
fatent->fat_inode = MSDOS_SB(sb)->fat_inode;
|
||||
|
||||
bhs[0] = sb_bread(sb, blocknr);
|
||||
if (!bhs[0])
|
||||
goto err;
|
||||
@ -103,6 +105,7 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent,
|
||||
struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops;
|
||||
|
||||
WARN_ON(blocknr < MSDOS_SB(sb)->fat_start);
|
||||
fatent->fat_inode = MSDOS_SB(sb)->fat_inode;
|
||||
fatent->bhs[0] = sb_bread(sb, blocknr);
|
||||
if (!fatent->bhs[0]) {
|
||||
printk(KERN_ERR "FAT: FAT read failed (blocknr %llu)\n",
|
||||
@ -167,9 +170,9 @@ static void fat12_ent_put(struct fat_entry *fatent, int new)
|
||||
}
|
||||
spin_unlock(&fat12_entry_lock);
|
||||
|
||||
mark_buffer_dirty(fatent->bhs[0]);
|
||||
mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode);
|
||||
if (fatent->nr_bhs == 2)
|
||||
mark_buffer_dirty(fatent->bhs[1]);
|
||||
mark_buffer_dirty_inode(fatent->bhs[1], fatent->fat_inode);
|
||||
}
|
||||
|
||||
static void fat16_ent_put(struct fat_entry *fatent, int new)
|
||||
@ -178,7 +181,7 @@ static void fat16_ent_put(struct fat_entry *fatent, int new)
|
||||
new = EOF_FAT16;
|
||||
|
||||
*fatent->u.ent16_p = cpu_to_le16(new);
|
||||
mark_buffer_dirty(fatent->bhs[0]);
|
||||
mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode);
|
||||
}
|
||||
|
||||
static void fat32_ent_put(struct fat_entry *fatent, int new)
|
||||
@ -189,7 +192,7 @@ static void fat32_ent_put(struct fat_entry *fatent, int new)
|
||||
WARN_ON(new & 0xf0000000);
|
||||
new |= le32_to_cpu(*fatent->u.ent32_p) & ~0x0fffffff;
|
||||
*fatent->u.ent32_p = cpu_to_le32(new);
|
||||
mark_buffer_dirty(fatent->bhs[0]);
|
||||
mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode);
|
||||
}
|
||||
|
||||
static int fat12_ent_next(struct fat_entry *fatent)
|
||||
@ -381,7 +384,7 @@ static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs,
|
||||
}
|
||||
memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize);
|
||||
set_buffer_uptodate(c_bh);
|
||||
mark_buffer_dirty(c_bh);
|
||||
mark_buffer_dirty_inode(c_bh, sbi->fat_inode);
|
||||
if (sb->s_flags & MS_SYNCHRONOUS)
|
||||
err = sync_dirty_buffer(c_bh);
|
||||
brelse(c_bh);
|
||||
|
Reference in New Issue
Block a user