diff options
Diffstat (limited to 'fs/fat/fatent.c')
-rw-r--r-- | fs/fat/fatent.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index da6eea47872f..a81037721a6f 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
@@ -73,6 +73,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent, | |||
73 | struct buffer_head **bhs = fatent->bhs; | 73 | struct buffer_head **bhs = fatent->bhs; |
74 | 74 | ||
75 | WARN_ON(blocknr < MSDOS_SB(sb)->fat_start); | 75 | WARN_ON(blocknr < MSDOS_SB(sb)->fat_start); |
76 | fatent->fat_inode = MSDOS_SB(sb)->fat_inode; | ||
77 | |||
76 | bhs[0] = sb_bread(sb, blocknr); | 78 | bhs[0] = sb_bread(sb, blocknr); |
77 | if (!bhs[0]) | 79 | if (!bhs[0]) |
78 | goto err; | 80 | goto err; |
@@ -103,6 +105,7 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent, | |||
103 | struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; | 105 | struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; |
104 | 106 | ||
105 | WARN_ON(blocknr < MSDOS_SB(sb)->fat_start); | 107 | WARN_ON(blocknr < MSDOS_SB(sb)->fat_start); |
108 | fatent->fat_inode = MSDOS_SB(sb)->fat_inode; | ||
106 | fatent->bhs[0] = sb_bread(sb, blocknr); | 109 | fatent->bhs[0] = sb_bread(sb, blocknr); |
107 | if (!fatent->bhs[0]) { | 110 | if (!fatent->bhs[0]) { |
108 | printk(KERN_ERR "FAT: FAT read failed (blocknr %llu)\n", | 111 | 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) | |||
167 | } | 170 | } |
168 | spin_unlock(&fat12_entry_lock); | 171 | spin_unlock(&fat12_entry_lock); |
169 | 172 | ||
170 | mark_buffer_dirty(fatent->bhs[0]); | 173 | mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode); |
171 | if (fatent->nr_bhs == 2) | 174 | if (fatent->nr_bhs == 2) |
172 | mark_buffer_dirty(fatent->bhs[1]); | 175 | mark_buffer_dirty_inode(fatent->bhs[1], fatent->fat_inode); |
173 | } | 176 | } |
174 | 177 | ||
175 | static void fat16_ent_put(struct fat_entry *fatent, int new) | 178 | 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) | |||
178 | new = EOF_FAT16; | 181 | new = EOF_FAT16; |
179 | 182 | ||
180 | *fatent->u.ent16_p = cpu_to_le16(new); | 183 | *fatent->u.ent16_p = cpu_to_le16(new); |
181 | mark_buffer_dirty(fatent->bhs[0]); | 184 | mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode); |
182 | } | 185 | } |
183 | 186 | ||
184 | static void fat32_ent_put(struct fat_entry *fatent, int new) | 187 | 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) | |||
189 | WARN_ON(new & 0xf0000000); | 192 | WARN_ON(new & 0xf0000000); |
190 | new |= le32_to_cpu(*fatent->u.ent32_p) & ~0x0fffffff; | 193 | new |= le32_to_cpu(*fatent->u.ent32_p) & ~0x0fffffff; |
191 | *fatent->u.ent32_p = cpu_to_le32(new); | 194 | *fatent->u.ent32_p = cpu_to_le32(new); |
192 | mark_buffer_dirty(fatent->bhs[0]); | 195 | mark_buffer_dirty_inode(fatent->bhs[0], fatent->fat_inode); |
193 | } | 196 | } |
194 | 197 | ||
195 | static int fat12_ent_next(struct fat_entry *fatent) | 198 | static int fat12_ent_next(struct fat_entry *fatent) |
@@ -345,7 +348,7 @@ int fat_ent_read(struct inode *inode, struct fat_entry *fatent, int entry) | |||
345 | 348 | ||
346 | if (entry < FAT_START_ENT || sbi->max_cluster <= entry) { | 349 | if (entry < FAT_START_ENT || sbi->max_cluster <= entry) { |
347 | fatent_brelse(fatent); | 350 | fatent_brelse(fatent); |
348 | fat_fs_panic(sb, "invalid access to FAT (entry 0x%08x)", entry); | 351 | fat_fs_error(sb, "invalid access to FAT (entry 0x%08x)", entry); |
349 | return -EIO; | 352 | return -EIO; |
350 | } | 353 | } |
351 | 354 | ||
@@ -381,7 +384,7 @@ static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs, | |||
381 | } | 384 | } |
382 | memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize); | 385 | memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize); |
383 | set_buffer_uptodate(c_bh); | 386 | set_buffer_uptodate(c_bh); |
384 | mark_buffer_dirty(c_bh); | 387 | mark_buffer_dirty_inode(c_bh, sbi->fat_inode); |
385 | if (sb->s_flags & MS_SYNCHRONOUS) | 388 | if (sb->s_flags & MS_SYNCHRONOUS) |
386 | err = sync_dirty_buffer(c_bh); | 389 | err = sync_dirty_buffer(c_bh); |
387 | brelse(c_bh); | 390 | brelse(c_bh); |
@@ -557,7 +560,7 @@ int fat_free_clusters(struct inode *inode, int cluster) | |||
557 | err = cluster; | 560 | err = cluster; |
558 | goto error; | 561 | goto error; |
559 | } else if (cluster == FAT_ENT_FREE) { | 562 | } else if (cluster == FAT_ENT_FREE) { |
560 | fat_fs_panic(sb, "%s: deleting FAT entry beyond EOF", | 563 | fat_fs_error(sb, "%s: deleting FAT entry beyond EOF", |
561 | __func__); | 564 | __func__); |
562 | err = -EIO; | 565 | err = -EIO; |
563 | goto error; | 566 | goto error; |