Skip to content

Commit

Permalink
When cfq I/O scheduler is selected, get_request() in __make_request()…
Browse files Browse the repository at this point in the history
… calls

__cfq_get_queue().  __cfq_get_queue() finds an existing queue (struct
cfq_queue) of the current process for the device and returns it.  If it's not
found, __cfq_get_queue() creates and returns a new one if __cfq_get_queue() is
called with __GFP_WAIT flag, or __cfq_get_queue() returns NULL (this means that
get_request() fails) if no __GFP_WAIT flag.

On the other hand, in __make_request(), get_request() is called without
__GFP_WAIT flag at the first time.  Thus, the get_request() fails when there is
no existing queue, typically when it's called for the first I/O request of the
process to the device.

Though it will be followed by get_request_wait() for general case,
__make_request() will just end the I/O with an error (EWOULDBLOCK) when the
request was for read-ahead.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
  • Loading branch information
Kiyoshi Ueda authored and Jens Axboe committed Jun 17, 2005
1 parent c374f12 commit db3b584
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,16 @@ __cfq_get_queue(struct cfq_data *cfqd, unsigned long key, int gfp_mask)
if (new_cfqq) {
cfqq = new_cfqq;
new_cfqq = NULL;
} else if (gfp_mask & __GFP_WAIT) {
} else {
spin_unlock_irq(cfqd->queue->queue_lock);
new_cfqq = kmem_cache_alloc(cfq_pool, gfp_mask);
spin_lock_irq(cfqd->queue->queue_lock);

if (!new_cfqq && !(gfp_mask & __GFP_WAIT))
goto out;

goto retry;
} else
goto out;
}

memset(cfqq, 0, sizeof(*cfqq));

Expand Down

0 comments on commit db3b584

Please sign in to comment.