Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14079
b: refs/heads/master
c: d00689a
h: refs/heads/master
i:
  14077: 79d35da
  14075: aef8e5e
  14071: 7c6e6f9
  14063: 8baa3eb
  14047: 96f38e3
  14015: 3c54065
  13951: 022d6f2
  13823: 203f78d
v: v3
  • Loading branch information
Zach Brown authored and Linus Torvalds committed Nov 14, 2005
1 parent f56a78d commit 23f3a82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 20dcae32439384b6863c626bb3b2a09bed65b33e
refs/heads/master: d00689af6b3b6ba9e1fdefec3bd62edc860c385d
17 changes: 12 additions & 5 deletions trunk/fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx)

static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
{
assert_spin_locked(&ctx->ctx_lock);

if (req->ki_dtor)
req->ki_dtor(req);
kmem_cache_free(kiocb_cachep, req);
Expand Down Expand Up @@ -498,6 +500,8 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
req, atomic_read(&req->ki_filp->f_count));

assert_spin_locked(&ctx->ctx_lock);

req->ki_users --;
if (unlikely(req->ki_users < 0))
BUG();
Expand Down Expand Up @@ -619,14 +623,13 @@ static void unuse_mm(struct mm_struct *mm)
* the kiocb (to tell the caller to activate the work
* queue to process it), or 0, if it found that it was
* already queued.
*
* Should be called with the spin lock iocb->ki_ctx->ctx_lock
* held
*/
static inline int __queue_kicked_iocb(struct kiocb *iocb)
{
struct kioctx *ctx = iocb->ki_ctx;

assert_spin_locked(&ctx->ctx_lock);

if (list_empty(&iocb->ki_run_list)) {
list_add_tail(&iocb->ki_run_list,
&ctx->run_list);
Expand Down Expand Up @@ -771,13 +774,15 @@ static ssize_t aio_run_iocb(struct kiocb *iocb)
* Process all pending retries queued on the ioctx
* run list.
* Assumes it is operating within the aio issuer's mm
* context. Expects to be called with ctx->ctx_lock held
* context.
*/
static int __aio_run_iocbs(struct kioctx *ctx)
{
struct kiocb *iocb;
LIST_HEAD(run_list);

assert_spin_locked(&ctx->ctx_lock);

list_splice_init(&ctx->run_list, &run_list);
while (!list_empty(&run_list)) {
iocb = list_entry(run_list.next, struct kiocb,
Expand Down Expand Up @@ -1604,12 +1609,14 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,

/* lookup_kiocb
* Finds a given iocb for cancellation.
* MUST be called with ctx->ctx_lock held.
*/
static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
u32 key)
{
struct list_head *pos;

assert_spin_locked(&ctx->ctx_lock);

/* TODO: use a hash or array, this sucks. */
list_for_each(pos, &ctx->active_reqs) {
struct kiocb *kiocb = list_kiocb(pos);
Expand Down

0 comments on commit 23f3a82

Please sign in to comment.