Commit b6aa3898 authored by Matthieu Dorier's avatar Matthieu Dorier

corrected bug

parent 042e0d27
...@@ -89,6 +89,7 @@ int main(int argc, char** argv) ...@@ -89,6 +89,7 @@ int main(int argc, char** argv)
} }
remi_fileset_register_metadata(fileset, "AERED", "qerqwer"); remi_fileset_register_metadata(fileset, "AERED", "qerqwer");
remi_fileset_set_xfer_size(fileset, 4);
// migrate the fileset // migrate the fileset
int status = 0; int status = 0;
ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_KEEP_SOURCE, REMI_USE_ABTIO, &status); ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_KEEP_SOURCE, REMI_USE_ABTIO, &status);
......
...@@ -429,8 +429,6 @@ int migrate_using_abtio( ...@@ -429,8 +429,6 @@ int migrate_using_abtio(
current_chunk_size = remaining_size < max_chunk_size ? remaining_size : max_chunk_size; current_chunk_size = remaining_size < max_chunk_size ? remaining_size : max_chunk_size;
current_buffer.resize(current_chunk_size); current_buffer.resize(current_chunk_size);
auto sizeRead = abt_io_pread(abtio, fd, &current_buffer[0], current_chunk_size, current_chunk_offset); auto sizeRead = abt_io_pread(abtio, fd, &current_buffer[0], current_chunk_size, current_chunk_offset);
current_chunk_offset += current_chunk_size;
remaining_size -= current_chunk_size;
} }
// wait for the RPC to finish // wait for the RPC to finish
ret = async_req.wait(); ret = async_req.wait();
...@@ -439,6 +437,8 @@ int migrate_using_abtio( ...@@ -439,6 +437,8 @@ int migrate_using_abtio(
if(!can_stop) { if(!can_stop) {
previous_chunk_offset = current_chunk_offset; previous_chunk_offset = current_chunk_offset;
previous_chunk_size = current_chunk_size; previous_chunk_size = current_chunk_size;
current_chunk_offset += current_chunk_size;
remaining_size -= current_chunk_size;
std::swap(current_buffer, previous_buffer); std::swap(current_buffer, previous_buffer);
} }
} }
......
...@@ -329,23 +329,23 @@ struct remi_provider : public tl::provider<remi_provider> { ...@@ -329,23 +329,23 @@ struct remi_provider : public tl::provider<remi_provider> {
int fd = op.m_fds[fileNumber]; int fd = op.m_fds[fileNumber];
ssize_t s; ssize_t s;
{ // only HDDs will be locked to avoid concurrent writes { // only HDDs will be locked to avoid concurrent writes
std::lock_guard<device>(*(op.m_devices[fileNumber])); std::lock_guard<device> guard(*(op.m_devices[fileNumber]));
// send an early response so the client can start sending the next chunk // send an early response so the client can start sending the next chunk
// in parallel while this chunk is being written // in parallel while this chunk is being written
ret = REMI_SUCCESS; ret = REMI_SUCCESS;
req.respond(ret); req.respond(ret);
if(m_abtio == ABT_IO_INSTANCE_NULL) { if(m_abtio == ABT_IO_INSTANCE_NULL) {
s = pwrite(fd, data.data(), data.size(), writeOffset); s = pwrite(fd, data.data(), data.size(), writeOffset);
} else { } else {
s = abt_io_pwrite(m_abtio, fd, data.data(), data.size(), writeOffset); s = abt_io_pwrite(m_abtio, fd, data.data(), data.size(), writeOffset);
} }
if(s != data.size()) {
op.m_error = REMI_ERR_IO;
}
} }
if(s != data.size()) {
op.m_error = REMI_ERR_IO;
}
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment