···3737#include <linux/uio.h>3838#include <linux/atomic.h>3939#include <linux/prefetch.h>4040-#include <linux/aio.h>41404241/*4342 * How many user pages to map in one call to get_user_pages(). This determines···264265 ret = err;265266 }266267267267- aio_complete(dio->iocb, ret, 0);268268+ dio->iocb->ki_complete(dio->iocb, ret, 0);268269 }269270270271 kmem_cache_free(dio_cache, dio);···10551056 * operation. AIO can if it was a broken operation described above or10561057 * in fact if all the bios race to complete before we get here. In10571058 * that case dio_complete() translates the EIOCBQUEUED into the proper10581058- * return code that the caller will hand to aio_complete().10591059+ * return code that the caller will hand to ->complete().10591060 *10601061 * This is managed by the bio_lock instead of being an atomic_t so that10611062 * completion paths can drop their ref and use the remaining count to
-7
fs/ecryptfs/file.c
···3131#include <linux/security.h>3232#include <linux/compat.h>3333#include <linux/fs_stack.h>3434-#include <linux/aio.h>3534#include "ecryptfs_kernel.h"36353736/**···5152 struct file *file = iocb->ki_filp;52535354 rc = generic_file_read_iter(iocb, to);5454- /*5555- * Even though this is a async interface, we need to wait5656- * for IO to finish to update atime5757- */5858- if (-EIOCBQUEUED == rc)5959- rc = wait_on_sync_kiocb(iocb);6055 if (rc >= 0) {6156 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);6257 touch_atime(path);
···11#ifndef __LINUX__AIO_H22#define __LINUX__AIO_H3344-#include <linux/list.h>55-#include <linux/workqueue.h>64#include <linux/aio_abi.h>77-#include <linux/uio.h>88-#include <linux/rcupdate.h>99-1010-#include <linux/atomic.h>115126struct kioctx;137struct kiocb;88+struct mm_struct;1491510#define KIOCB_KEY 016111717-/*1818- * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either1919- * cancelled or completed (this makes a certain amount of sense because2020- * successful cancellation - io_cancel() - does deliver the completion to2121- * userspace).2222- *2323- * And since most things don't implement kiocb cancellation and we'd really like2424- * kiocb completion to be lockless when possible, we use ki_cancel to2525- * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED2626- * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel().2727- */2828-#define KIOCB_CANCELLED ((void *) (~0ULL))2929-3012typedef int (kiocb_cancel_fn)(struct kiocb *);3131-3232-struct kiocb {3333- struct file *ki_filp;3434- struct kioctx *ki_ctx; /* NULL for sync ops */3535- kiocb_cancel_fn *ki_cancel;3636- void *private;3737-3838- union {3939- void __user *user;4040- struct task_struct *tsk;4141- } ki_obj;4242-4343- __u64 ki_user_data; /* user's data for completion */4444- loff_t ki_pos;4545- size_t ki_nbytes; /* copy of iocb->aio_nbytes */4646-4747- struct list_head ki_list; /* the aio core uses this4848- * for cancellation */4949-5050- /*5151- * If the aio_resfd field of the userspace iocb is not zero,5252- * this is the underlying eventfd context to deliver events to.5353- */5454- struct eventfd_ctx *ki_eventfd;5555-};5656-5757-static inline bool is_sync_kiocb(struct kiocb *kiocb)5858-{5959- return kiocb->ki_ctx == NULL;6060-}6161-6262-static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)6363-{6464- *kiocb = (struct kiocb) {6565- .ki_ctx = NULL,6666- .ki_filp = filp,6767- .ki_obj.tsk = current,6868- };6969-}70137114/* prototypes */7215#ifdef CONFIG_AIO7373-extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);7474-extern void aio_complete(struct kiocb *iocb, long res, long res2);7575-struct mm_struct;7616extern void exit_aio(struct mm_struct *mm);7717extern long do_io_submit(aio_context_t ctx_id, long nr,7818 struct iocb __user *__user *iocbpp, bool compat);7919void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);8020#else8181-static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }8282-static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }8383-struct mm_struct;8421static inline void exit_aio(struct mm_struct *mm) { }8522static inline long do_io_submit(aio_context_t ctx_id, long nr,8623 struct iocb __user * __user *iocbpp,···2588static inline void kiocb_set_cancel_fn(struct kiocb *req,2689 kiocb_cancel_fn *cancel) { }2790#endif /* CONFIG_AIO */2828-2929-static inline struct kiocb *list_kiocb(struct list_head *h)3030-{3131- return list_entry(h, struct kiocb, ki_list);3232-}33913492/* for sysctl: */3593extern unsigned long aio_nr;
+22
include/linux/fs.h
···314314struct address_space;315315struct writeback_control;316316317317+#define IOCB_EVENTFD (1 << 0)318318+319319+struct kiocb {320320+ struct file *ki_filp;321321+ loff_t ki_pos;322322+ void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);323323+ void *private;324324+ int ki_flags;325325+};326326+327327+static inline bool is_sync_kiocb(struct kiocb *kiocb)328328+{329329+ return kiocb->ki_complete == NULL;330330+}331331+332332+static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)333333+{334334+ *kiocb = (struct kiocb) {335335+ .ki_filp = filp,336336+ };337337+}338338+317339/*318340 * "descriptor" for what we're up to with a read.319341 * This allows us to use the same read code yet