diff options
-rw-r--r-- | drivers/char/raw.c | 15 | ||||
-rw-r--r-- | fs/adfs/file.c | 6 | ||||
-rw-r--r-- | fs/affs/file.c | 6 | ||||
-rw-r--r-- | fs/bfs/file.c | 6 | ||||
-rw-r--r-- | fs/block_dev.c | 12 | ||||
-rw-r--r-- | fs/ext2/file.c | 4 | ||||
-rw-r--r-- | fs/fuse/file.c | 6 | ||||
-rw-r--r-- | fs/hfs/inode.c | 6 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 6 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 4 | ||||
-rw-r--r-- | fs/hpfs/file.c | 6 | ||||
-rw-r--r-- | fs/jffs/inode-v23.c | 6 | ||||
-rw-r--r-- | fs/jffs2/file.c | 6 | ||||
-rw-r--r-- | fs/jfs/file.c | 4 | ||||
-rw-r--r-- | fs/minix/file.c | 6 | ||||
-rw-r--r-- | fs/ntfs/file.c | 2 | ||||
-rw-r--r-- | fs/qnx4/file.c | 6 | ||||
-rw-r--r-- | fs/ramfs/file-mmu.c | 6 | ||||
-rw-r--r-- | fs/ramfs/file-nommu.c | 6 | ||||
-rw-r--r-- | fs/read_write.c | 3 | ||||
-rw-r--r-- | fs/smbfs/file.c | 24 | ||||
-rw-r--r-- | fs/sysv/file.c | 6 | ||||
-rw-r--r-- | fs/udf/file.c | 16 | ||||
-rw-r--r-- | fs/ufs/file.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 4 | ||||
-rw-r--r-- | include/linux/fs.h | 5 | ||||
-rw-r--r-- | mm/filemap.c | 87 |
27 files changed, 105 insertions, 165 deletions
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 490db531e2d..89b718e326e 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -238,21 +238,10 @@ out: | |||
238 | return err; | 238 | return err; |
239 | } | 239 | } |
240 | 240 | ||
241 | static ssize_t raw_file_write(struct file *file, const char __user *buf, | ||
242 | size_t count, loff_t *ppos) | ||
243 | { | ||
244 | struct iovec local_iov = { | ||
245 | .iov_base = (char __user *)buf, | ||
246 | .iov_len = count | ||
247 | }; | ||
248 | |||
249 | return generic_file_write_nolock(file, &local_iov, 1, ppos); | ||
250 | } | ||
251 | |||
252 | static const struct file_operations raw_fops = { | 241 | static const struct file_operations raw_fops = { |
253 | .read = generic_file_read, | 242 | .read = do_sync_read, |
254 | .aio_read = generic_file_aio_read, | 243 | .aio_read = generic_file_aio_read, |
255 | .write = raw_file_write, | 244 | .write = do_sync_write, |
256 | .aio_write = generic_file_aio_write_nolock, | 245 | .aio_write = generic_file_aio_write_nolock, |
257 | .open = raw_open, | 246 | .open = raw_open, |
258 | .release= raw_release, | 247 | .release= raw_release, |
diff --git a/fs/adfs/file.c b/fs/adfs/file.c index 1014b9f2117..6101ea679cb 100644 --- a/fs/adfs/file.c +++ b/fs/adfs/file.c | |||
@@ -27,10 +27,12 @@ | |||
27 | 27 | ||
28 | const struct file_operations adfs_file_operations = { | 28 | const struct file_operations adfs_file_operations = { |
29 | .llseek = generic_file_llseek, | 29 | .llseek = generic_file_llseek, |
30 | .read = generic_file_read, | 30 | .read = do_sync_read, |
31 | .aio_read = generic_file_aio_read, | ||
31 | .mmap = generic_file_mmap, | 32 | .mmap = generic_file_mmap, |
32 | .fsync = file_fsync, | 33 | .fsync = file_fsync, |
33 | .write = generic_file_write, | 34 | .write = do_sync_write, |
35 | .aio_write = generic_file_aio_write, | ||
34 | .sendfile = generic_file_sendfile, | 36 | .sendfile = generic_file_sendfile, |
35 | }; | 37 | }; |
36 | 38 | ||
diff --git a/fs/affs/file.c b/fs/affs/file.c index 3de8590e4f6..05b5e22de75 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -27,8 +27,10 @@ static int affs_file_release(struct inode *inode, struct file *filp); | |||
27 | 27 | ||
28 | const struct file_operations affs_file_operations = { | 28 | const struct file_operations affs_file_operations = { |
29 | .llseek = generic_file_llseek, | 29 | .llseek = generic_file_llseek, |
30 | .read = generic_file_read, | 30 | .read = do_sync_read, |
31 | .write = generic_file_write, | 31 | .aio_read = generic_file_aio_read, |
32 | .write = do_sync_write, | ||
33 | .aio_write = generic_file_aio_write, | ||
32 | .mmap = generic_file_mmap, | 34 | .mmap = generic_file_mmap, |
33 | .open = affs_file_open, | 35 | .open = affs_file_open, |
34 | .release = affs_file_release, | 36 | .release = affs_file_release, |
diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 3d5aca28a0a..a9164a87f8d 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c | |||
@@ -19,8 +19,10 @@ | |||
19 | 19 | ||
20 | const struct file_operations bfs_file_operations = { | 20 | const struct file_operations bfs_file_operations = { |
21 | .llseek = generic_file_llseek, | 21 | .llseek = generic_file_llseek, |
22 | .read = generic_file_read, | 22 | .read = do_sync_read, |
23 | .write = generic_file_write, | 23 | .aio_read = generic_file_aio_read, |
24 | .write = do_sync_write, | ||
25 | .aio_write = generic_file_aio_write, | ||
24 | .mmap = generic_file_mmap, | 26 | .mmap = generic_file_mmap, |
25 | .sendfile = generic_file_sendfile, | 27 | .sendfile = generic_file_sendfile, |
26 | }; | 28 | }; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 0f143094ef1..bc8f27cc448 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1154,14 +1154,6 @@ static int blkdev_close(struct inode * inode, struct file * filp) | |||
1154 | return blkdev_put(bdev); | 1154 | return blkdev_put(bdev); |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | static ssize_t blkdev_file_write(struct file *file, const char __user *buf, | ||
1158 | size_t count, loff_t *ppos) | ||
1159 | { | ||
1160 | struct iovec local_iov = { .iov_base = (void __user *)buf, .iov_len = count }; | ||
1161 | |||
1162 | return generic_file_write_nolock(file, &local_iov, 1, ppos); | ||
1163 | } | ||
1164 | |||
1165 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) | 1157 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
1166 | { | 1158 | { |
1167 | return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); | 1159 | return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); |
@@ -1181,8 +1173,8 @@ const struct file_operations def_blk_fops = { | |||
1181 | .open = blkdev_open, | 1173 | .open = blkdev_open, |
1182 | .release = blkdev_close, | 1174 | .release = blkdev_close, |
1183 | .llseek = block_llseek, | 1175 | .llseek = block_llseek, |
1184 | .read = generic_file_read, | 1176 | .read = do_sync_read, |
1185 | .write = blkdev_file_write, | 1177 | .write = do_sync_write, |
1186 | .aio_read = generic_file_aio_read, | 1178 | .aio_read = generic_file_aio_read, |
1187 | .aio_write = generic_file_aio_write_nolock, | 1179 | .aio_write = generic_file_aio_write_nolock, |
1188 | .mmap = generic_file_mmap, | 1180 | .mmap = generic_file_mmap, |
diff --git a/fs/ext2/file.c b/fs/ext2/file.c index e893e2be9ed..2dba473c524 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c | |||
@@ -41,8 +41,8 @@ static int ext2_release_file (struct inode * inode, struct file * filp) | |||
41 | */ | 41 | */ |
42 | const struct file_operations ext2_file_operations = { | 42 | const struct file_operations ext2_file_operations = { |
43 | .llseek = generic_file_llseek, | 43 | .llseek = generic_file_llseek, |
44 | .read = generic_file_read, | 44 | .read = do_sync_read, |
45 | .write = generic_file_write, | 45 | .write = do_sync_write, |
46 | .aio_read = generic_file_aio_read, | 46 | .aio_read = generic_file_aio_read, |
47 | .aio_write = generic_file_aio_write, | 47 | .aio_write = generic_file_aio_write, |
48 | .ioctl = ext2_ioctl, | 48 | .ioctl = ext2_ioctl, |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 5c4fcd1dbf5..183626868ee 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -753,8 +753,10 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl) | |||
753 | 753 | ||
754 | static const struct file_operations fuse_file_operations = { | 754 | static const struct file_operations fuse_file_operations = { |
755 | .llseek = generic_file_llseek, | 755 | .llseek = generic_file_llseek, |
756 | .read = generic_file_read, | 756 | .read = do_sync_read, |
757 | .write = generic_file_write, | 757 | .aio_read = generic_file_aio_read, |
758 | .write = do_sync_write, | ||
759 | .aio_write = generic_file_aio_write, | ||
758 | .mmap = fuse_file_mmap, | 760 | .mmap = fuse_file_mmap, |
759 | .open = fuse_open, | 761 | .open = fuse_open, |
760 | .flush = fuse_flush, | 762 | .flush = fuse_flush, |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index d05641c35fc..02f5573e034 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -601,8 +601,10 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) | |||
601 | 601 | ||
602 | static const struct file_operations hfs_file_operations = { | 602 | static const struct file_operations hfs_file_operations = { |
603 | .llseek = generic_file_llseek, | 603 | .llseek = generic_file_llseek, |
604 | .read = generic_file_read, | 604 | .read = do_sync_read, |
605 | .write = generic_file_write, | 605 | .aio_read = generic_file_aio_read, |
606 | .write = do_sync_write, | ||
607 | .aio_write = generic_file_aio_write, | ||
606 | .mmap = generic_file_mmap, | 608 | .mmap = generic_file_mmap, |
607 | .sendfile = generic_file_sendfile, | 609 | .sendfile = generic_file_sendfile, |
608 | .fsync = file_fsync, | 610 | .fsync = file_fsync, |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 0eb1a609266..9e367524963 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -282,8 +282,10 @@ static struct inode_operations hfsplus_file_inode_operations = { | |||
282 | 282 | ||
283 | static const struct file_operations hfsplus_file_operations = { | 283 | static const struct file_operations hfsplus_file_operations = { |
284 | .llseek = generic_file_llseek, | 284 | .llseek = generic_file_llseek, |
285 | .read = generic_file_read, | 285 | .read = do_sync_read, |
286 | .write = generic_file_write, | 286 | .aio_read = generic_file_aio_read, |
287 | .write = do_sync_write, | ||
288 | .aio_write = generic_file_aio_write, | ||
287 | .mmap = generic_file_mmap, | 289 | .mmap = generic_file_mmap, |
288 | .sendfile = generic_file_sendfile, | 290 | .sendfile = generic_file_sendfile, |
289 | .fsync = file_fsync, | 291 | .fsync = file_fsync, |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 4908c38a588..b6bd33ca373 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -385,11 +385,11 @@ int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
385 | 385 | ||
386 | static const struct file_operations hostfs_file_fops = { | 386 | static const struct file_operations hostfs_file_fops = { |
387 | .llseek = generic_file_llseek, | 387 | .llseek = generic_file_llseek, |
388 | .read = generic_file_read, | 388 | .read = do_sync_read, |
389 | .sendfile = generic_file_sendfile, | 389 | .sendfile = generic_file_sendfile, |
390 | .aio_read = generic_file_aio_read, | 390 | .aio_read = generic_file_aio_read, |
391 | .aio_write = generic_file_aio_write, | 391 | .aio_write = generic_file_aio_write, |
392 | .write = generic_file_write, | 392 | .write = do_sync_write, |
393 | .mmap = generic_file_mmap, | 393 | .mmap = generic_file_mmap, |
394 | .open = hostfs_file_open, | 394 | .open = hostfs_file_open, |
395 | .release = NULL, | 395 | .release = NULL, |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index d9eb19b7b8a..8b94d24855f 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -113,7 +113,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf, | |||
113 | { | 113 | { |
114 | ssize_t retval; | 114 | ssize_t retval; |
115 | 115 | ||
116 | retval = generic_file_write(file, buf, count, ppos); | 116 | retval = do_sync_write(file, buf, count, ppos); |
117 | if (retval > 0) | 117 | if (retval > 0) |
118 | hpfs_i(file->f_dentry->d_inode)->i_dirty = 1; | 118 | hpfs_i(file->f_dentry->d_inode)->i_dirty = 1; |
119 | return retval; | 119 | return retval; |
@@ -122,8 +122,10 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf, | |||
122 | const struct file_operations hpfs_file_ops = | 122 | const struct file_operations hpfs_file_ops = |
123 | { | 123 | { |
124 | .llseek = generic_file_llseek, | 124 | .llseek = generic_file_llseek, |
125 | .read = generic_file_read, | 125 | .read = do_sync_read, |
126 | .aio_read = generic_file_aio_read, | ||
126 | .write = hpfs_file_write, | 127 | .write = hpfs_file_write, |
128 | .aio_write = generic_file_aio_write, | ||
127 | .mmap = generic_file_mmap, | 129 | .mmap = generic_file_mmap, |
128 | .release = hpfs_file_release, | 130 | .release = hpfs_file_release, |
129 | .fsync = hpfs_file_fsync, | 131 | .fsync = hpfs_file_fsync, |
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index f5cf9c93e24..068ef0de8de 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c | |||
@@ -1632,8 +1632,10 @@ static const struct file_operations jffs_file_operations = | |||
1632 | { | 1632 | { |
1633 | .open = generic_file_open, | 1633 | .open = generic_file_open, |
1634 | .llseek = generic_file_llseek, | 1634 | .llseek = generic_file_llseek, |
1635 | .read = generic_file_read, | 1635 | .read = do_sync_read, |
1636 | .write = generic_file_write, | 1636 | .aio_read = generic_file_aio_read, |
1637 | .write = do_sync_write, | ||
1638 | .aio_write = generic_file_aio_write, | ||
1637 | .ioctl = jffs_ioctl, | 1639 | .ioctl = jffs_ioctl, |
1638 | .mmap = generic_file_readonly_mmap, | 1640 | .mmap = generic_file_readonly_mmap, |
1639 | .fsync = jffs_fsync, | 1641 | .fsync = jffs_fsync, |
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 3ed6e3e120b..242875f77cb 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -42,8 +42,10 @@ const struct file_operations jffs2_file_operations = | |||
42 | { | 42 | { |
43 | .llseek = generic_file_llseek, | 43 | .llseek = generic_file_llseek, |
44 | .open = generic_file_open, | 44 | .open = generic_file_open, |
45 | .read = generic_file_read, | 45 | .read = do_sync_read, |
46 | .write = generic_file_write, | 46 | .aio_read = generic_file_aio_read, |
47 | .write = do_sync_write, | ||
48 | .aio_write = generic_file_aio_write, | ||
47 | .ioctl = jffs2_ioctl, | 49 | .ioctl = jffs2_ioctl, |
48 | .mmap = generic_file_readonly_mmap, | 50 | .mmap = generic_file_readonly_mmap, |
49 | .fsync = jffs2_fsync, | 51 | .fsync = jffs2_fsync, |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index f535f2911c1..976e90dc2d1 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -103,8 +103,8 @@ struct inode_operations jfs_file_inode_operations = { | |||
103 | const struct file_operations jfs_file_operations = { | 103 | const struct file_operations jfs_file_operations = { |
104 | .open = jfs_open, | 104 | .open = jfs_open, |
105 | .llseek = generic_file_llseek, | 105 | .llseek = generic_file_llseek, |
106 | .write = generic_file_write, | 106 | .write = do_sync_write, |
107 | .read = generic_file_read, | 107 | .read = do_sync_read, |
108 | .aio_read = generic_file_aio_read, | 108 | .aio_read = generic_file_aio_read, |
109 | .aio_write = generic_file_aio_write, | 109 | .aio_write = generic_file_aio_write, |
110 | .mmap = generic_file_mmap, | 110 | .mmap = generic_file_mmap, |
diff --git a/fs/minix/file.c b/fs/minix/file.c index 420b32882a1..40eac2e60d2 100644 --- a/fs/minix/file.c +++ b/fs/minix/file.c | |||
@@ -17,8 +17,10 @@ int minix_sync_file(struct file *, struct dentry *, int); | |||
17 | 17 | ||
18 | const struct file_operations minix_file_operations = { | 18 | const struct file_operations minix_file_operations = { |
19 | .llseek = generic_file_llseek, | 19 | .llseek = generic_file_llseek, |
20 | .read = generic_file_read, | 20 | .read = do_sync_read, |
21 | .write = generic_file_write, | 21 | .aio_read = generic_file_aio_read, |
22 | .write = do_sync_write, | ||
23 | .aio_write = generic_file_aio_write, | ||
22 | .mmap = generic_file_mmap, | 24 | .mmap = generic_file_mmap, |
23 | .fsync = minix_sync_file, | 25 | .fsync = minix_sync_file, |
24 | .sendfile = generic_file_sendfile, | 26 | .sendfile = generic_file_sendfile, |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 2f9b5a0953f..ae2fe0016d2 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2296,7 +2296,7 @@ static int ntfs_file_fsync(struct file *filp, struct dentry *dentry, | |||
2296 | 2296 | ||
2297 | const struct file_operations ntfs_file_ops = { | 2297 | const struct file_operations ntfs_file_ops = { |
2298 | .llseek = generic_file_llseek, /* Seek inside file. */ | 2298 | .llseek = generic_file_llseek, /* Seek inside file. */ |
2299 | .read = generic_file_read, /* Read from file. */ | 2299 | .read = do_sync_read, /* Read from file. */ |
2300 | .aio_read = generic_file_aio_read, /* Async read from file. */ | 2300 | .aio_read = generic_file_aio_read, /* Async read from file. */ |
2301 | #ifdef NTFS_RW | 2301 | #ifdef NTFS_RW |
2302 | .write = ntfs_file_write, /* Write to file. */ | 2302 | .write = ntfs_file_write, /* Write to file. */ |
diff --git a/fs/qnx4/file.c b/fs/qnx4/file.c index 62af4b1348b..467e5ac7280 100644 --- a/fs/qnx4/file.c +++ b/fs/qnx4/file.c | |||
@@ -22,11 +22,13 @@ | |||
22 | const struct file_operations qnx4_file_operations = | 22 | const struct file_operations qnx4_file_operations = |
23 | { | 23 | { |
24 | .llseek = generic_file_llseek, | 24 | .llseek = generic_file_llseek, |
25 | .read = generic_file_read, | 25 | .read = do_sync_read, |
26 | .aio_read = generic_file_aio_read, | ||
26 | .mmap = generic_file_mmap, | 27 | .mmap = generic_file_mmap, |
27 | .sendfile = generic_file_sendfile, | 28 | .sendfile = generic_file_sendfile, |
28 | #ifdef CONFIG_QNX4FS_RW | 29 | #ifdef CONFIG_QNX4FS_RW |
29 | .write = generic_file_write, | 30 | .write = do_sync_write, |
31 | .aio_write = generic_file_aio_write, | ||
30 | .fsync = qnx4_sync_file, | 32 | .fsync = qnx4_sync_file, |
31 | #endif | 33 | #endif |
32 | }; | 34 | }; |
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c index 86f14cacf64..0947fb57dcf 100644 --- a/fs/ramfs/file-mmu.c +++ b/fs/ramfs/file-mmu.c | |||
@@ -33,8 +33,10 @@ const struct address_space_operations ramfs_aops = { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | const struct file_operations ramfs_file_operations = { | 35 | const struct file_operations ramfs_file_operations = { |
36 | .read = generic_file_read, | 36 | .read = do_sync_read, |
37 | .write = generic_file_write, | 37 | .aio_read = generic_file_aio_read, |
38 | .write = do_sync_write, | ||
39 | .aio_write = generic_file_aio_write, | ||
38 | .mmap = generic_file_mmap, | 40 | .mmap = generic_file_mmap, |
39 | .fsync = simple_sync_file, | 41 | .fsync = simple_sync_file, |
40 | .sendfile = generic_file_sendfile, | 42 | .sendfile = generic_file_sendfile, |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 677139b48e0..bfe5dbf1002 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -36,8 +36,10 @@ const struct address_space_operations ramfs_aops = { | |||
36 | const struct file_operations ramfs_file_operations = { | 36 | const struct file_operations ramfs_file_operations = { |
37 | .mmap = ramfs_nommu_mmap, | 37 | .mmap = ramfs_nommu_mmap, |
38 | .get_unmapped_area = ramfs_nommu_get_unmapped_area, | 38 | .get_unmapped_area = ramfs_nommu_get_unmapped_area, |
39 | .read = generic_file_read, | 39 | .read = do_sync_read, |
40 | .write = generic_file_write, | 40 | .aio_read = generic_file_aio_read, |
41 | .write = do_sync_write, | ||
42 | .aio_write = generic_file_aio_write, | ||
41 | .fsync = simple_sync_file, | 43 | .fsync = simple_sync_file, |
42 | .sendfile = generic_file_sendfile, | 44 | .sendfile = generic_file_sendfile, |
43 | .llseek = generic_file_llseek, | 45 | .llseek = generic_file_llseek, |
diff --git a/fs/read_write.c b/fs/read_write.c index 32d54cca9bd..4ed839bcb91 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -22,7 +22,8 @@ | |||
22 | 22 | ||
23 | const struct file_operations generic_ro_fops = { | 23 | const struct file_operations generic_ro_fops = { |
24 | .llseek = generic_file_llseek, | 24 | .llseek = generic_file_llseek, |
25 | .read = generic_file_read, | 25 | .read = do_sync_read, |
26 | .aio_read = generic_file_aio_read, | ||
26 | .mmap = generic_file_readonly_mmap, | 27 | .mmap = generic_file_readonly_mmap, |
27 | .sendfile = generic_file_sendfile, | 28 | .sendfile = generic_file_sendfile, |
28 | }; | 29 | }; |
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index dae67048bab..50784d13c87 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -214,13 +214,15 @@ smb_updatepage(struct file *file, struct page *page, unsigned long offset, | |||
214 | } | 214 | } |
215 | 215 | ||
216 | static ssize_t | 216 | static ssize_t |
217 | smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) | 217 | smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov, |
218 | unsigned long nr_segs, loff_t pos) | ||
218 | { | 219 | { |
220 | struct file * file = iocb->ki_filp; | ||
219 | struct dentry * dentry = file->f_dentry; | 221 | struct dentry * dentry = file->f_dentry; |
220 | ssize_t status; | 222 | ssize_t status; |
221 | 223 | ||
222 | VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), | 224 | VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), |
223 | (unsigned long) count, (unsigned long) *ppos); | 225 | (unsigned long) iocb->ki_left, (unsigned long) pos); |
224 | 226 | ||
225 | status = smb_revalidate_inode(dentry); | 227 | status = smb_revalidate_inode(dentry); |
226 | if (status) { | 228 | if (status) { |
@@ -233,7 +235,7 @@ smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) | |||
233 | (long)dentry->d_inode->i_size, | 235 | (long)dentry->d_inode->i_size, |
234 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); | 236 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); |
235 | 237 | ||
236 | status = generic_file_read(file, buf, count, ppos); | 238 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); |
237 | out: | 239 | out: |
238 | return status; | 240 | return status; |
239 | } | 241 | } |
@@ -317,14 +319,16 @@ const struct address_space_operations smb_file_aops = { | |||
317 | * Write to a file (through the page cache). | 319 | * Write to a file (through the page cache). |
318 | */ | 320 | */ |
319 | static ssize_t | 321 | static ssize_t |
320 | smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 322 | smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
323 | unsigned long nr_segs, loff_t pos) | ||
321 | { | 324 | { |
325 | struct file * file = iocb->ki_filp; | ||
322 | struct dentry * dentry = file->f_dentry; | 326 | struct dentry * dentry = file->f_dentry; |
323 | ssize_t result; | 327 | ssize_t result; |
324 | 328 | ||
325 | VERBOSE("file %s/%s, count=%lu@%lu\n", | 329 | VERBOSE("file %s/%s, count=%lu@%lu\n", |
326 | DENTRY_PATH(dentry), | 330 | DENTRY_PATH(dentry), |
327 | (unsigned long) count, (unsigned long) *ppos); | 331 | (unsigned long) iocb->ki_left, (unsigned long) pos); |
328 | 332 | ||
329 | result = smb_revalidate_inode(dentry); | 333 | result = smb_revalidate_inode(dentry); |
330 | if (result) { | 334 | if (result) { |
@@ -337,8 +341,8 @@ smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t * | |||
337 | if (result) | 341 | if (result) |
338 | goto out; | 342 | goto out; |
339 | 343 | ||
340 | if (count > 0) { | 344 | if (iocb->ki_left > 0) { |
341 | result = generic_file_write(file, buf, count, ppos); | 345 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
342 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", | 346 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", |
343 | (long) file->f_pos, (long) dentry->d_inode->i_size, | 347 | (long) file->f_pos, (long) dentry->d_inode->i_size, |
344 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); | 348 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); |
@@ -402,8 +406,10 @@ smb_file_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
402 | const struct file_operations smb_file_operations = | 406 | const struct file_operations smb_file_operations = |
403 | { | 407 | { |
404 | .llseek = remote_llseek, | 408 | .llseek = remote_llseek, |
405 | .read = smb_file_read, | 409 | .read = do_sync_read, |
406 | .write = smb_file_write, | 410 | .aio_read = smb_file_aio_read, |
411 | .write = do_sync_write, | ||
412 | .aio_write = smb_file_aio_write, | ||
407 | .ioctl = smb_ioctl, | 413 | .ioctl = smb_ioctl, |
408 | .mmap = smb_file_mmap, | 414 | .mmap = smb_file_mmap, |
409 | .open = smb_file_open, | 415 | .open = smb_file_open, |
diff --git a/fs/sysv/file.c b/fs/sysv/file.c index a59e303135f..47a4b728f15 100644 --- a/fs/sysv/file.c +++ b/fs/sysv/file.c | |||
@@ -21,8 +21,10 @@ | |||
21 | */ | 21 | */ |
22 | const struct file_operations sysv_file_operations = { | 22 | const struct file_operations sysv_file_operations = { |
23 | .llseek = generic_file_llseek, | 23 | .llseek = generic_file_llseek, |
24 | .read = generic_file_read, | 24 | .read = do_sync_read, |
25 | .write = generic_file_write, | 25 | .aio_read = generic_file_aio_read, |
26 | .write = do_sync_write, | ||
27 | .aio_write = generic_file_aio_write, | ||
26 | .mmap = generic_file_mmap, | 28 | .mmap = generic_file_mmap, |
27 | .fsync = sysv_sync_file, | 29 | .fsync = sysv_sync_file, |
28 | .sendfile = generic_file_sendfile, | 30 | .sendfile = generic_file_sendfile, |
diff --git a/fs/udf/file.c b/fs/udf/file.c index a59e5f33daf..7aedd552cba 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -103,19 +103,21 @@ const struct address_space_operations udf_adinicb_aops = { | |||
103 | .commit_write = udf_adinicb_commit_write, | 103 | .commit_write = udf_adinicb_commit_write, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | static ssize_t udf_file_write(struct file * file, const char __user * buf, | 106 | static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
107 | size_t count, loff_t *ppos) | 107 | unsigned long nr_segs, loff_t ppos) |
108 | { | 108 | { |
109 | ssize_t retval; | 109 | ssize_t retval; |
110 | struct file *file = iocb->ki_filp; | ||
110 | struct inode *inode = file->f_dentry->d_inode; | 111 | struct inode *inode = file->f_dentry->d_inode; |
111 | int err, pos; | 112 | int err, pos; |
113 | size_t count = iocb->ki_left; | ||
112 | 114 | ||
113 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) | 115 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) |
114 | { | 116 | { |
115 | if (file->f_flags & O_APPEND) | 117 | if (file->f_flags & O_APPEND) |
116 | pos = inode->i_size; | 118 | pos = inode->i_size; |
117 | else | 119 | else |
118 | pos = *ppos; | 120 | pos = ppos; |
119 | 121 | ||
120 | if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + | 122 | if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + |
121 | pos + count)) | 123 | pos + count)) |
@@ -136,7 +138,7 @@ static ssize_t udf_file_write(struct file * file, const char __user * buf, | |||
136 | } | 138 | } |
137 | } | 139 | } |
138 | 140 | ||
139 | retval = generic_file_write(file, buf, count, ppos); | 141 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); |
140 | 142 | ||
141 | if (retval > 0) | 143 | if (retval > 0) |
142 | mark_inode_dirty(inode); | 144 | mark_inode_dirty(inode); |
@@ -249,11 +251,13 @@ static int udf_release_file(struct inode * inode, struct file * filp) | |||
249 | } | 251 | } |
250 | 252 | ||
251 | const struct file_operations udf_file_operations = { | 253 | const struct file_operations udf_file_operations = { |
252 | .read = generic_file_read, | 254 | .read = do_sync_read, |
255 | .aio_read = generic_file_aio_read, | ||
253 | .ioctl = udf_ioctl, | 256 | .ioctl = udf_ioctl, |
254 | .open = generic_file_open, | 257 | .open = generic_file_open, |
255 | .mmap = generic_file_mmap, | 258 | .mmap = generic_file_mmap, |
256 | .write = udf_file_write, | 259 | .write = do_sync_write, |
260 | .aio_write = udf_file_aio_write, | ||
257 | .release = udf_release_file, | 261 | .release = udf_release_file, |
258 | .fsync = udf_fsync_file, | 262 | .fsync = udf_fsync_file, |
259 | .sendfile = generic_file_sendfile, | 263 | .sendfile = generic_file_sendfile, |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index a9c6e5f04fa..1e096323bad 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -53,8 +53,10 @@ static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
53 | 53 | ||
54 | const struct file_operations ufs_file_operations = { | 54 | const struct file_operations ufs_file_operations = { |
55 | .llseek = generic_file_llseek, | 55 | .llseek = generic_file_llseek, |
56 | .read = generic_file_read, | 56 | .read = do_sync_read, |
57 | .write = generic_file_write, | 57 | .aio_read = generic_file_aio_read, |
58 | .write = do_sync_write, | ||
59 | .aio_write = generic_file_aio_write, | ||
58 | .mmap = generic_file_mmap, | 60 | .mmap = generic_file_mmap, |
59 | .open = generic_file_open, | 61 | .open = generic_file_open, |
60 | .fsync = ufs_sync_file, | 62 | .fsync = ufs_sync_file, |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 55992b40353..fa842f1c9fa 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -279,7 +279,9 @@ xfs_read( | |||
279 | 279 | ||
280 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, | 280 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, |
281 | (void *)iovp, segs, *offset, ioflags); | 281 | (void *)iovp, segs, *offset, ioflags); |
282 | ret = __generic_file_aio_read(iocb, iovp, segs, offset); | 282 | |
283 | iocb->ki_pos = *offset; | ||
284 | ret = generic_file_aio_read(iocb, iovp, segs, *offset); | ||
283 | if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO)) | 285 | if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO)) |
284 | ret = wait_on_sync_kiocb(iocb); | 286 | ret = wait_on_sync_kiocb(iocb); |
285 | if (ret > 0) | 287 | if (ret > 0) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index afb6e6f89a0..011129f8803 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1699,11 +1699,8 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *); | |||
1699 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); | 1699 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); |
1700 | extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); | 1700 | extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); |
1701 | extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); | 1701 | extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); |
1702 | extern ssize_t generic_file_read(struct file *, char __user *, size_t, loff_t *); | ||
1703 | int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); | 1702 | int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); |
1704 | extern ssize_t generic_file_write(struct file *, const char __user *, size_t, loff_t *); | ||
1705 | extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1703 | extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); |
1706 | extern ssize_t __generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t *); | ||
1707 | extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1704 | extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); |
1708 | extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *, | 1705 | extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *, |
1709 | unsigned long, loff_t); | 1706 | unsigned long, loff_t); |
@@ -1713,8 +1710,6 @@ extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, | |||
1713 | unsigned long, loff_t, loff_t *, size_t, ssize_t); | 1710 | unsigned long, loff_t, loff_t *, size_t, ssize_t); |
1714 | extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); | 1711 | extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); |
1715 | extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); | 1712 | extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); |
1716 | ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov, | ||
1717 | unsigned long nr_segs, loff_t *ppos); | ||
1718 | extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); | 1713 | extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); |
1719 | extern void do_generic_mapping_read(struct address_space *mapping, | 1714 | extern void do_generic_mapping_read(struct address_space *mapping, |
1720 | struct file_ra_state *, struct file *, | 1715 | struct file_ra_state *, struct file *, |
diff --git a/mm/filemap.c b/mm/filemap.c index 48497094ae8..ec469235985 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1149,13 +1149,14 @@ success: | |||
1149 | * that can use the page cache directly. | 1149 | * that can use the page cache directly. |
1150 | */ | 1150 | */ |
1151 | ssize_t | 1151 | ssize_t |
1152 | __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | 1152 | generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, |
1153 | unsigned long nr_segs, loff_t *ppos) | 1153 | unsigned long nr_segs, loff_t pos) |
1154 | { | 1154 | { |
1155 | struct file *filp = iocb->ki_filp; | 1155 | struct file *filp = iocb->ki_filp; |
1156 | ssize_t retval; | 1156 | ssize_t retval; |
1157 | unsigned long seg; | 1157 | unsigned long seg; |
1158 | size_t count; | 1158 | size_t count; |
1159 | loff_t *ppos = &iocb->ki_pos; | ||
1159 | 1160 | ||
1160 | count = 0; | 1161 | count = 0; |
1161 | for (seg = 0; seg < nr_segs; seg++) { | 1162 | for (seg = 0; seg < nr_segs; seg++) { |
@@ -1179,7 +1180,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1179 | 1180 | ||
1180 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ | 1181 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ |
1181 | if (filp->f_flags & O_DIRECT) { | 1182 | if (filp->f_flags & O_DIRECT) { |
1182 | loff_t pos = *ppos, size; | 1183 | loff_t size; |
1183 | struct address_space *mapping; | 1184 | struct address_space *mapping; |
1184 | struct inode *inode; | 1185 | struct inode *inode; |
1185 | 1186 | ||
@@ -1223,32 +1224,8 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1223 | out: | 1224 | out: |
1224 | return retval; | 1225 | return retval; |
1225 | } | 1226 | } |
1226 | EXPORT_SYMBOL(__generic_file_aio_read); | ||
1227 | |||
1228 | ssize_t | ||
1229 | generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | ||
1230 | unsigned long nr_segs, loff_t pos) | ||
1231 | { | ||
1232 | BUG_ON(iocb->ki_pos != pos); | ||
1233 | return __generic_file_aio_read(iocb, iov, nr_segs, &iocb->ki_pos); | ||
1234 | } | ||
1235 | EXPORT_SYMBOL(generic_file_aio_read); | 1227 | EXPORT_SYMBOL(generic_file_aio_read); |
1236 | 1228 | ||
1237 | ssize_t | ||
1238 | generic_file_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | ||
1239 | { | ||
1240 | struct iovec local_iov = { .iov_base = buf, .iov_len = count }; | ||
1241 | struct kiocb kiocb; | ||
1242 | ssize_t ret; | ||
1243 | |||
1244 | init_sync_kiocb(&kiocb, filp); | ||
1245 | ret = __generic_file_aio_read(&kiocb, &local_iov, 1, ppos); | ||
1246 | if (-EIOCBQUEUED == ret) | ||
1247 | ret = wait_on_sync_kiocb(&kiocb); | ||
1248 | return ret; | ||
1249 | } | ||
1250 | EXPORT_SYMBOL(generic_file_read); | ||
1251 | |||
1252 | int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size) | 1229 | int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size) |
1253 | { | 1230 | { |
1254 | ssize_t written; | 1231 | ssize_t written; |
@@ -2339,38 +2316,6 @@ ssize_t generic_file_aio_write_nolock(struct kiocb *iocb, | |||
2339 | } | 2316 | } |
2340 | EXPORT_SYMBOL(generic_file_aio_write_nolock); | 2317 | EXPORT_SYMBOL(generic_file_aio_write_nolock); |
2341 | 2318 | ||
2342 | static ssize_t | ||
2343 | __generic_file_write_nolock(struct file *file, const struct iovec *iov, | ||
2344 | unsigned long nr_segs, loff_t *ppos) | ||
2345 | { | ||
2346 | struct kiocb kiocb; | ||
2347 | ssize_t ret; | ||
2348 | |||
2349 | init_sync_kiocb(&kiocb, file); | ||
2350 | kiocb.ki_pos = *ppos; | ||
2351 | ret = __generic_file_aio_write_nolock(&kiocb, iov, nr_segs, ppos); | ||
2352 | if (-EIOCBQUEUED == ret) | ||
2353 | ret = wait_on_sync_kiocb(&kiocb); | ||
2354 | return ret; | ||
2355 | } | ||
2356 | |||
2357 | ssize_t | ||
2358 | generic_file_write_nolock(struct file *file, const struct iovec *iov, | ||
2359 | unsigned long nr_segs, loff_t *ppos) | ||
2360 | { | ||
2361 | struct kiocb kiocb; | ||
2362 | ssize_t ret; | ||
2363 | |||
2364 | init_sync_kiocb(&kiocb, file); | ||
2365 | kiocb.ki_pos = *ppos; | ||
2366 | ret = generic_file_aio_write_nolock(&kiocb, iov, nr_segs, *ppos); | ||
2367 | if (-EIOCBQUEUED == ret) | ||
2368 | ret = wait_on_sync_kiocb(&kiocb); | ||
2369 | *ppos = kiocb.ki_pos; | ||
2370 | return ret; | ||
2371 | } | ||
2372 | EXPORT_SYMBOL(generic_file_write_nolock); | ||
2373 | |||
2374 | ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2319 | ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
2375 | unsigned long nr_segs, loff_t pos) | 2320 | unsigned long nr_segs, loff_t pos) |
2376 | { | 2321 | { |
@@ -2397,30 +2342,6 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2397 | } | 2342 | } |
2398 | EXPORT_SYMBOL(generic_file_aio_write); | 2343 | EXPORT_SYMBOL(generic_file_aio_write); |
2399 | 2344 | ||
2400 | ssize_t generic_file_write(struct file *file, const char __user *buf, | ||
2401 | size_t count, loff_t *ppos) | ||
2402 | { | ||
2403 | struct address_space *mapping = file->f_mapping; | ||
2404 | struct inode *inode = mapping->host; | ||
2405 | ssize_t ret; | ||
2406 | struct iovec local_iov = { .iov_base = (void __user *)buf, | ||
2407 | .iov_len = count }; | ||
2408 | |||
2409 | mutex_lock(&inode->i_mutex); | ||
2410 | ret = __generic_file_write_nolock(file, &local_iov, 1, ppos); | ||
2411 | mutex_unlock(&inode->i_mutex); | ||
2412 | |||
2413 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | ||
2414 | ssize_t err; | ||
2415 | |||
2416 | err = sync_page_range(inode, mapping, *ppos - ret, ret); | ||
2417 | if (err < 0) | ||
2418 | ret = err; | ||
2419 | } | ||
2420 | return ret; | ||
2421 | } | ||
2422 | EXPORT_SYMBOL(generic_file_write); | ||
2423 | |||
2424 | /* | 2345 | /* |
2425 | * Called under i_mutex for writes to S_ISREG files. Returns -EIO if something | 2346 | * Called under i_mutex for writes to S_ISREG files. Returns -EIO if something |
2426 | * went wrong during pagecache shootdown. | 2347 | * went wrong during pagecache shootdown. |