summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorWilliam Lee Irwin III <wli@holomorphy.com>2004-06-27 23:10:38 -0700
committerDavid S. Miller <davem@nuts.davemloft.net>2004-06-27 23:10:38 -0700
commit20e7c3613deaa345003e75eb3578c8a7717e2199 (patch)
treed3d30144d0eda6cce1a1da5dc05300a99fee2720 /include/linux
parentdeaeb66a2ad03f964a5b6612c0173c72d2f63ba9 (diff)
[AIO]: kiocb->private is too large for kiocb's on-stack.
sizeof(struct kiocb) is dangerously large for a structure commonly allocated on-stack. This patch converts the 24*sizeof(long) field, ->private, to a void pointer for use by file_operations entrypoints. A ->dtor() method is added to the kiocb in order to support the release of dynamically allocated structures referred to by ->private. The sole in-tree users of ->private are async network read/write, which are not, in fact, async, and so need not handle preallocated ->private as they would need to if ->ki_retry were ever used. The sole truly async operations are direct IO pread()/pwrite() which do not now use ->ki_retry(). All they would need to do in that case is to check for ->private already being allocated for async kiocbs. This rips 88B off the stack on 32-bit in the common case. Signed-off-by: William Lee Irwin III <wli@holomorphy.com> Signed-off-by: David S. Miller <davem@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/aio.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 93fe78800740..461a3b0736e0 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -23,8 +23,6 @@ struct kioctx;
#define KIOCB_SYNC_KEY (~0U)
-#define KIOCB_PRIVATE_SIZE (24 * sizeof(long))
-
/* ki_flags bits */
#define KIF_LOCKED 0
#define KIF_KICKED 1
@@ -55,6 +53,7 @@ struct kiocb {
struct kioctx *ki_ctx; /* may be NULL for sync ops */
int (*ki_cancel)(struct kiocb *, struct io_event *);
long (*ki_retry)(struct kiocb *);
+ void (*ki_dtor)(struct kiocb *);
struct list_head ki_list; /* the aio core uses this
* for cancellation */
@@ -65,8 +64,7 @@ struct kiocb {
} ki_obj;
__u64 ki_user_data; /* user's data for completion */
loff_t ki_pos;
-
- char private[KIOCB_PRIVATE_SIZE];
+ void *private;
};
#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
@@ -79,6 +77,7 @@ struct kiocb {
(x)->ki_filp = (filp); \
(x)->ki_ctx = &tsk->active_mm->default_kioctx; \
(x)->ki_cancel = NULL; \
+ (x)->ki_dtor = NULL; \
(x)->ki_obj.tsk = tsk; \
} while (0)