libfiemap: delete unuseful check
Just let fallocate fails. It also doesn't check for the delta between the old file and the new file. Test: unit tests Change-Id: I05e12b097a973d9fe7fe696cc472bd7ec2d180c7
This commit is contained in:
parent
d1e9812217
commit
0ede9b43e5
|
@ -233,8 +233,7 @@ static uint64_t GetFileSize(const std::string& file_path) {
|
|||
return sb.st_size;
|
||||
}
|
||||
|
||||
static bool PerformFileChecks(const std::string& file_path, uint64_t file_size, uint64_t* blocksz,
|
||||
uint32_t* fs_type) {
|
||||
static bool PerformFileChecks(const std::string& file_path, uint64_t* blocksz, uint32_t* fs_type) {
|
||||
struct statfs64 sfs;
|
||||
if (statfs64(file_path.c_str(), &sfs)) {
|
||||
PLOG(ERROR) << "Failed to read file system status at: " << file_path;
|
||||
|
@ -258,12 +257,6 @@ static bool PerformFileChecks(const std::string& file_path, uint64_t file_size,
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t available_bytes = sfs.f_bsize * sfs.f_bavail;
|
||||
if (access(file_path.c_str(), F_OK) != 0 && available_bytes <= file_size) {
|
||||
LOG(ERROR) << "Not enough free space in file system to create file of size : " << file_size;
|
||||
return false;
|
||||
}
|
||||
|
||||
*blocksz = sfs.f_bsize;
|
||||
*fs_type = sfs.f_type;
|
||||
return true;
|
||||
|
@ -732,7 +725,7 @@ FiemapUniquePtr FiemapWriter::Open(const std::string& file_path, uint64_t file_s
|
|||
|
||||
uint64_t blocksz;
|
||||
uint32_t fs_type;
|
||||
if (!PerformFileChecks(abs_path, file_size, &blocksz, &fs_type)) {
|
||||
if (!PerformFileChecks(abs_path, &blocksz, &fs_type)) {
|
||||
LOG(ERROR) << "Failed to validate file or file system for file:" << abs_path;
|
||||
cleanup(abs_path, create);
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue