Compare commits
3 Commits
eba242de7f
...
ded55057cc
Author | SHA1 | Date | |
---|---|---|---|
ded55057cc | |||
7cb78cab40 | |||
468aba1399 |
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
* Corrected file times on S3 and Sia providers
|
* Corrected file times on S3 and Sia providers
|
||||||
* Corrected handling of `chown()` and `chmod()`
|
* Corrected handling of `chown()` and `chmod()`
|
||||||
|
* Fixed erroneous download of chunks during resize
|
||||||
|
|
||||||
## v2.0.1-rc
|
## v2.0.1-rc
|
||||||
|
|
||||||
|
@ -1099,9 +1099,8 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
std::shared_ptr<i_open_file> file;
|
std::shared_ptr<i_open_file> file;
|
||||||
if (fm_->get_open_file(handle, true, file)) {
|
if (fm_->get_open_file(handle, true, file)) {
|
||||||
api_path = file->get_api_path();
|
api_path = file->get_api_path();
|
||||||
i_open_file::native_operation_callback allocator;
|
|
||||||
if (set_allocation_size != 0U) {
|
if (set_allocation_size != 0U) {
|
||||||
allocator = [&](native_handle cur_handle) -> api_error {
|
const auto allocator = [&](native_handle cur_handle) -> api_error {
|
||||||
std::string meta_allocation_size;
|
std::string meta_allocation_size;
|
||||||
utils::calculate_allocation_size(false, 0, new_size,
|
utils::calculate_allocation_size(false, 0, new_size,
|
||||||
meta_allocation_size);
|
meta_allocation_size);
|
||||||
@ -1116,9 +1115,9 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
: api_error::os_error;
|
: api_error::os_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
new_size = file->get_file_size();
|
error = file->native_operation(allocator);
|
||||||
} else {
|
} else {
|
||||||
allocator = [&](native_handle cur_handle) -> api_error {
|
const auto allocator = [&](native_handle cur_handle) -> api_error {
|
||||||
FILE_END_OF_FILE_INFO end_of_file_info{};
|
FILE_END_OF_FILE_INFO end_of_file_info{};
|
||||||
end_of_file_info.EndOfFile.QuadPart = static_cast<LONGLONG>(new_size);
|
end_of_file_info.EndOfFile.QuadPart = static_cast<LONGLONG>(new_size);
|
||||||
return ::SetFileInformationByHandle(cur_handle, FileEndOfFileInfo,
|
return ::SetFileInformationByHandle(cur_handle, FileEndOfFileInfo,
|
||||||
@ -1127,9 +1126,9 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
? api_error::success
|
? api_error::success
|
||||||
: api_error::os_error;
|
: api_error::os_error;
|
||||||
};
|
};
|
||||||
|
error = file->native_operation(new_size, allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = file->native_operation(new_size, allocator);
|
|
||||||
if (file_info != nullptr) {
|
if (file_info != nullptr) {
|
||||||
// Populate file information
|
// Populate file information
|
||||||
api_meta_map meta;
|
api_meta_map meta;
|
||||||
|
@ -301,10 +301,14 @@ auto open_file::native_operation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_empty_file || (read_state_.size() != (last_chunk + 1U))) {
|
if (is_empty_file || (read_state_.size() != (last_chunk + 1U))) {
|
||||||
|
auto old_size = read_state_.size();
|
||||||
read_state_.resize(is_empty_file ? 0U : last_chunk + 1U);
|
read_state_.resize(is_empty_file ? 0U : last_chunk + 1U);
|
||||||
|
|
||||||
if (not is_empty_file) {
|
if (not is_empty_file) {
|
||||||
read_state_[last_chunk] = true;
|
for (std::size_t chunk_index = old_size; chunk_index <= last_chunk;
|
||||||
|
++chunk_index) {
|
||||||
|
read_state_.set(chunk_index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_chunk_size_ = static_cast<std::size_t>(
|
last_chunk_size_ = static_cast<std::size_t>(
|
||||||
@ -570,11 +574,6 @@ auto open_file::write(std::uint64_t write_offset, const data_buffer &data,
|
|||||||
return api_error::os_error;
|
return api_error::os_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t chunk_index = start_chunk_index;
|
|
||||||
chunk_index <= end_chunk_index; ++chunk_index) {
|
|
||||||
read_state_.set(chunk_idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_timeout();
|
reset_timeout();
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user