From c9f5cb92fa7a2d69ba2b05b58caf7aedc9cfd484 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 15 Jan 2009 12:32:46 +0100 Subject: [PATCH] debug stuff and fixes Signed-off-by: Jens Axboe --- fs/aio.c | 8 ++++++-- mm/filemap.c | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 39ee8d1cbc0a..7d63608532fa 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -681,6 +681,7 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) * queue this on the run list yet) */ iocb->ki_run_list.next = iocb->ki_run_list.prev = NULL; + iocb->ki_retry = NULL; spin_unlock_irq(&ctx->ctx_lock); /* Quit retrying if the i/o has been cancelled */ @@ -695,7 +696,7 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) * Now we are all set to call the retry method in async * context. */ - BUG_ON(current->io_wait != NULL); + BUG_ON(current->io_wait); current->io_wait = &iocb->ki_wq; ret = retry(iocb); current->io_wait = NULL; @@ -710,7 +711,7 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) out: spin_lock_irq(&ctx->ctx_lock); - if (-EIOCBRETRY == ret) { + if (ret == -EIOCBRETRY) { /* * OK, now that we are done with this iteration * and know that there is more left to go, @@ -735,6 +736,7 @@ out: aio_queue_work(ctx); } } + return ret; } @@ -1615,11 +1617,13 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, spin_lock_irq(&ctx->ctx_lock); aio_run_iocb(req); +#if 0 if (!list_empty(&ctx->run_list)) { /* drain the run list */ while (__aio_run_iocbs(ctx)) ; } +#endif spin_unlock_irq(&ctx->ctx_lock); aio_put_req(req); /* drop extra ref to req */ return 0; diff --git a/mm/filemap.c b/mm/filemap.c index eb597d3931d6..4fffb32ba3a7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -548,6 +548,8 @@ int wait_on_page_bit_async(struct page *page, int bit_nr, TASK_UNINTERRUPTIBLE); } + if (ret) + printk("%s: ret=%d\n", __FUNCTION__, ret); return ret; } EXPORT_SYMBOL(wait_on_page_bit_async); @@ -1017,6 +1019,7 @@ static void do_generic_file_read(struct file *filp, loff_t *ppos, pgoff_t last_index; pgoff_t prev_index; unsigned long offset; /* offset into pagecache page */ + unsigned long foo; unsigned int prev_offset; int error; @@ -1033,6 +1036,7 @@ static void do_generic_file_read(struct file *filp, loff_t *ppos, unsigned long nr, ret; cond_resched(); + foo = index; find_page: page = find_get_page(mapping, index); if (!page) { @@ -1126,8 +1130,10 @@ page_ok: page_not_up_to_date: /* Get exclusive access to the page ... */ error = lock_page_async(page, current->io_wait); - if (unlikely(error)) + if (unlikely(error)) { + //WARN(1, "%s: %d on index %lu, page %p\n", current->comm, error, foo, page); goto readpage_error; + } page_not_up_to_date_locked: /* Did it get truncated before we got the lock? */ -- 2.25.1