aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r--fs/fat/file.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 1ee25232e6af..f4b8f8b3fbdd 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -13,6 +13,7 @@
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/writeback.h> 15#include <linux/writeback.h>
16#include <linux/blkdev.h>
16 17
17int fat_generic_ioctl(struct inode *inode, struct file *filp, 18int fat_generic_ioctl(struct inode *inode, struct file *filp,
18 unsigned int cmd, unsigned long arg) 19 unsigned int cmd, unsigned long arg)
@@ -112,15 +113,24 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
112 } 113 }
113} 114}
114 115
116static int fat_file_release(struct inode *inode, struct file *filp)
117{
118 if ((filp->f_mode & FMODE_WRITE) &&
119 MSDOS_SB(inode->i_sb)->options.flush) {
120 fat_flush_inodes(inode->i_sb, inode, NULL);
121 blk_congestion_wait(WRITE, HZ/10);
122 }
123 return 0;
124}
125
115const struct file_operations fat_file_operations = { 126const struct file_operations fat_file_operations = {
116 .llseek = generic_file_llseek, 127 .llseek = generic_file_llseek,
117 .read = do_sync_read, 128 .read = do_sync_read,
118 .write = do_sync_write, 129 .write = do_sync_write,
119 .readv = generic_file_readv,
120 .writev = generic_file_writev,
121 .aio_read = generic_file_aio_read, 130 .aio_read = generic_file_aio_read,
122 .aio_write = generic_file_aio_write, 131 .aio_write = generic_file_aio_write,
123 .mmap = generic_file_mmap, 132 .mmap = generic_file_mmap,
133 .release = fat_file_release,
124 .ioctl = fat_generic_ioctl, 134 .ioctl = fat_generic_ioctl,
125 .fsync = file_fsync, 135 .fsync = file_fsync,
126 .sendfile = generic_file_sendfile, 136 .sendfile = generic_file_sendfile,
@@ -289,6 +299,7 @@ void fat_truncate(struct inode *inode)
289 lock_kernel(); 299 lock_kernel();
290 fat_free(inode, nr_clusters); 300 fat_free(inode, nr_clusters);
291 unlock_kernel(); 301 unlock_kernel();
302 fat_flush_inodes(inode->i_sb, inode, NULL);
292} 303}
293 304
294struct inode_operations fat_file_inode_operations = { 305struct inode_operations fat_file_inode_operations = {