X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=include%2Flinux%2Faio.h;h=b16a957030f87e16341efe5b41b476a04e742fc2;hb=e3cf95dd6d352954b663d2934110d6e30af2406d;hp=43dc2ebfaa0e0e973e9ffca58ba66909ea7e46d0;hpb=b8522ead3534c6cd06752b47a3bc380956191a2a;p=safe%2Fjmp%2Flinux-2.6 diff --git a/include/linux/aio.h b/include/linux/aio.h index 43dc2eb..b16a957 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -5,9 +5,9 @@ #include #include #include +#include #include -#include #define AIO_MAXSEGS 4 #define AIO_KIOGRP_NR_ATOMIC 8 @@ -86,7 +86,7 @@ struct kioctx; */ struct kiocb { struct list_head ki_run_list; - long ki_flags; + unsigned long ki_flags; int ki_users; unsigned ki_key; /* id of this request */ @@ -105,7 +105,6 @@ struct kiocb { wait_queue_t ki_wait; loff_t ki_pos; - atomic_t ki_bio_count; /* num bio used for this iocb */ void *private; /* State that we remember to be able to restart/retry */ unsigned short ki_opcode; @@ -119,6 +118,12 @@ struct kiocb { struct list_head ki_list; /* the aio core uses this * for cancellation */ + + /* + * If the aio_resfd field of the userspace iocb is not zero, + * this is the underlying file* to deliver event to. + */ + struct file *ki_eventfd; }; #define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY) @@ -179,7 +184,7 @@ struct kioctx { /* This needs improving */ unsigned long user_id; - struct kioctx *next; + struct hlist_node list; wait_queue_head_t wait; @@ -195,48 +200,28 @@ struct kioctx { struct aio_ring_info ring_info; struct delayed_work wq; + + struct rcu_head rcu_head; }; /* prototypes */ extern unsigned aio_max_size; -extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb)); -extern int FASTCALL(aio_put_req(struct kiocb *iocb)); -extern void FASTCALL(kick_iocb(struct kiocb *iocb)); -extern int FASTCALL(aio_complete(struct kiocb *iocb, long res, long res2)); -extern void FASTCALL(__put_ioctx(struct kioctx *ctx)); +#ifdef CONFIG_AIO +extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); +extern int aio_put_req(struct kiocb *iocb); +extern void kick_iocb(struct kiocb *iocb); +extern int aio_complete(struct kiocb *iocb, long res, long res2); +struct mm_struct; +extern void exit_aio(struct mm_struct *mm); +#else +static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } +static inline int aio_put_req(struct kiocb *iocb) { return 0; } +static inline void kick_iocb(struct kiocb *iocb) { } +static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; } struct mm_struct; -extern void FASTCALL(exit_aio(struct mm_struct *mm)); -extern struct kioctx *lookup_ioctx(unsigned long ctx_id); -extern int FASTCALL(io_submit_one(struct kioctx *ctx, - struct iocb __user *user_iocb, struct iocb *iocb)); - -/* semi private, but used by the 32bit emulations: */ -struct kioctx *lookup_ioctx(unsigned long ctx_id); -int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, - struct iocb *iocb)); - -#define get_ioctx(kioctx) do { \ - BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ - atomic_inc(&(kioctx)->users); \ -} while (0) -#define put_ioctx(kioctx) do { \ - BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ - if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ - __put_ioctx(kioctx); \ -} while (0) - -#define in_aio() (unlikely(!is_sync_wait(current->io_wait))) - -/* may be used for debugging */ -#define warn_if_async() \ -do { \ - if (in_aio()) { \ - printk(KERN_ERR "%s(%s:%d) called in async context!\n", \ - __FUNCTION__, __FILE__, __LINE__); \ - dump_stack(); \ - } \ -} while (0) +static inline void exit_aio(struct mm_struct *mm) { } +#endif /* CONFIG_AIO */ #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)