diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-15 20:56:07 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-15 20:56:07 -0500 |
commit | 77ed78e5cf32be1c3fae5c477cc1d78e2e3f17db (patch) | |
tree | 805db8c5c180ee7ee85b3c484461100c91f6c781 /include/linux/aio.h | |
parent | 68bdbdf0b32566e1ebd41415bde9a7c43b47bf48 (diff) | |
parent | f6ff56cd56b83d8edf4b3cffc5c53c56b37a5081 (diff) |
Merge branch 'master'
Diffstat (limited to 'include/linux/aio.h')
-rw-r--r-- | include/linux/aio.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/aio.h b/include/linux/aio.h index 403d71dcb7c..49fd37629ee 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -124,7 +124,7 @@ struct kiocb { (x)->ki_users = 1; \ (x)->ki_key = KIOCB_SYNC_KEY; \ (x)->ki_filp = (filp); \ - (x)->ki_ctx = &tsk->active_mm->default_kioctx; \ + (x)->ki_ctx = NULL; \ (x)->ki_cancel = NULL; \ (x)->ki_dtor = NULL; \ (x)->ki_obj.tsk = tsk; \ @@ -210,8 +210,15 @@ 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 { if (unlikely(atomic_read(&(kioctx)->users) <= 0)) BUG(); atomic_inc(&(kioctx)->users); } while (0) -#define put_ioctx(kioctx) do { if (unlikely(atomic_dec_and_test(&(kioctx)->users))) __put_ioctx(kioctx); else if (unlikely(atomic_read(&(kioctx)->users) < 0)) BUG(); } while (0) +#define get_ioctx(kioctx) do { \ + BUG_ON(unlikely(atomic_read(&(kioctx)->users) <= 0)); \ + atomic_inc(&(kioctx)->users); \ +} while (0) +#define put_ioctx(kioctx) do { \ + BUG_ON(unlikely(atomic_read(&(kioctx)->users) <= 0)); \ + if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ + __put_ioctx(kioctx); \ +} while (0) #define in_aio() !is_sync_wait(current->io_wait) /* may be used for debugging */ |