diff options
author | James Bottomley <James.Bottomley@suse.de> | 2010-07-01 06:49:17 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:23:47 -0400 |
commit | 28018c242a4ec7017bbbf81d2d3952f820a27118 (patch) | |
tree | 03732bef20d0e4dad30d81d9b9ad9ffcf5a2e41c /block/blk-core.c | |
parent | e597cd09f711b28b8466ebdc2f12e55b44fa81e4 (diff) |
block: implement an unprep function corresponding directly to prep
Reviewed-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 3c3789492c10..5ab3ac22930c 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -608,6 +608,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | |||
608 | 608 | ||
609 | q->request_fn = rfn; | 609 | q->request_fn = rfn; |
610 | q->prep_rq_fn = NULL; | 610 | q->prep_rq_fn = NULL; |
611 | q->unprep_rq_fn = NULL; | ||
611 | q->unplug_fn = generic_unplug_device; | 612 | q->unplug_fn = generic_unplug_device; |
612 | q->queue_flags = QUEUE_FLAG_DEFAULT; | 613 | q->queue_flags = QUEUE_FLAG_DEFAULT; |
613 | q->queue_lock = lock; | 614 | q->queue_lock = lock; |
@@ -2133,6 +2134,26 @@ static bool blk_update_bidi_request(struct request *rq, int error, | |||
2133 | return false; | 2134 | return false; |
2134 | } | 2135 | } |
2135 | 2136 | ||
2137 | /** | ||
2138 | * blk_unprep_request - unprepare a request | ||
2139 | * @req: the request | ||
2140 | * | ||
2141 | * This function makes a request ready for complete resubmission (or | ||
2142 | * completion). It happens only after all error handling is complete, | ||
2143 | * so represents the appropriate moment to deallocate any resources | ||
2144 | * that were allocated to the request in the prep_rq_fn. The queue | ||
2145 | * lock is held when calling this. | ||
2146 | */ | ||
2147 | void blk_unprep_request(struct request *req) | ||
2148 | { | ||
2149 | struct request_queue *q = req->q; | ||
2150 | |||
2151 | req->cmd_flags &= ~REQ_DONTPREP; | ||
2152 | if (q->unprep_rq_fn) | ||
2153 | q->unprep_rq_fn(q, req); | ||
2154 | } | ||
2155 | EXPORT_SYMBOL_GPL(blk_unprep_request); | ||
2156 | |||
2136 | /* | 2157 | /* |
2137 | * queue lock must be held | 2158 | * queue lock must be held |
2138 | */ | 2159 | */ |
@@ -2148,6 +2169,10 @@ static void blk_finish_request(struct request *req, int error) | |||
2148 | 2169 | ||
2149 | blk_delete_timer(req); | 2170 | blk_delete_timer(req); |
2150 | 2171 | ||
2172 | if (req->cmd_flags & REQ_DONTPREP) | ||
2173 | blk_unprep_request(req); | ||
2174 | |||
2175 | |||
2151 | blk_account_io_done(req); | 2176 | blk_account_io_done(req); |
2152 | 2177 | ||
2153 | if (req->end_io) | 2178 | if (req->end_io) |