fix fallocate issue when filesystem doesn't support it

This commit is contained in:
Arvid Norberg 2013-06-24 03:26:17 +00:00
parent f41ceab27c
commit 1523a196e5
2 changed files with 17 additions and 3 deletions

View File

@ -2096,7 +2096,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
// way. If fallocate failed with some other error, it
// probably means the user should know about it, error out
// and report it.
if (errno != ENOSYS && errno != EOPNOTSUPP)
if (errno != ENOSYS && errno != EOPNOTSUPP && errno != EINVAL)
{
ec.assign(errno, get_posix_category());
return false;

View File

@ -678,17 +678,31 @@ void test_remove(std::string const& test_path, bool unbuffered)
s->m_settings = &set;
s->m_disk_pool = &dp;
if (s->error())
{
TEST_ERROR(s->error().message().c_str());
fprintf(stderr, "default_storage::constructor %s: %s\n", s->error().message().c_str(), s->error_file().c_str());
}
// allocate the files and create the directories
s->initialize(true);
TEST_CHECK(!s->error());
if (s->error())
fprintf(stderr, "%s: %s\n", s->error().message().c_str(), s->error_file().c_str());
{
TEST_ERROR(s->error().message().c_str());
fprintf(stderr, "default_storage::initialize %s: %s\n", s->error().message().c_str(), s->error_file().c_str());
}
TEST_CHECK(exists(combine_path(test_path, combine_path("temp_storage", combine_path("_folder3", combine_path("subfolder", "test5.tmp"))))));
TEST_CHECK(exists(combine_path(test_path, combine_path("temp_storage", combine_path("folder2", "test3.tmp")))));
s->delete_files();
if (s->error())
{
TEST_ERROR(s->error().message().c_str());
fprintf(stderr, "default_storage::delete_files %s: %s\n", s->error().message().c_str(), s->error_file().c_str());
}
TEST_CHECK(!exists(combine_path(test_path, "temp_storage")));
}