diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-09 00:00:30 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-09 00:01:38 -0400 |
commit | 237dae889051ed4ebf438b08ca6c0e7c54b97774 (patch) | |
tree | 0cbd9882d28f19875f5c1daf1698edaac985de0f /fs | |
parent | 7abccdba25be45630eede85053496f1f48d36ec8 (diff) | |
parent | e2e40f2c1ed433c5e224525c8c862fd32e5d3df2 (diff) |
Merge branch 'iocb' into for-davem
trivial conflict in net/socket.c and non-trivial one in crypto -
that one had evaded aio_complete() removal.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
45 files changed, 155 insertions, 170 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index eb14e055ea83..ff1a5bac4200 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
34 | #include <linux/idr.h> | 34 | #include <linux/idr.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/aio.h> | 36 | #include <linux/uio.h> |
37 | #include <net/9p/9p.h> | 37 | #include <net/9p/9p.h> |
38 | #include <net/9p/client.h> | 38 | #include <net/9p/client.h> |
39 | 39 | ||
diff --git a/fs/affs/file.c b/fs/affs/file.c index a91795e01a7f..3aa7eb66547e 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * affs regular file handling primitives | 12 | * affs regular file handling primitives |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/aio.h> | 15 | #include <linux/uio.h> |
16 | #include "affs.h" | 16 | #include "affs.h" |
17 | 17 | ||
18 | static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); | 18 | static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); |
diff --git a/fs/afs/write.c b/fs/afs/write.c index c13cb08964ed..0714abcd7f32 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
15 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
16 | #include <linux/pagevec.h> | 16 | #include <linux/pagevec.h> |
17 | #include <linux/aio.h> | ||
18 | #include "internal.h" | 17 | #include "internal.h" |
19 | 18 | ||
20 | static int afs_write_back_from_locked_page(struct afs_writeback *wb, | 19 | static int afs_write_back_from_locked_page(struct afs_writeback *wb, |
@@ -151,6 +151,38 @@ struct kioctx { | |||
151 | unsigned id; | 151 | unsigned id; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | /* | ||
155 | * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either | ||
156 | * cancelled or completed (this makes a certain amount of sense because | ||
157 | * successful cancellation - io_cancel() - does deliver the completion to | ||
158 | * userspace). | ||
159 | * | ||
160 | * And since most things don't implement kiocb cancellation and we'd really like | ||
161 | * kiocb completion to be lockless when possible, we use ki_cancel to | ||
162 | * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED | ||
163 | * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel(). | ||
164 | */ | ||
165 | #define KIOCB_CANCELLED ((void *) (~0ULL)) | ||
166 | |||
167 | struct aio_kiocb { | ||
168 | struct kiocb common; | ||
169 | |||
170 | struct kioctx *ki_ctx; | ||
171 | kiocb_cancel_fn *ki_cancel; | ||
172 | |||
173 | struct iocb __user *ki_user_iocb; /* user's aiocb */ | ||
174 | __u64 ki_user_data; /* user's data for completion */ | ||
175 | |||
176 | struct list_head ki_list; /* the aio core uses this | ||
177 | * for cancellation */ | ||
178 | |||
179 | /* | ||
180 | * If the aio_resfd field of the userspace iocb is not zero, | ||
181 | * this is the underlying eventfd context to deliver events to. | ||
182 | */ | ||
183 | struct eventfd_ctx *ki_eventfd; | ||
184 | }; | ||
185 | |||
154 | /*------ sysctl variables----*/ | 186 | /*------ sysctl variables----*/ |
155 | static DEFINE_SPINLOCK(aio_nr_lock); | 187 | static DEFINE_SPINLOCK(aio_nr_lock); |
156 | unsigned long aio_nr; /* current system wide number of aio requests */ | 188 | unsigned long aio_nr; /* current system wide number of aio requests */ |
@@ -220,7 +252,7 @@ static int __init aio_setup(void) | |||
220 | if (IS_ERR(aio_mnt)) | 252 | if (IS_ERR(aio_mnt)) |
221 | panic("Failed to create aio fs mount."); | 253 | panic("Failed to create aio fs mount."); |
222 | 254 | ||
223 | kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); | 255 | kiocb_cachep = KMEM_CACHE(aio_kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); |
224 | kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); | 256 | kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); |
225 | 257 | ||
226 | pr_debug("sizeof(struct page) = %zu\n", sizeof(struct page)); | 258 | pr_debug("sizeof(struct page) = %zu\n", sizeof(struct page)); |
@@ -480,8 +512,9 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
480 | #define AIO_EVENTS_FIRST_PAGE ((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event)) | 512 | #define AIO_EVENTS_FIRST_PAGE ((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event)) |
481 | #define AIO_EVENTS_OFFSET (AIO_EVENTS_PER_PAGE - AIO_EVENTS_FIRST_PAGE) | 513 | #define AIO_EVENTS_OFFSET (AIO_EVENTS_PER_PAGE - AIO_EVENTS_FIRST_PAGE) |
482 | 514 | ||
483 | void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel) | 515 | void kiocb_set_cancel_fn(struct kiocb *iocb, kiocb_cancel_fn *cancel) |
484 | { | 516 | { |
517 | struct aio_kiocb *req = container_of(iocb, struct aio_kiocb, common); | ||
485 | struct kioctx *ctx = req->ki_ctx; | 518 | struct kioctx *ctx = req->ki_ctx; |
486 | unsigned long flags; | 519 | unsigned long flags; |
487 | 520 | ||
@@ -496,7 +529,7 @@ void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel) | |||
496 | } | 529 | } |
497 | EXPORT_SYMBOL(kiocb_set_cancel_fn); | 530 | EXPORT_SYMBOL(kiocb_set_cancel_fn); |
498 | 531 | ||
499 | static int kiocb_cancel(struct kiocb *kiocb) | 532 | static int kiocb_cancel(struct aio_kiocb *kiocb) |
500 | { | 533 | { |
501 | kiocb_cancel_fn *old, *cancel; | 534 | kiocb_cancel_fn *old, *cancel; |
502 | 535 | ||
@@ -514,7 +547,7 @@ static int kiocb_cancel(struct kiocb *kiocb) | |||
514 | cancel = cmpxchg(&kiocb->ki_cancel, old, KIOCB_CANCELLED); | 547 | cancel = cmpxchg(&kiocb->ki_cancel, old, KIOCB_CANCELLED); |
515 | } while (cancel != old); | 548 | } while (cancel != old); |
516 | 549 | ||
517 | return cancel(kiocb); | 550 | return cancel(&kiocb->common); |
518 | } | 551 | } |
519 | 552 | ||
520 | static void free_ioctx(struct work_struct *work) | 553 | static void free_ioctx(struct work_struct *work) |
@@ -550,13 +583,13 @@ static void free_ioctx_reqs(struct percpu_ref *ref) | |||
550 | static void free_ioctx_users(struct percpu_ref *ref) | 583 | static void free_ioctx_users(struct percpu_ref *ref) |
551 | { | 584 | { |
552 | struct kioctx *ctx = container_of(ref, struct kioctx, users); | 585 | struct kioctx *ctx = container_of(ref, struct kioctx, users); |
553 | struct kiocb *req; | 586 | struct aio_kiocb *req; |
554 | 587 | ||
555 | spin_lock_irq(&ctx->ctx_lock); | 588 | spin_lock_irq(&ctx->ctx_lock); |
556 | 589 | ||
557 | while (!list_empty(&ctx->active_reqs)) { | 590 | while (!list_empty(&ctx->active_reqs)) { |
558 | req = list_first_entry(&ctx->active_reqs, | 591 | req = list_first_entry(&ctx->active_reqs, |
559 | struct kiocb, ki_list); | 592 | struct aio_kiocb, ki_list); |
560 | 593 | ||
561 | list_del_init(&req->ki_list); | 594 | list_del_init(&req->ki_list); |
562 | kiocb_cancel(req); | 595 | kiocb_cancel(req); |
@@ -778,22 +811,6 @@ static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx, | |||
778 | return 0; | 811 | return 0; |
779 | } | 812 | } |
780 | 813 | ||
781 | /* wait_on_sync_kiocb: | ||
782 | * Waits on the given sync kiocb to complete. | ||
783 | */ | ||
784 | ssize_t wait_on_sync_kiocb(struct kiocb *req) | ||
785 | { | ||
786 | while (!req->ki_ctx) { | ||
787 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
788 | if (req->ki_ctx) | ||
789 | break; | ||
790 | io_schedule(); | ||
791 | } | ||
792 | __set_current_state(TASK_RUNNING); | ||
793 | return req->ki_user_data; | ||
794 | } | ||
795 | EXPORT_SYMBOL(wait_on_sync_kiocb); | ||
796 | |||
797 | /* | 814 | /* |
798 | * exit_aio: called when the last user of mm goes away. At this point, there is | 815 | * exit_aio: called when the last user of mm goes away. At this point, there is |
799 | * no way for any new requests to be submited or any of the io_* syscalls to be | 816 | * no way for any new requests to be submited or any of the io_* syscalls to be |
@@ -948,9 +965,9 @@ static void user_refill_reqs_available(struct kioctx *ctx) | |||
948 | * Allocate a slot for an aio request. | 965 | * Allocate a slot for an aio request. |
949 | * Returns NULL if no requests are free. | 966 | * Returns NULL if no requests are free. |
950 | */ | 967 | */ |
951 | static inline struct kiocb *aio_get_req(struct kioctx *ctx) | 968 | static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx) |
952 | { | 969 | { |
953 | struct kiocb *req; | 970 | struct aio_kiocb *req; |
954 | 971 | ||
955 | if (!get_reqs_available(ctx)) { | 972 | if (!get_reqs_available(ctx)) { |
956 | user_refill_reqs_available(ctx); | 973 | user_refill_reqs_available(ctx); |
@@ -971,10 +988,10 @@ out_put: | |||
971 | return NULL; | 988 | return NULL; |
972 | } | 989 | } |
973 | 990 | ||
974 | static void kiocb_free(struct kiocb *req) | 991 | static void kiocb_free(struct aio_kiocb *req) |
975 | { | 992 | { |
976 | if (req->ki_filp) | 993 | if (req->common.ki_filp) |
977 | fput(req->ki_filp); | 994 | fput(req->common.ki_filp); |
978 | if (req->ki_eventfd != NULL) | 995 | if (req->ki_eventfd != NULL) |
979 | eventfd_ctx_put(req->ki_eventfd); | 996 | eventfd_ctx_put(req->ki_eventfd); |
980 | kmem_cache_free(kiocb_cachep, req); | 997 | kmem_cache_free(kiocb_cachep, req); |
@@ -1010,8 +1027,9 @@ out: | |||
1010 | /* aio_complete | 1027 | /* aio_complete |
1011 | * Called when the io request on the given iocb is complete. | 1028 | * Called when the io request on the given iocb is complete. |
1012 | */ | 1029 | */ |
1013 | void aio_complete(struct kiocb *iocb, long res, long res2) | 1030 | static void aio_complete(struct kiocb *kiocb, long res, long res2) |
1014 | { | 1031 | { |
1032 | struct aio_kiocb *iocb = container_of(kiocb, struct aio_kiocb, common); | ||
1015 | struct kioctx *ctx = iocb->ki_ctx; | 1033 | struct kioctx *ctx = iocb->ki_ctx; |
1016 | struct aio_ring *ring; | 1034 | struct aio_ring *ring; |
1017 | struct io_event *ev_page, *event; | 1035 | struct io_event *ev_page, *event; |
@@ -1025,13 +1043,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1025 | * ref, no other paths have a way to get another ref | 1043 | * ref, no other paths have a way to get another ref |
1026 | * - the sync task helpfully left a reference to itself in the iocb | 1044 | * - the sync task helpfully left a reference to itself in the iocb |
1027 | */ | 1045 | */ |
1028 | if (is_sync_kiocb(iocb)) { | 1046 | BUG_ON(is_sync_kiocb(kiocb)); |
1029 | iocb->ki_user_data = res; | ||
1030 | smp_wmb(); | ||
1031 | iocb->ki_ctx = ERR_PTR(-EXDEV); | ||
1032 | wake_up_process(iocb->ki_obj.tsk); | ||
1033 | return; | ||
1034 | } | ||
1035 | 1047 | ||
1036 | if (iocb->ki_list.next) { | 1048 | if (iocb->ki_list.next) { |
1037 | unsigned long flags; | 1049 | unsigned long flags; |
@@ -1057,7 +1069,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1057 | ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); | 1069 | ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); |
1058 | event = ev_page + pos % AIO_EVENTS_PER_PAGE; | 1070 | event = ev_page + pos % AIO_EVENTS_PER_PAGE; |
1059 | 1071 | ||
1060 | event->obj = (u64)(unsigned long)iocb->ki_obj.user; | 1072 | event->obj = (u64)(unsigned long)iocb->ki_user_iocb; |
1061 | event->data = iocb->ki_user_data; | 1073 | event->data = iocb->ki_user_data; |
1062 | event->res = res; | 1074 | event->res = res; |
1063 | event->res2 = res2; | 1075 | event->res2 = res2; |
@@ -1066,7 +1078,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1066 | flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); | 1078 | flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); |
1067 | 1079 | ||
1068 | pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n", | 1080 | pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n", |
1069 | ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data, | 1081 | ctx, tail, iocb, iocb->ki_user_iocb, iocb->ki_user_data, |
1070 | res, res2); | 1082 | res, res2); |
1071 | 1083 | ||
1072 | /* after flagging the request as done, we | 1084 | /* after flagging the request as done, we |
@@ -1113,7 +1125,6 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1113 | 1125 | ||
1114 | percpu_ref_put(&ctx->reqs); | 1126 | percpu_ref_put(&ctx->reqs); |
1115 | } | 1127 | } |
1116 | EXPORT_SYMBOL(aio_complete); | ||
1117 | 1128 | ||
1118 | /* aio_read_events_ring | 1129 | /* aio_read_events_ring |
1119 | * Pull an event off of the ioctx's event ring. Returns the number of | 1130 | * Pull an event off of the ioctx's event ring. Returns the number of |
@@ -1344,12 +1355,13 @@ typedef ssize_t (rw_iter_op)(struct kiocb *, struct iov_iter *); | |||
1344 | static ssize_t aio_setup_vectored_rw(struct kiocb *kiocb, | 1355 | static ssize_t aio_setup_vectored_rw(struct kiocb *kiocb, |
1345 | int rw, char __user *buf, | 1356 | int rw, char __user *buf, |
1346 | unsigned long *nr_segs, | 1357 | unsigned long *nr_segs, |
1358 | size_t *len, | ||
1347 | struct iovec **iovec, | 1359 | struct iovec **iovec, |
1348 | bool compat) | 1360 | bool compat) |
1349 | { | 1361 | { |
1350 | ssize_t ret; | 1362 | ssize_t ret; |
1351 | 1363 | ||
1352 | *nr_segs = kiocb->ki_nbytes; | 1364 | *nr_segs = *len; |
1353 | 1365 | ||
1354 | #ifdef CONFIG_COMPAT | 1366 | #ifdef CONFIG_COMPAT |
1355 | if (compat) | 1367 | if (compat) |
@@ -1364,21 +1376,22 @@ static ssize_t aio_setup_vectored_rw(struct kiocb *kiocb, | |||
1364 | if (ret < 0) | 1376 | if (ret < 0) |
1365 | return ret; | 1377 | return ret; |
1366 | 1378 | ||
1367 | /* ki_nbytes now reflect bytes instead of segs */ | 1379 | /* len now reflect bytes instead of segs */ |
1368 | kiocb->ki_nbytes = ret; | 1380 | *len = ret; |
1369 | return 0; | 1381 | return 0; |
1370 | } | 1382 | } |
1371 | 1383 | ||
1372 | static ssize_t aio_setup_single_vector(struct kiocb *kiocb, | 1384 | static ssize_t aio_setup_single_vector(struct kiocb *kiocb, |
1373 | int rw, char __user *buf, | 1385 | int rw, char __user *buf, |
1374 | unsigned long *nr_segs, | 1386 | unsigned long *nr_segs, |
1387 | size_t len, | ||
1375 | struct iovec *iovec) | 1388 | struct iovec *iovec) |
1376 | { | 1389 | { |
1377 | if (unlikely(!access_ok(!rw, buf, kiocb->ki_nbytes))) | 1390 | if (unlikely(!access_ok(!rw, buf, len))) |
1378 | return -EFAULT; | 1391 | return -EFAULT; |
1379 | 1392 | ||
1380 | iovec->iov_base = buf; | 1393 | iovec->iov_base = buf; |
1381 | iovec->iov_len = kiocb->ki_nbytes; | 1394 | iovec->iov_len = len; |
1382 | *nr_segs = 1; | 1395 | *nr_segs = 1; |
1383 | return 0; | 1396 | return 0; |
1384 | } | 1397 | } |
@@ -1388,7 +1401,7 @@ static ssize_t aio_setup_single_vector(struct kiocb *kiocb, | |||
1388 | * Performs the initial checks and io submission. | 1401 | * Performs the initial checks and io submission. |
1389 | */ | 1402 | */ |
1390 | static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, | 1403 | static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, |
1391 | char __user *buf, bool compat) | 1404 | char __user *buf, size_t len, bool compat) |
1392 | { | 1405 | { |
1393 | struct file *file = req->ki_filp; | 1406 | struct file *file = req->ki_filp; |
1394 | ssize_t ret; | 1407 | ssize_t ret; |
@@ -1423,21 +1436,21 @@ rw_common: | |||
1423 | if (!rw_op && !iter_op) | 1436 | if (!rw_op && !iter_op) |
1424 | return -EINVAL; | 1437 | return -EINVAL; |
1425 | 1438 | ||
1426 | ret = (opcode == IOCB_CMD_PREADV || | 1439 | if (opcode == IOCB_CMD_PREADV || opcode == IOCB_CMD_PWRITEV) |
1427 | opcode == IOCB_CMD_PWRITEV) | 1440 | ret = aio_setup_vectored_rw(req, rw, buf, &nr_segs, |
1428 | ? aio_setup_vectored_rw(req, rw, buf, &nr_segs, | 1441 | &len, &iovec, compat); |
1429 | &iovec, compat) | 1442 | else |
1430 | : aio_setup_single_vector(req, rw, buf, &nr_segs, | 1443 | ret = aio_setup_single_vector(req, rw, buf, &nr_segs, |
1431 | iovec); | 1444 | len, iovec); |
1432 | if (!ret) | 1445 | if (!ret) |
1433 | ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); | 1446 | ret = rw_verify_area(rw, file, &req->ki_pos, len); |
1434 | if (ret < 0) { | 1447 | if (ret < 0) { |
1435 | if (iovec != inline_vecs) | 1448 | if (iovec != inline_vecs) |
1436 | kfree(iovec); | 1449 | kfree(iovec); |
1437 | return ret; | 1450 | return ret; |
1438 | } | 1451 | } |
1439 | 1452 | ||
1440 | req->ki_nbytes = ret; | 1453 | len = ret; |
1441 | 1454 | ||
1442 | /* XXX: move/kill - rw_verify_area()? */ | 1455 | /* XXX: move/kill - rw_verify_area()? */ |
1443 | /* This matches the pread()/pwrite() logic */ | 1456 | /* This matches the pread()/pwrite() logic */ |
@@ -1450,7 +1463,7 @@ rw_common: | |||
1450 | file_start_write(file); | 1463 | file_start_write(file); |
1451 | 1464 | ||
1452 | if (iter_op) { | 1465 | if (iter_op) { |
1453 | iov_iter_init(&iter, rw, iovec, nr_segs, req->ki_nbytes); | 1466 | iov_iter_init(&iter, rw, iovec, nr_segs, len); |
1454 | ret = iter_op(req, &iter); | 1467 | ret = iter_op(req, &iter); |
1455 | } else { | 1468 | } else { |
1456 | ret = rw_op(req, iovec, nr_segs, req->ki_pos); | 1469 | ret = rw_op(req, iovec, nr_segs, req->ki_pos); |
@@ -1500,7 +1513,7 @@ rw_common: | |||
1500 | static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | 1513 | static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, |
1501 | struct iocb *iocb, bool compat) | 1514 | struct iocb *iocb, bool compat) |
1502 | { | 1515 | { |
1503 | struct kiocb *req; | 1516 | struct aio_kiocb *req; |
1504 | ssize_t ret; | 1517 | ssize_t ret; |
1505 | 1518 | ||
1506 | /* enforce forwards compatibility on users */ | 1519 | /* enforce forwards compatibility on users */ |
@@ -1523,11 +1536,14 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1523 | if (unlikely(!req)) | 1536 | if (unlikely(!req)) |
1524 | return -EAGAIN; | 1537 | return -EAGAIN; |
1525 | 1538 | ||
1526 | req->ki_filp = fget(iocb->aio_fildes); | 1539 | req->common.ki_filp = fget(iocb->aio_fildes); |
1527 | if (unlikely(!req->ki_filp)) { | 1540 | if (unlikely(!req->common.ki_filp)) { |
1528 | ret = -EBADF; | 1541 | ret = -EBADF; |
1529 | goto out_put_req; | 1542 | goto out_put_req; |
1530 | } | 1543 | } |
1544 | req->common.ki_pos = iocb->aio_offset; | ||
1545 | req->common.ki_complete = aio_complete; | ||
1546 | req->common.ki_flags = 0; | ||
1531 | 1547 | ||
1532 | if (iocb->aio_flags & IOCB_FLAG_RESFD) { | 1548 | if (iocb->aio_flags & IOCB_FLAG_RESFD) { |
1533 | /* | 1549 | /* |
@@ -1542,6 +1558,8 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1542 | req->ki_eventfd = NULL; | 1558 | req->ki_eventfd = NULL; |
1543 | goto out_put_req; | 1559 | goto out_put_req; |
1544 | } | 1560 | } |
1561 | |||
1562 | req->common.ki_flags |= IOCB_EVENTFD; | ||
1545 | } | 1563 | } |
1546 | 1564 | ||
1547 | ret = put_user(KIOCB_KEY, &user_iocb->aio_key); | 1565 | ret = put_user(KIOCB_KEY, &user_iocb->aio_key); |
@@ -1550,13 +1568,12 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1550 | goto out_put_req; | 1568 | goto out_put_req; |
1551 | } | 1569 | } |
1552 | 1570 | ||
1553 | req->ki_obj.user = user_iocb; | 1571 | req->ki_user_iocb = user_iocb; |
1554 | req->ki_user_data = iocb->aio_data; | 1572 | req->ki_user_data = iocb->aio_data; |
1555 | req->ki_pos = iocb->aio_offset; | ||
1556 | req->ki_nbytes = iocb->aio_nbytes; | ||
1557 | 1573 | ||
1558 | ret = aio_run_iocb(req, iocb->aio_lio_opcode, | 1574 | ret = aio_run_iocb(&req->common, iocb->aio_lio_opcode, |
1559 | (char __user *)(unsigned long)iocb->aio_buf, | 1575 | (char __user *)(unsigned long)iocb->aio_buf, |
1576 | iocb->aio_nbytes, | ||
1560 | compat); | 1577 | compat); |
1561 | if (ret) | 1578 | if (ret) |
1562 | goto out_put_req; | 1579 | goto out_put_req; |
@@ -1643,10 +1660,10 @@ SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr, | |||
1643 | /* lookup_kiocb | 1660 | /* lookup_kiocb |
1644 | * Finds a given iocb for cancellation. | 1661 | * Finds a given iocb for cancellation. |
1645 | */ | 1662 | */ |
1646 | static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, | 1663 | static struct aio_kiocb * |
1647 | u32 key) | 1664 | lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, u32 key) |
1648 | { | 1665 | { |
1649 | struct list_head *pos; | 1666 | struct aio_kiocb *kiocb; |
1650 | 1667 | ||
1651 | assert_spin_locked(&ctx->ctx_lock); | 1668 | assert_spin_locked(&ctx->ctx_lock); |
1652 | 1669 | ||
@@ -1654,9 +1671,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, | |||
1654 | return NULL; | 1671 | return NULL; |
1655 | 1672 | ||
1656 | /* TODO: use a hash or array, this sucks. */ | 1673 | /* TODO: use a hash or array, this sucks. */ |
1657 | list_for_each(pos, &ctx->active_reqs) { | 1674 | list_for_each_entry(kiocb, &ctx->active_reqs, ki_list) { |
1658 | struct kiocb *kiocb = list_kiocb(pos); | 1675 | if (kiocb->ki_user_iocb == iocb) |
1659 | if (kiocb->ki_obj.user == iocb) | ||
1660 | return kiocb; | 1676 | return kiocb; |
1661 | } | 1677 | } |
1662 | return NULL; | 1678 | return NULL; |
@@ -1676,7 +1692,7 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, | |||
1676 | struct io_event __user *, result) | 1692 | struct io_event __user *, result) |
1677 | { | 1693 | { |
1678 | struct kioctx *ctx; | 1694 | struct kioctx *ctx; |
1679 | struct kiocb *kiocb; | 1695 | struct aio_kiocb *kiocb; |
1680 | u32 key; | 1696 | u32 key; |
1681 | int ret; | 1697 | int ret; |
1682 | 1698 | ||
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 90bc079d9982..fdcb4d69f430 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
16 | #include <linux/vfs.h> | 16 | #include <linux/vfs.h> |
17 | #include <linux/writeback.h> | 17 | #include <linux/writeback.h> |
18 | #include <linux/uio.h> | ||
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include "bfs.h" | 20 | #include "bfs.h" |
20 | 21 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index 975266be67d3..2e522aed6584 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/namei.h> | 27 | #include <linux/namei.h> |
28 | #include <linux/log2.h> | 28 | #include <linux/log2.h> |
29 | #include <linux/cleancache.h> | 29 | #include <linux/cleancache.h> |
30 | #include <linux/aio.h> | ||
31 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
32 | #include "internal.h" | 31 | #include "internal.h" |
33 | 32 | ||
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 30982bbd31c3..aee18f84e315 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <linux/backing-dev.h> | 25 | #include <linux/backing-dev.h> |
26 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
27 | #include <linux/aio.h> | ||
28 | #include <linux/falloc.h> | 27 | #include <linux/falloc.h> |
29 | #include <linux/swap.h> | 28 | #include <linux/swap.h> |
30 | #include <linux/writeback.h> | 29 | #include <linux/writeback.h> |
@@ -32,6 +31,7 @@ | |||
32 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
34 | #include <linux/btrfs.h> | 33 | #include <linux/btrfs.h> |
34 | #include <linux/uio.h> | ||
35 | #include "ctree.h" | 35 | #include "ctree.h" |
36 | #include "disk-io.h" | 36 | #include "disk-io.h" |
37 | #include "transaction.h" | 37 | #include "transaction.h" |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d2e732d7af52..686331f22b15 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/writeback.h> | 32 | #include <linux/writeback.h> |
33 | #include <linux/statfs.h> | 33 | #include <linux/statfs.h> |
34 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
35 | #include <linux/aio.h> | ||
36 | #include <linux/bit_spinlock.h> | 35 | #include <linux/bit_spinlock.h> |
37 | #include <linux/xattr.h> | 36 | #include <linux/xattr.h> |
38 | #include <linux/posix_acl.h> | 37 | #include <linux/posix_acl.h> |
@@ -43,6 +42,7 @@ | |||
43 | #include <linux/btrfs.h> | 42 | #include <linux/btrfs.h> |
44 | #include <linux/blkdev.h> | 43 | #include <linux/blkdev.h> |
45 | #include <linux/posix_acl_xattr.h> | 44 | #include <linux/posix_acl_xattr.h> |
45 | #include <linux/uio.h> | ||
46 | #include "ctree.h" | 46 | #include "ctree.h" |
47 | #include "disk-io.h" | 47 | #include "disk-io.h" |
48 | #include "transaction.h" | 48 | #include "transaction.h" |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d533075a823d..139f2fea91a0 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/mount.h> | 7 | #include <linux/mount.h> |
8 | #include <linux/namei.h> | 8 | #include <linux/namei.h> |
9 | #include <linux/writeback.h> | 9 | #include <linux/writeback.h> |
10 | #include <linux/aio.h> | ||
11 | #include <linux/falloc.h> | 10 | #include <linux/falloc.h> |
12 | 11 | ||
13 | #include "super.h" | 12 | #include "super.h" |
@@ -808,7 +807,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) | |||
808 | { | 807 | { |
809 | struct file *filp = iocb->ki_filp; | 808 | struct file *filp = iocb->ki_filp; |
810 | struct ceph_file_info *fi = filp->private_data; | 809 | struct ceph_file_info *fi = filp->private_data; |
811 | size_t len = iocb->ki_nbytes; | 810 | size_t len = iov_iter_count(to); |
812 | struct inode *inode = file_inode(filp); | 811 | struct inode *inode = file_inode(filp); |
813 | struct ceph_inode_info *ci = ceph_inode(inode); | 812 | struct ceph_inode_info *ci = ceph_inode(inode); |
814 | struct page *pinned_page = NULL; | 813 | struct page *pinned_page = NULL; |
diff --git a/fs/direct-io.c b/fs/direct-io.c index e181b6b2e297..6fb00e3f1059 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/uio.h> | 37 | #include <linux/uio.h> |
38 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
39 | #include <linux/prefetch.h> | 39 | #include <linux/prefetch.h> |
40 | #include <linux/aio.h> | ||
41 | 40 | ||
42 | /* | 41 | /* |
43 | * How many user pages to map in one call to get_user_pages(). This determines | 42 | * How many user pages to map in one call to get_user_pages(). This determines |
@@ -265,7 +264,7 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, | |||
265 | ret = err; | 264 | ret = err; |
266 | } | 265 | } |
267 | 266 | ||
268 | aio_complete(dio->iocb, ret, 0); | 267 | dio->iocb->ki_complete(dio->iocb, ret, 0); |
269 | } | 268 | } |
270 | 269 | ||
271 | kmem_cache_free(dio_cache, dio); | 270 | kmem_cache_free(dio_cache, dio); |
@@ -1056,7 +1055,7 @@ static inline int drop_refcount(struct dio *dio) | |||
1056 | * operation. AIO can if it was a broken operation described above or | 1055 | * operation. AIO can if it was a broken operation described above or |
1057 | * in fact if all the bios race to complete before we get here. In | 1056 | * in fact if all the bios race to complete before we get here. In |
1058 | * that case dio_complete() translates the EIOCBQUEUED into the proper | 1057 | * that case dio_complete() translates the EIOCBQUEUED into the proper |
1059 | * return code that the caller will hand to aio_complete(). | 1058 | * return code that the caller will hand to ->complete(). |
1060 | * | 1059 | * |
1061 | * This is managed by the bio_lock instead of being an atomic_t so that | 1060 | * This is managed by the bio_lock instead of being an atomic_t so that |
1062 | * completion paths can drop their ref and use the remaining count to | 1061 | * completion paths can drop their ref and use the remaining count to |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index fd39bad6f1bd..79675089443d 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
32 | #include <linux/compat.h> | 32 | #include <linux/compat.h> |
33 | #include <linux/fs_stack.h> | 33 | #include <linux/fs_stack.h> |
34 | #include <linux/aio.h> | ||
35 | #include "ecryptfs_kernel.h" | 34 | #include "ecryptfs_kernel.h" |
36 | 35 | ||
37 | /** | 36 | /** |
@@ -52,12 +51,6 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, | |||
52 | struct file *file = iocb->ki_filp; | 51 | struct file *file = iocb->ki_filp; |
53 | 52 | ||
54 | rc = generic_file_read_iter(iocb, to); | 53 | rc = generic_file_read_iter(iocb, to); |
55 | /* | ||
56 | * Even though this is a async interface, we need to wait | ||
57 | * for IO to finish to update atime | ||
58 | */ | ||
59 | if (-EIOCBQUEUED == rc) | ||
60 | rc = wait_on_sync_kiocb(iocb); | ||
61 | if (rc >= 0) { | 54 | if (rc >= 0) { |
62 | path = ecryptfs_dentry_to_lower_path(file->f_path.dentry); | 55 | path = ecryptfs_dentry_to_lower_path(file->f_path.dentry); |
63 | touch_atime(path); | 56 | touch_atime(path); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 6434bc000125..df9d6afbc5d5 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/mpage.h> | 31 | #include <linux/mpage.h> |
32 | #include <linux/fiemap.h> | 32 | #include <linux/fiemap.h> |
33 | #include <linux/namei.h> | 33 | #include <linux/namei.h> |
34 | #include <linux/aio.h> | 34 | #include <linux/uio.h> |
35 | #include "ext2.h" | 35 | #include "ext2.h" |
36 | #include "acl.h" | 36 | #include "acl.h" |
37 | #include "xattr.h" | 37 | #include "xattr.h" |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2c6ccc49ba27..db07ffbe7c85 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
28 | #include <linux/mpage.h> | 28 | #include <linux/mpage.h> |
29 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
30 | #include <linux/aio.h> | 30 | #include <linux/uio.h> |
31 | #include "ext3.h" | 31 | #include "ext3.h" |
32 | #include "xattr.h" | 32 | #include "xattr.h" |
33 | #include "acl.h" | 33 | #include "acl.h" |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 33a09da16c9c..598abbbe6786 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -23,9 +23,9 @@ | |||
23 | #include <linux/jbd2.h> | 23 | #include <linux/jbd2.h> |
24 | #include <linux/mount.h> | 24 | #include <linux/mount.h> |
25 | #include <linux/path.h> | 25 | #include <linux/path.h> |
26 | #include <linux/aio.h> | ||
27 | #include <linux/quotaops.h> | 26 | #include <linux/quotaops.h> |
28 | #include <linux/pagevec.h> | 27 | #include <linux/pagevec.h> |
28 | #include <linux/uio.h> | ||
29 | #include "ext4.h" | 29 | #include "ext4.h" |
30 | #include "ext4_jbd2.h" | 30 | #include "ext4_jbd2.h" |
31 | #include "xattr.h" | 31 | #include "xattr.h" |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 45fe924f82bc..740c7871c117 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -20,9 +20,9 @@ | |||
20 | * (sct@redhat.com), 1993, 1998 | 20 | * (sct@redhat.com), 1993, 1998 |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/aio.h> | ||
24 | #include "ext4_jbd2.h" | 23 | #include "ext4_jbd2.h" |
25 | #include "truncate.h" | 24 | #include "truncate.h" |
25 | #include <linux/uio.h> | ||
26 | 26 | ||
27 | #include <trace/events/ext4.h> | 27 | #include <trace/events/ext4.h> |
28 | 28 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 5cb9a212b86f..a3f451370bef 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/printk.h> | 37 | #include <linux/printk.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/ratelimit.h> | 39 | #include <linux/ratelimit.h> |
40 | #include <linux/aio.h> | ||
41 | #include <linux/bitops.h> | 40 | #include <linux/bitops.h> |
42 | 41 | ||
43 | #include "ext4_jbd2.h" | 42 | #include "ext4_jbd2.h" |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index b24a2541a9ba..464984261e69 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/pagevec.h> | 18 | #include <linux/pagevec.h> |
19 | #include <linux/mpage.h> | 19 | #include <linux/mpage.h> |
20 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
21 | #include <linux/aio.h> | ||
22 | #include <linux/uio.h> | 21 | #include <linux/uio.h> |
23 | #include <linux/bio.h> | 22 | #include <linux/bio.h> |
24 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 985ed023a750..497f8515d205 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -12,12 +12,12 @@ | |||
12 | #include <linux/f2fs_fs.h> | 12 | #include <linux/f2fs_fs.h> |
13 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
14 | #include <linux/mpage.h> | 14 | #include <linux/mpage.h> |
15 | #include <linux/aio.h> | ||
16 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
17 | #include <linux/backing-dev.h> | 16 | #include <linux/backing-dev.h> |
18 | #include <linux/blkdev.h> | 17 | #include <linux/blkdev.h> |
19 | #include <linux/bio.h> | 18 | #include <linux/bio.h> |
20 | #include <linux/prefetch.h> | 19 | #include <linux/prefetch.h> |
20 | #include <linux/uio.h> | ||
21 | 21 | ||
22 | #include "f2fs.h" | 22 | #include "f2fs.h" |
23 | #include "node.h" | 23 | #include "node.h" |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 497c7c5263c7..8521207de229 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/mpage.h> | 19 | #include <linux/mpage.h> |
20 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
21 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
22 | #include <linux/aio.h> | ||
23 | #include <linux/vfs.h> | 22 | #include <linux/vfs.h> |
24 | #include <linux/parser.h> | 23 | #include <linux/parser.h> |
25 | #include <linux/uio.h> | 24 | #include <linux/uio.h> |
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c index 28d0c7abba1c..b3fa05032234 100644 --- a/fs/fuse/cuse.c +++ b/fs/fuse/cuse.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/device.h> | 38 | #include <linux/device.h> |
39 | #include <linux/file.h> | 39 | #include <linux/file.h> |
40 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
41 | #include <linux/aio.h> | ||
42 | #include <linux/kdev_t.h> | 41 | #include <linux/kdev_t.h> |
43 | #include <linux/kthread.h> | 42 | #include <linux/kthread.h> |
44 | #include <linux/list.h> | 43 | #include <linux/list.h> |
@@ -48,6 +47,7 @@ | |||
48 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
49 | #include <linux/stat.h> | 48 | #include <linux/stat.h> |
50 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/uio.h> | ||
51 | 51 | ||
52 | #include "fuse_i.h" | 52 | #include "fuse_i.h" |
53 | 53 | ||
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 39706c57ad3c..95a2797eef66 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/pipe_fs_i.h> | 19 | #include <linux/pipe_fs_i.h> |
20 | #include <linux/swap.h> | 20 | #include <linux/swap.h> |
21 | #include <linux/splice.h> | 21 | #include <linux/splice.h> |
22 | #include <linux/aio.h> | ||
23 | 22 | ||
24 | MODULE_ALIAS_MISCDEV(FUSE_MINOR); | 23 | MODULE_ALIAS_MISCDEV(FUSE_MINOR); |
25 | MODULE_ALIAS("devname:fuse"); | 24 | MODULE_ALIAS("devname:fuse"); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c01ec3bdcfd8..ff102cbf16ea 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -15,8 +15,8 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | #include <linux/aio.h> | ||
19 | #include <linux/falloc.h> | 18 | #include <linux/falloc.h> |
19 | #include <linux/uio.h> | ||
20 | 20 | ||
21 | static const struct file_operations fuse_direct_io_file_operations; | 21 | static const struct file_operations fuse_direct_io_file_operations; |
22 | 22 | ||
@@ -528,6 +528,17 @@ static void fuse_release_user_pages(struct fuse_req *req, int write) | |||
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | static ssize_t fuse_get_res_by_io(struct fuse_io_priv *io) | ||
532 | { | ||
533 | if (io->err) | ||
534 | return io->err; | ||
535 | |||
536 | if (io->bytes >= 0 && io->write) | ||
537 | return -EIO; | ||
538 | |||
539 | return io->bytes < 0 ? io->size : io->bytes; | ||
540 | } | ||
541 | |||
531 | /** | 542 | /** |
532 | * In case of short read, the caller sets 'pos' to the position of | 543 | * In case of short read, the caller sets 'pos' to the position of |
533 | * actual end of fuse request in IO request. Otherwise, if bytes_requested | 544 | * actual end of fuse request in IO request. Otherwise, if bytes_requested |
@@ -546,6 +557,7 @@ static void fuse_release_user_pages(struct fuse_req *req, int write) | |||
546 | */ | 557 | */ |
547 | static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos) | 558 | static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos) |
548 | { | 559 | { |
560 | bool is_sync = is_sync_kiocb(io->iocb); | ||
549 | int left; | 561 | int left; |
550 | 562 | ||
551 | spin_lock(&io->lock); | 563 | spin_lock(&io->lock); |
@@ -555,30 +567,24 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos) | |||
555 | io->bytes = pos; | 567 | io->bytes = pos; |
556 | 568 | ||
557 | left = --io->reqs; | 569 | left = --io->reqs; |
570 | if (!left && is_sync) | ||
571 | complete(io->done); | ||
558 | spin_unlock(&io->lock); | 572 | spin_unlock(&io->lock); |
559 | 573 | ||
560 | if (!left) { | 574 | if (!left && !is_sync) { |
561 | long res; | 575 | ssize_t res = fuse_get_res_by_io(io); |
562 | 576 | ||
563 | if (io->err) | 577 | if (res >= 0) { |
564 | res = io->err; | 578 | struct inode *inode = file_inode(io->iocb->ki_filp); |
565 | else if (io->bytes >= 0 && io->write) | 579 | struct fuse_conn *fc = get_fuse_conn(inode); |
566 | res = -EIO; | 580 | struct fuse_inode *fi = get_fuse_inode(inode); |
567 | else { | ||
568 | res = io->bytes < 0 ? io->size : io->bytes; | ||
569 | 581 | ||
570 | if (!is_sync_kiocb(io->iocb)) { | 582 | spin_lock(&fc->lock); |
571 | struct inode *inode = file_inode(io->iocb->ki_filp); | 583 | fi->attr_version = ++fc->attr_version; |
572 | struct fuse_conn *fc = get_fuse_conn(inode); | 584 | spin_unlock(&fc->lock); |
573 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
574 | |||
575 | spin_lock(&fc->lock); | ||
576 | fi->attr_version = ++fc->attr_version; | ||
577 | spin_unlock(&fc->lock); | ||
578 | } | ||
579 | } | 585 | } |
580 | 586 | ||
581 | aio_complete(io->iocb, res, 0); | 587 | io->iocb->ki_complete(io->iocb, res, 0); |
582 | kfree(io); | 588 | kfree(io); |
583 | } | 589 | } |
584 | } | 590 | } |
@@ -2801,6 +2807,7 @@ static ssize_t | |||
2801 | fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | 2807 | fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, |
2802 | loff_t offset) | 2808 | loff_t offset) |
2803 | { | 2809 | { |
2810 | DECLARE_COMPLETION_ONSTACK(wait); | ||
2804 | ssize_t ret = 0; | 2811 | ssize_t ret = 0; |
2805 | struct file *file = iocb->ki_filp; | 2812 | struct file *file = iocb->ki_filp; |
2806 | struct fuse_file *ff = file->private_data; | 2813 | struct fuse_file *ff = file->private_data; |
@@ -2852,6 +2859,9 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
2852 | if (!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE) | 2859 | if (!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE) |
2853 | io->async = false; | 2860 | io->async = false; |
2854 | 2861 | ||
2862 | if (io->async && is_sync_kiocb(iocb)) | ||
2863 | io->done = &wait; | ||
2864 | |||
2855 | if (rw == WRITE) | 2865 | if (rw == WRITE) |
2856 | ret = __fuse_direct_write(io, iter, &pos); | 2866 | ret = __fuse_direct_write(io, iter, &pos); |
2857 | else | 2867 | else |
@@ -2864,11 +2874,12 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
2864 | if (!is_sync_kiocb(iocb)) | 2874 | if (!is_sync_kiocb(iocb)) |
2865 | return -EIOCBQUEUED; | 2875 | return -EIOCBQUEUED; |
2866 | 2876 | ||
2867 | ret = wait_on_sync_kiocb(iocb); | 2877 | wait_for_completion(&wait); |
2868 | } else { | 2878 | ret = fuse_get_res_by_io(io); |
2869 | kfree(io); | ||
2870 | } | 2879 | } |
2871 | 2880 | ||
2881 | kfree(io); | ||
2882 | |||
2872 | if (rw == WRITE) { | 2883 | if (rw == WRITE) { |
2873 | if (ret > 0) | 2884 | if (ret > 0) |
2874 | fuse_write_update_size(inode, pos); | 2885 | fuse_write_update_size(inode, pos); |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 1cdfb07c1376..7354dc142a50 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -263,6 +263,7 @@ struct fuse_io_priv { | |||
263 | int err; | 263 | int err; |
264 | struct kiocb *iocb; | 264 | struct kiocb *iocb; |
265 | struct file *file; | 265 | struct file *file; |
266 | struct completion *done; | ||
266 | }; | 267 | }; |
267 | 268 | ||
268 | /** | 269 | /** |
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 4ad4f94edebe..fe6634d25d1d 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/swap.h> | 20 | #include <linux/swap.h> |
21 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
22 | #include <linux/backing-dev.h> | 22 | #include <linux/backing-dev.h> |
23 | #include <linux/aio.h> | 23 | #include <linux/uio.h> |
24 | #include <trace/events/writeback.h> | 24 | #include <trace/events/writeback.h> |
25 | 25 | ||
26 | #include "gfs2.h" | 26 | #include "gfs2.h" |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 3e32bb8e2d7e..f6fc412b1100 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <linux/dlm.h> | 26 | #include <linux/dlm.h> |
27 | #include <linux/dlm_plock.h> | 27 | #include <linux/dlm_plock.h> |
28 | #include <linux/aio.h> | ||
29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
30 | 29 | ||
31 | #include "gfs2.h" | 30 | #include "gfs2.h" |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index d0929bc81782..98d4ea45bb70 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
15 | #include <linux/mpage.h> | 15 | #include <linux/mpage.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/aio.h> | 17 | #include <linux/uio.h> |
18 | 18 | ||
19 | #include "hfs_fs.h" | 19 | #include "hfs_fs.h" |
20 | #include "btree.h" | 20 | #include "btree.h" |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 0cf786f2d046..f541196d4ee9 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
15 | #include <linux/mpage.h> | 15 | #include <linux/mpage.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/aio.h> | 17 | #include <linux/uio.h> |
18 | 18 | ||
19 | #include "hfsplus_fs.h" | 19 | #include "hfsplus_fs.h" |
20 | #include "hfsplus_raw.h" | 20 | #include "hfsplus_raw.h" |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index bd3df1ca3c9b..3197aed10614 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/quotaops.h> | 24 | #include <linux/quotaops.h> |
25 | #include <linux/uio.h> | ||
25 | #include <linux/writeback.h> | 26 | #include <linux/writeback.h> |
26 | #include <linux/aio.h> | ||
27 | #include "jfs_incore.h" | 27 | #include "jfs_incore.h" |
28 | #include "jfs_inode.h" | 28 | #include "jfs_inode.h" |
29 | #include "jfs_filsys.h" | 29 | #include "jfs_filsys.h" |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index e907c8cf732e..c3929fb2ab26 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -265,7 +265,7 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t | |||
265 | 265 | ||
266 | return -EINVAL; | 266 | return -EINVAL; |
267 | #else | 267 | #else |
268 | VM_BUG_ON(iocb->ki_nbytes != PAGE_SIZE); | 268 | VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); |
269 | 269 | ||
270 | if (rw == READ) | 270 | if (rw == READ) |
271 | return nfs_file_direct_read(iocb, iter, pos); | 271 | return nfs_file_direct_read(iocb, iter, pos); |
@@ -393,7 +393,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write) | |||
393 | long res = (long) dreq->error; | 393 | long res = (long) dreq->error; |
394 | if (!res) | 394 | if (!res) |
395 | res = (long) dreq->count; | 395 | res = (long) dreq->count; |
396 | aio_complete(dreq->iocb, res, 0); | 396 | dreq->iocb->ki_complete(dreq->iocb, res, 0); |
397 | } | 397 | } |
398 | 398 | ||
399 | complete_all(&dreq->completion); | 399 | complete_all(&dreq->completion); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index e679d24c39d3..37b15582e0de 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/nfs_mount.h> | 26 | #include <linux/nfs_mount.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/aio.h> | ||
30 | #include <linux/gfp.h> | 29 | #include <linux/gfp.h> |
31 | #include <linux/swap.h> | 30 | #include <linux/swap.h> |
32 | 31 | ||
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 8b5969538f39..ab4987bc637f 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
27 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
28 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
29 | #include <linux/aio.h> | 29 | #include <linux/uio.h> |
30 | #include "nilfs.h" | 30 | #include "nilfs.h" |
31 | #include "btnode.h" | 31 | #include "btnode.h" |
32 | #include "segment.h" | 32 | #include "segment.h" |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 1da9b2d184dc..f16f2d8401fe 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/swap.h> | 28 | #include <linux/swap.h> |
29 | #include <linux/uio.h> | 29 | #include <linux/uio.h> |
30 | #include <linux/writeback.h> | 30 | #include <linux/writeback.h> |
31 | #include <linux/aio.h> | ||
32 | 31 | ||
33 | #include <asm/page.h> | 32 | #include <asm/page.h> |
34 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 898b9949d363..1d0c21df0d80 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/quotaops.h> | 28 | #include <linux/quotaops.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/log2.h> | 30 | #include <linux/log2.h> |
31 | #include <linux/aio.h> | ||
32 | 31 | ||
33 | #include "aops.h" | 32 | #include "aops.h" |
34 | #include "attrib.h" | 33 | #include "attrib.h" |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 44db1808cdb5..e1bf18c5d25e 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mpage.h> | 29 | #include <linux/mpage.h> |
30 | #include <linux/quotaops.h> | 30 | #include <linux/quotaops.h> |
31 | #include <linux/blkdev.h> | 31 | #include <linux/blkdev.h> |
32 | #include <linux/uio.h> | ||
32 | 33 | ||
33 | #include <cluster/masklog.h> | 34 | #include <cluster/masklog.h> |
34 | 35 | ||
diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h index 6cae155d54df..dd59599b022d 100644 --- a/fs/ocfs2/aops.h +++ b/fs/ocfs2/aops.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #ifndef OCFS2_AOPS_H | 22 | #ifndef OCFS2_AOPS_H |
23 | #define OCFS2_AOPS_H | 23 | #define OCFS2_AOPS_H |
24 | 24 | ||
25 | #include <linux/aio.h> | 25 | #include <linux/fs.h> |
26 | 26 | ||
27 | handle_t *ocfs2_start_walk_page_trans(struct inode *inode, | 27 | handle_t *ocfs2_start_walk_page_trans(struct inode *inode, |
28 | struct page *page, | 28 | struct page *page, |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 46e0d4e857c7..266845de2100 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2280,7 +2280,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, | |||
2280 | file->f_path.dentry->d_name.name, | 2280 | file->f_path.dentry->d_name.name, |
2281 | (unsigned int)from->nr_segs); /* GRRRRR */ | 2281 | (unsigned int)from->nr_segs); /* GRRRRR */ |
2282 | 2282 | ||
2283 | if (iocb->ki_nbytes == 0) | 2283 | if (count == 0) |
2284 | return 0; | 2284 | return 0; |
2285 | 2285 | ||
2286 | appending = file->f_flags & O_APPEND ? 1 : 0; | 2286 | appending = file->f_flags & O_APPEND ? 1 : 0; |
@@ -2330,8 +2330,7 @@ relock: | |||
2330 | } | 2330 | } |
2331 | 2331 | ||
2332 | can_do_direct = direct_io; | 2332 | can_do_direct = direct_io; |
2333 | ret = ocfs2_prepare_inode_for_write(file, ppos, | 2333 | ret = ocfs2_prepare_inode_for_write(file, ppos, count, appending, |
2334 | iocb->ki_nbytes, appending, | ||
2335 | &can_do_direct, &has_refcount); | 2334 | &can_do_direct, &has_refcount); |
2336 | if (ret < 0) { | 2335 | if (ret < 0) { |
2337 | mlog_errno(ret); | 2336 | mlog_errno(ret); |
@@ -2339,8 +2338,7 @@ relock: | |||
2339 | } | 2338 | } |
2340 | 2339 | ||
2341 | if (direct_io && !is_sync_kiocb(iocb)) | 2340 | if (direct_io && !is_sync_kiocb(iocb)) |
2342 | unaligned_dio = ocfs2_is_io_unaligned(inode, iocb->ki_nbytes, | 2341 | unaligned_dio = ocfs2_is_io_unaligned(inode, count, *ppos); |
2343 | *ppos); | ||
2344 | 2342 | ||
2345 | /* | 2343 | /* |
2346 | * We can't complete the direct I/O as requested, fall back to | 2344 | * We can't complete the direct I/O as requested, fall back to |
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/audit.h> | 21 | #include <linux/audit.h> |
22 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
23 | #include <linux/fcntl.h> | 23 | #include <linux/fcntl.h> |
24 | #include <linux/aio.h> | ||
25 | 24 | ||
26 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
27 | #include <asm/ioctls.h> | 26 | #include <asm/ioctls.h> |
diff --git a/fs/read_write.c b/fs/read_write.c index 8e1b68786d66..99a6ef946d01 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/fcntl.h> | 9 | #include <linux/fcntl.h> |
10 | #include <linux/file.h> | 10 | #include <linux/file.h> |
11 | #include <linux/uio.h> | 11 | #include <linux/uio.h> |
12 | #include <linux/aio.h> | ||
13 | #include <linux/fsnotify.h> | 12 | #include <linux/fsnotify.h> |
14 | #include <linux/security.h> | 13 | #include <linux/security.h> |
15 | #include <linux/export.h> | 14 | #include <linux/export.h> |
@@ -343,13 +342,10 @@ ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos) | |||
343 | 342 | ||
344 | init_sync_kiocb(&kiocb, file); | 343 | init_sync_kiocb(&kiocb, file); |
345 | kiocb.ki_pos = *ppos; | 344 | kiocb.ki_pos = *ppos; |
346 | kiocb.ki_nbytes = iov_iter_count(iter); | ||
347 | 345 | ||
348 | iter->type |= READ; | 346 | iter->type |= READ; |
349 | ret = file->f_op->read_iter(&kiocb, iter); | 347 | ret = file->f_op->read_iter(&kiocb, iter); |
350 | if (ret == -EIOCBQUEUED) | 348 | BUG_ON(ret == -EIOCBQUEUED); |
351 | ret = wait_on_sync_kiocb(&kiocb); | ||
352 | |||
353 | if (ret > 0) | 349 | if (ret > 0) |
354 | *ppos = kiocb.ki_pos; | 350 | *ppos = kiocb.ki_pos; |
355 | return ret; | 351 | return ret; |
@@ -366,13 +362,10 @@ ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos) | |||
366 | 362 | ||
367 | init_sync_kiocb(&kiocb, file); | 363 | init_sync_kiocb(&kiocb, file); |
368 | kiocb.ki_pos = *ppos; | 364 | kiocb.ki_pos = *ppos; |
369 | kiocb.ki_nbytes = iov_iter_count(iter); | ||
370 | 365 | ||
371 | iter->type |= WRITE; | 366 | iter->type |= WRITE; |
372 | ret = file->f_op->write_iter(&kiocb, iter); | 367 | ret = file->f_op->write_iter(&kiocb, iter); |
373 | if (ret == -EIOCBQUEUED) | 368 | BUG_ON(ret == -EIOCBQUEUED); |
374 | ret = wait_on_sync_kiocb(&kiocb); | ||
375 | |||
376 | if (ret > 0) | 369 | if (ret > 0) |
377 | *ppos = kiocb.ki_pos; | 370 | *ppos = kiocb.ki_pos; |
378 | return ret; | 371 | return ret; |
@@ -426,11 +419,9 @@ ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *pp | |||
426 | 419 | ||
427 | init_sync_kiocb(&kiocb, filp); | 420 | init_sync_kiocb(&kiocb, filp); |
428 | kiocb.ki_pos = *ppos; | 421 | kiocb.ki_pos = *ppos; |
429 | kiocb.ki_nbytes = len; | ||
430 | 422 | ||
431 | ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); | 423 | ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); |
432 | if (-EIOCBQUEUED == ret) | 424 | BUG_ON(ret == -EIOCBQUEUED); |
433 | ret = wait_on_sync_kiocb(&kiocb); | ||
434 | *ppos = kiocb.ki_pos; | 425 | *ppos = kiocb.ki_pos; |
435 | return ret; | 426 | return ret; |
436 | } | 427 | } |
@@ -446,12 +437,10 @@ ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *p | |||
446 | 437 | ||
447 | init_sync_kiocb(&kiocb, filp); | 438 | init_sync_kiocb(&kiocb, filp); |
448 | kiocb.ki_pos = *ppos; | 439 | kiocb.ki_pos = *ppos; |
449 | kiocb.ki_nbytes = len; | ||
450 | iov_iter_init(&iter, READ, &iov, 1, len); | 440 | iov_iter_init(&iter, READ, &iov, 1, len); |
451 | 441 | ||
452 | ret = filp->f_op->read_iter(&kiocb, &iter); | 442 | ret = filp->f_op->read_iter(&kiocb, &iter); |
453 | if (-EIOCBQUEUED == ret) | 443 | BUG_ON(ret == -EIOCBQUEUED); |
454 | ret = wait_on_sync_kiocb(&kiocb); | ||
455 | *ppos = kiocb.ki_pos; | 444 | *ppos = kiocb.ki_pos; |
456 | return ret; | 445 | return ret; |
457 | } | 446 | } |
@@ -510,11 +499,9 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof | |||
510 | 499 | ||
511 | init_sync_kiocb(&kiocb, filp); | 500 | init_sync_kiocb(&kiocb, filp); |
512 | kiocb.ki_pos = *ppos; | 501 | kiocb.ki_pos = *ppos; |
513 | kiocb.ki_nbytes = len; | ||
514 | 502 | ||
515 | ret = filp->f_op->aio_write(&kiocb, &iov, 1, kiocb.ki_pos); | 503 | ret = filp->f_op->aio_write(&kiocb, &iov, 1, kiocb.ki_pos); |
516 | if (-EIOCBQUEUED == ret) | 504 | BUG_ON(ret == -EIOCBQUEUED); |
517 | ret = wait_on_sync_kiocb(&kiocb); | ||
518 | *ppos = kiocb.ki_pos; | 505 | *ppos = kiocb.ki_pos; |
519 | return ret; | 506 | return ret; |
520 | } | 507 | } |
@@ -530,12 +517,10 @@ ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, lo | |||
530 | 517 | ||
531 | init_sync_kiocb(&kiocb, filp); | 518 | init_sync_kiocb(&kiocb, filp); |
532 | kiocb.ki_pos = *ppos; | 519 | kiocb.ki_pos = *ppos; |
533 | kiocb.ki_nbytes = len; | ||
534 | iov_iter_init(&iter, WRITE, &iov, 1, len); | 520 | iov_iter_init(&iter, WRITE, &iov, 1, len); |
535 | 521 | ||
536 | ret = filp->f_op->write_iter(&kiocb, &iter); | 522 | ret = filp->f_op->write_iter(&kiocb, &iter); |
537 | if (-EIOCBQUEUED == ret) | 523 | BUG_ON(ret == -EIOCBQUEUED); |
538 | ret = wait_on_sync_kiocb(&kiocb); | ||
539 | *ppos = kiocb.ki_pos; | 524 | *ppos = kiocb.ki_pos; |
540 | return ret; | 525 | return ret; |
541 | } | 526 | } |
@@ -719,12 +704,10 @@ static ssize_t do_iter_readv_writev(struct file *filp, int rw, const struct iove | |||
719 | 704 | ||
720 | init_sync_kiocb(&kiocb, filp); | 705 | init_sync_kiocb(&kiocb, filp); |
721 | kiocb.ki_pos = *ppos; | 706 | kiocb.ki_pos = *ppos; |
722 | kiocb.ki_nbytes = len; | ||
723 | 707 | ||
724 | iov_iter_init(&iter, rw, iov, nr_segs, len); | 708 | iov_iter_init(&iter, rw, iov, nr_segs, len); |
725 | ret = fn(&kiocb, &iter); | 709 | ret = fn(&kiocb, &iter); |
726 | if (ret == -EIOCBQUEUED) | 710 | BUG_ON(ret == -EIOCBQUEUED); |
727 | ret = wait_on_sync_kiocb(&kiocb); | ||
728 | *ppos = kiocb.ki_pos; | 711 | *ppos = kiocb.ki_pos; |
729 | return ret; | 712 | return ret; |
730 | } | 713 | } |
@@ -737,11 +720,9 @@ static ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | |||
737 | 720 | ||
738 | init_sync_kiocb(&kiocb, filp); | 721 | init_sync_kiocb(&kiocb, filp); |
739 | kiocb.ki_pos = *ppos; | 722 | kiocb.ki_pos = *ppos; |
740 | kiocb.ki_nbytes = len; | ||
741 | 723 | ||
742 | ret = fn(&kiocb, iov, nr_segs, kiocb.ki_pos); | 724 | ret = fn(&kiocb, iov, nr_segs, kiocb.ki_pos); |
743 | if (ret == -EIOCBQUEUED) | 725 | BUG_ON(ret == -EIOCBQUEUED); |
744 | ret = wait_on_sync_kiocb(&kiocb); | ||
745 | *ppos = kiocb.ki_pos; | 726 | *ppos = kiocb.ki_pos; |
746 | return ret; | 727 | return ret; |
747 | } | 728 | } |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index e72401e1f995..9312b7842e03 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/writeback.h> | 18 | #include <linux/writeback.h> |
19 | #include <linux/quotaops.h> | 19 | #include <linux/quotaops.h> |
20 | #include <linux/swap.h> | 20 | #include <linux/swap.h> |
21 | #include <linux/aio.h> | 21 | #include <linux/uio.h> |
22 | 22 | ||
23 | int reiserfs_commit_write(struct file *f, struct page *page, | 23 | int reiserfs_commit_write(struct file *f, struct page *page, |
24 | unsigned from, unsigned to); | 24 | unsigned from, unsigned to); |
diff --git a/fs/splice.c b/fs/splice.c index 7968da96bebb..4bbfa95b5bfe 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/socket.h> | 33 | #include <linux/socket.h> |
34 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
35 | #include <linux/aio.h> | ||
36 | #include "internal.h" | 35 | #include "internal.h" |
37 | 36 | ||
38 | /* | 37 | /* |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index e627c0acf626..c3d15fe83403 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -50,7 +50,6 @@ | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include "ubifs.h" | 52 | #include "ubifs.h" |
53 | #include <linux/aio.h> | ||
54 | #include <linux/mount.h> | 53 | #include <linux/mount.h> |
55 | #include <linux/namei.h> | 54 | #include <linux/namei.h> |
56 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 08f3555fbeac..7f885cc8b0b7 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/buffer_head.h> | 36 | #include <linux/buffer_head.h> |
37 | #include <linux/aio.h> | 37 | #include <linux/uio.h> |
38 | 38 | ||
39 | #include "udf_i.h" | 39 | #include "udf_i.h" |
40 | #include "udf_sb.h" | 40 | #include "udf_sb.h" |
@@ -122,7 +122,7 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
122 | struct file *file = iocb->ki_filp; | 122 | struct file *file = iocb->ki_filp; |
123 | struct inode *inode = file_inode(file); | 123 | struct inode *inode = file_inode(file); |
124 | int err, pos; | 124 | int err, pos; |
125 | size_t count = iocb->ki_nbytes; | 125 | size_t count = iov_iter_count(from); |
126 | struct udf_inode_info *iinfo = UDF_I(inode); | 126 | struct udf_inode_info *iinfo = UDF_I(inode); |
127 | 127 | ||
128 | mutex_lock(&inode->i_mutex); | 128 | mutex_lock(&inode->i_mutex); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index a445d599098d..9c1fbd23913d 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/crc-itu-t.h> | 39 | #include <linux/crc-itu-t.h> |
40 | #include <linux/mpage.h> | 40 | #include <linux/mpage.h> |
41 | #include <linux/aio.h> | 41 | #include <linux/uio.h> |
42 | 42 | ||
43 | #include "udf_i.h" | 43 | #include "udf_i.h" |
44 | #include "udf_sb.h" | 44 | #include "udf_sb.h" |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 3a9b7a1b8704..4f8cdc59bc38 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "xfs_bmap.h" | 31 | #include "xfs_bmap.h" |
32 | #include "xfs_bmap_util.h" | 32 | #include "xfs_bmap_util.h" |
33 | #include "xfs_bmap_btree.h" | 33 | #include "xfs_bmap_btree.h" |
34 | #include <linux/aio.h> | ||
35 | #include <linux/gfp.h> | 34 | #include <linux/gfp.h> |
36 | #include <linux/mpage.h> | 35 | #include <linux/mpage.h> |
37 | #include <linux/pagevec.h> | 36 | #include <linux/pagevec.h> |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index a2e1cb8a568b..f44212fae653 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "xfs_icache.h" | 38 | #include "xfs_icache.h" |
39 | #include "xfs_pnfs.h" | 39 | #include "xfs_pnfs.h" |
40 | 40 | ||
41 | #include <linux/aio.h> | ||
42 | #include <linux/dcache.h> | 41 | #include <linux/dcache.h> |
43 | #include <linux/falloc.h> | 42 | #include <linux/falloc.h> |
44 | #include <linux/pagevec.h> | 43 | #include <linux/pagevec.h> |