nvme_disk: Slight code cleanup.
* Add const to rounded_len. * Remove dead store of lba_count: it's really set inside the while loop. No functional change intended.
This commit is contained in:
@@ -723,7 +723,7 @@ nvme_disk_io(void* cookie, io_request* request)
|
|||||||
|
|
||||||
// See if we need to bounce due to rounding.
|
// See if we need to bounce due to rounding.
|
||||||
const off_t rounded_pos = ROUNDDOWN(request->Offset(), block_size);
|
const off_t rounded_pos = ROUNDDOWN(request->Offset(), block_size);
|
||||||
phys_size_t rounded_len = ROUNDUP(request->Length() + (request->Offset()
|
const phys_size_t rounded_len = ROUNDUP(request->Length() + (request->Offset()
|
||||||
- rounded_pos), block_size);
|
- rounded_pos), block_size);
|
||||||
if (rounded_pos != request->Offset() || rounded_len != request->Length())
|
if (rounded_pos != request->Offset() || rounded_len != request->Length())
|
||||||
bounceAll = true;
|
bounceAll = true;
|
||||||
@@ -733,9 +733,6 @@ nvme_disk_io(void* cookie, io_request* request)
|
|||||||
return nvme_disk_bounced_io(handle, request);
|
return nvme_disk_bounced_io(handle, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
nvme_request.lba_start = rounded_pos / block_size;
|
|
||||||
nvme_request.lba_count = rounded_len / block_size;
|
|
||||||
|
|
||||||
// No bouncing was required.
|
// No bouncing was required.
|
||||||
ReadLocker readLocker;
|
ReadLocker readLocker;
|
||||||
if (nvme_request.write)
|
if (nvme_request.write)
|
||||||
@@ -750,6 +747,7 @@ nvme_disk_io(void* cookie, io_request* request)
|
|||||||
|
|
||||||
const uint32 max_io_blocks = handle->info->max_io_blocks;
|
const uint32 max_io_blocks = handle->info->max_io_blocks;
|
||||||
int32 remaining = nvme_request.iovec_count;
|
int32 remaining = nvme_request.iovec_count;
|
||||||
|
nvme_request.lba_start = rounded_pos / block_size;
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
nvme_request.iovec_count = min_c(remaining,
|
nvme_request.iovec_count = min_c(remaining,
|
||||||
NVME_MAX_SGL_DESCRIPTORS / 2);
|
NVME_MAX_SGL_DESCRIPTORS / 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user