Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142091
b: refs/heads/master
c: 8c0bacc
h: refs/heads/master
i:
  142089: 18874cc
  142087: de1064c
v: v3
  • Loading branch information
Boaz Harrosh authored and James Bottomley committed Apr 3, 2009
1 parent 3cd85b8 commit d9ab347
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 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: a9bddd74630b2a1f2dedc537417c372b2d9edc76
refs/heads/master: 8c0baccadc86d9f07e663dd255751dd70e461ba3
42 changes: 24 additions & 18 deletions trunk/drivers/scsi/osd/osd_initiator.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,6 @@ struct osd_request *osd_start_request(struct osd_dev *dev, gfp_t gfp)
}
EXPORT_SYMBOL(osd_start_request);

/*
* If osd_finalize_request() was called but the request was not executed through
* the block layer, then we must release BIOs.
*/
static void _abort_unexecuted_bios(struct request *rq)
{
struct bio *bio;

while ((bio = rq->bio) != NULL) {
rq->bio = bio->bi_next;
bio_endio(bio, 0);
}
}

static void _osd_free_seg(struct osd_request *or __unused,
struct _osd_req_data_segment *seg)
{
Expand All @@ -363,22 +349,42 @@ static void _osd_free_seg(struct osd_request *or __unused,
seg->alloc_size = 0;
}

static void _put_request(struct request *rq , bool is_async)
{
if (is_async) {
WARN_ON(rq->bio);
__blk_put_request(rq->q, rq);
} else {
/*
* If osd_finalize_request() was called but the request was not
* executed through the block layer, then we must release BIOs.
* TODO: Keep error code in or->async_error. Need to audit all
* code paths.
*/
if (unlikely(rq->bio))
blk_end_request(rq, -ENOMEM, blk_rq_bytes(rq));
else
blk_put_request(rq);
}
}

void osd_end_request(struct osd_request *or)
{
struct request *rq = or->request;
/* IMPORTANT: make sure this agrees with osd_execute_request_async */
bool is_async = (or->request->end_io_data == or);

_osd_free_seg(or, &or->set_attr);
_osd_free_seg(or, &or->enc_get_attr);
_osd_free_seg(or, &or->get_attr);

if (rq) {
if (rq->next_rq) {
_abort_unexecuted_bios(rq->next_rq);
blk_put_request(rq->next_rq);
_put_request(rq->next_rq, is_async);
rq->next_rq = NULL;
}

_abort_unexecuted_bios(rq);
blk_put_request(rq);
_put_request(rq, is_async);
}
_osd_request_free(or);
}
Expand Down

0 comments on commit d9ab347

Please sign in to comment.