NvmfStorageClient: number of LBAs

Number of LBAs in new jNVMf API is no longer 0-based.

Signed-off-by: Jonas Pfefferle <peppe...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-crail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-crail/commit/fb01cdf0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-crail/tree/fb01cdf0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-crail/diff/fb01cdf0

Branch: refs/heads/master
Commit: fb01cdf06649ced6a4df45f679d4278f664cdba0
Parents: db75499
Author: Jonas Pfefferle <peppe...@apache.org>
Authored: Mon Apr 9 15:24:41 2018 +0200
Committer: Jonas Pfefferle <peppe...@apache.org>
Committed: Tue Apr 10 13:19:03 2018 +0200

----------------------------------------------------------------------
 .../org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crail/blob/fb01cdf0/storage-nvmf/src/main/java/org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java
----------------------------------------------------------------------
diff --git 
a/storage-nvmf/src/main/java/org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java
 
b/storage-nvmf/src/main/java/org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java
index e17a013..655a304 100644
--- 
a/storage-nvmf/src/main/java/org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java
+++ 
b/storage-nvmf/src/main/java/org/apache/crail/storage/nvmf/client/NvmfStorageEndpoint.java
@@ -204,7 +204,8 @@ public class NvmfStorageEndpoint implements StorageEndpoint 
{
                long startingLBA = startingAddress / getLBADataSize();
                sqe.setStartingLba(startingLBA);
                /* TODO: on read this potentially overwrites data beyond the 
set limit */
-               short numLogicalBlocks = (short)(getNumLogicalBlocks(buffer) - 
1);
+               short numLogicalBlocks = (short)getNumLogicalBlocks(buffer);
+               buffer.limit(buffer.position() + numLogicalBlocks * 
getLBADataSize());
                sqe.setNumberOfLogicalBlocks(numLogicalBlocks);
                int remoteKey = registeredBufferCache.getRemoteKey(buffer);
                KeyedSglDataBlockDescriptor dataBlockDescriptor = 
sqe.getKeyedSglDataBlockDescriptor();

Reply via email to