2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

files-reg.c: modify the check of ghost_limit to support large sparse files

files-reg.c checks whether the file size is larger than ghost_limit with st_size
(in dump_ghost_remap), which can not deal with large ghost sparse file, since
its actual file size is not the same as what st_size shows.

Therefore, in this commit, I replace st_size with st_blocks, which shows the
actual file size. (1 block = 512B), thus criu can deal with large ghost sparse
file.

Signed-off-by: Liang-Chun Chen <featherclc@gmail.com>
This commit is contained in:
Liang-Chun Chen
2022-07-26 23:39:33 +08:00
committed by Andrei Vagin
parent 01b8d40ced
commit fbded79788

View File

@@ -29,6 +29,7 @@
* and checked.
*/
#define BUILD_ID_MAP_SIZE 1048576
#define ST_UNIT 512
#include "cr_options.h"
#include "imgset.h"
@@ -946,8 +947,8 @@ static int dump_ghost_remap(char *path, const struct stat *st, int lfd, u32 id,
pr_info("Dumping ghost file for fd %d id %#x\n", lfd, id);
if (st->st_size > opts.ghost_limit) {
pr_err("Can't dump ghost file %s of %" PRIu64 " size, increase limit\n", path, st->st_size);
if (st->st_blocks * ST_UNIT > opts.ghost_limit) {
pr_err("Can't dump ghost file %s of %" PRIu64 " size, increase limit\n", path, st->st_blocks * ST_UNIT);
return -1;
}