From 367bc7bef7e0191167776e4b01378f4489fd5d0e Mon Sep 17 00:00:00 2001 From: Petr Tesarik Date: Fri, 23 Sep 2011 12:28:17 +0200 Subject: [PATCH] Allocate file_block objects from the swap file The file_block objects are also necessary to restore the file from swap, so let's store them there. --- src/file/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/file/file.c b/src/file/file.c index 172518d..7f35f1e 100644 --- a/src/file/file.c +++ b/src/file/file.c @@ -287,8 +287,9 @@ slide_blockoffs(struct file *file, const struct file_block *block, static struct file_block * file_new_block(struct file *file, int flags) { - struct file_block *new = calloc(1, sizeof(struct file_block)); - if (!new) + struct file_block *new; + + if (! (new = swp_malloc(&file->swp, sizeof(struct file_block))) ) return NULL; new->flags = flags; @@ -323,7 +324,7 @@ file_free_block(struct file *file, struct file_block *block) file_cache_put(file->cache, block->dataobj); list_del(&block->lru); - free(block); + swp_free(&file->swp, block); } static bool -- 2.11.4.GIT