Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249111
b: refs/heads/master
c: f60f213
h: refs/heads/master
i:
  249109: f234220
  249107: b5bfea9
  249103: f3abc6e
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Apr 25, 2011
1 parent 2752faf commit e68e4e7
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 81 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: 9d64582071523f6ae19df15c85eaeb22876ebaa4
refs/heads/master: f60f2138a9423432063df0d07dfadbf3decb29ac
159 changes: 79 additions & 80 deletions trunk/drivers/staging/hv/blkvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,85 @@ static int blkvsc_do_flush(struct block_device_context *blkdev)
}


static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)
{
struct blkvsc_request *pend_req, *tmp;
struct blkvsc_request *comp_req, *tmp2;
struct vmscsi_request *vm_srb;

int ret = 0;

DPRINT_DBG(BLKVSC_DRV, "blkvsc_cancel_pending_reqs()");

/* Flush the pending list first */
list_for_each_entry_safe(pend_req, tmp, &blkdev->pending_list,
pend_entry) {
/*
* The pend_req could be part of a partially completed
* request. If so, complete those req first until we
* hit the pend_req
*/
list_for_each_entry_safe(comp_req, tmp2,
&pend_req->group->blkvsc_req_list,
req_entry) {
DPRINT_DBG(BLKVSC_DRV, "completing blkvsc_req %p "
"sect_start %lu sect_count %ld\n",
comp_req,
(unsigned long) comp_req->sector_start,
comp_req->sector_count);

if (comp_req == pend_req)
break;

list_del(&comp_req->req_entry);

if (comp_req->req) {
vm_srb =
&comp_req->request.vstor_packet.
vm_srb;
ret = __blk_end_request(comp_req->req,
(!vm_srb->scsi_status ? 0 : -EIO),
comp_req->sector_count *
blkdev->sector_size);

/* FIXME: shouldn't this do more than return? */
if (ret)
goto out;
}

kmem_cache_free(blkdev->request_pool, comp_req);
}

DPRINT_DBG(BLKVSC_DRV, "cancelling pending request - %p\n",
pend_req);

list_del(&pend_req->pend_entry);

list_del(&pend_req->req_entry);

if (comp_req->req) {
if (!__blk_end_request(pend_req->req, -EIO,
pend_req->sector_count *
blkdev->sector_size)) {
/*
* All the sectors have been xferred ie the
* request is done
*/
DPRINT_DBG(BLKVSC_DRV,
"blkvsc_cancel_pending_reqs() - "
"req %p COMPLETED\n", pend_req->req);
kmem_cache_free(blkdev->request_pool,
pend_req->group);
}
}

kmem_cache_free(blkdev->request_pool, pend_req);
}

out:
return ret;
}

/* Static decl */
static int blkvsc_probe(struct device *dev);
static int blkvsc_remove(struct device *device);
Expand All @@ -507,7 +586,6 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
static int blkvsc_do_inquiry(struct block_device_context *blkdev);
static int blkvsc_do_read_capacity(struct block_device_context *blkdev);
static int blkvsc_do_read_capacity16(struct block_device_context *blkdev);
static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev);
static int blkvsc_do_pending_reqs(struct block_device_context *blkdev);

static int blkvsc_ringbuffer_size = BLKVSC_RING_BUFFER_SIZE;
Expand Down Expand Up @@ -1343,85 +1421,6 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
spin_unlock_irqrestore(&blkdev->lock, flags);
}

static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)
{
struct blkvsc_request *pend_req, *tmp;
struct blkvsc_request *comp_req, *tmp2;
struct vmscsi_request *vm_srb;

int ret = 0;

DPRINT_DBG(BLKVSC_DRV, "blkvsc_cancel_pending_reqs()");

/* Flush the pending list first */
list_for_each_entry_safe(pend_req, tmp, &blkdev->pending_list,
pend_entry) {
/*
* The pend_req could be part of a partially completed
* request. If so, complete those req first until we
* hit the pend_req
*/
list_for_each_entry_safe(comp_req, tmp2,
&pend_req->group->blkvsc_req_list,
req_entry) {
DPRINT_DBG(BLKVSC_DRV, "completing blkvsc_req %p "
"sect_start %lu sect_count %ld\n",
comp_req,
(unsigned long) comp_req->sector_start,
comp_req->sector_count);

if (comp_req == pend_req)
break;

list_del(&comp_req->req_entry);

if (comp_req->req) {
vm_srb =
&comp_req->request.vstor_packet.
vm_srb;
ret = __blk_end_request(comp_req->req,
(!vm_srb->scsi_status ? 0 : -EIO),
comp_req->sector_count *
blkdev->sector_size);

/* FIXME: shouldn't this do more than return? */
if (ret)
goto out;
}

kmem_cache_free(blkdev->request_pool, comp_req);
}

DPRINT_DBG(BLKVSC_DRV, "cancelling pending request - %p\n",
pend_req);

list_del(&pend_req->pend_entry);

list_del(&pend_req->req_entry);

if (comp_req->req) {
if (!__blk_end_request(pend_req->req, -EIO,
pend_req->sector_count *
blkdev->sector_size)) {
/*
* All the sectors have been xferred ie the
* request is done
*/
DPRINT_DBG(BLKVSC_DRV,
"blkvsc_cancel_pending_reqs() - "
"req %p COMPLETED\n", pend_req->req);
kmem_cache_free(blkdev->request_pool,
pend_req->group);
}
}

kmem_cache_free(blkdev->request_pool, pend_req);
}

out:
return ret;
}

static int blkvsc_do_pending_reqs(struct block_device_context *blkdev)
{
struct blkvsc_request *pend_req, *tmp;
Expand Down

0 comments on commit e68e4e7

Please sign in to comment.