Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226858
b: refs/heads/master
c: a8733c7
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Dec 23, 2010
1 parent ba28afd commit da47e9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 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: e9ccc998b70fbe59626f393bb0328402159c6b5c
refs/heads/master: a8733c7baf457b071528e385a0b7d4aaec79287c
9 changes: 8 additions & 1 deletion trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,12 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512);
u64 bad_lba;
int info_valid;
/*
* resid is optional but mostly filled in. When it's unused,
* its value is zero, so we assume the whole buffer transferred
*/
unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd);
unsigned int good_bytes;

if (scmd->request->cmd_type != REQ_TYPE_FS)
return 0;
Expand Down Expand Up @@ -1221,7 +1227,8 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
/* This computation should always be done in terms of
* the resolution of the device's medium.
*/
return (bad_lba - start_lba) * scmd->device->sector_size;
good_bytes = (bad_lba - start_lba) * scmd->device->sector_size;
return min(good_bytes, transferred);
}

/**
Expand Down

0 comments on commit da47e9b

Please sign in to comment.