Compute each session elements's offset and length
authorPhil Miller <mille121@illinois.edu>
Tue, 9 Jul 2013 22:10:58 +0000 (17:10 -0500)
committerPhil Miller <mille121@illinois.edu>
Tue, 20 Aug 2013 23:28:33 +0000 (18:28 -0500)
src/libs/ck-libs/io/ckio.C

index 9227eed12b40267b117b99f24d9804c303f8db1b..b80d99f1a3d1f88084df834b6059e820d84e5f1b 100644 (file)
@@ -215,9 +215,9 @@ namespace Ck { namespace IO {
         WriteSession(FileToken file_, size_t offset_, size_t bytes_, CkCallback complete_)
           : file(&manager->files[file_])
           , sessionOffset(offset_)
-          , myOffset()
+          , myOffset((sessionOffset / file->opts.peStripe + thisIndex) * file->opts.peStripe)
           , sessionBytes(bytes_)
-          , myBytes()
+          , myBytes(min(file->opts.peStripe, sessionOffset + sessionBytes - myOffset))
           , myBytesWritten(0)
           , complete(complete_)
         { }