From 950967a62753439aadd271b64e31deecf21ea275 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 27 Aug 2012 22:21:39 -0500 Subject: [PATCH] Do not add lookup table entry for empty files --- src/lookup_table.c | 4 ---- src/modify.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lookup_table.c b/src/lookup_table.c index c491f076..d15a3088 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -266,10 +266,6 @@ int write_lookup_table_entry(struct lookup_table_entry *lte, void *__out) out = __out; - /* do not write lookup table entries for empty files */ - if (lte->output_resource_entry.original_size == 0) - return 0; - /* Don't write entries that have not had file resources or metadata * resources written for them. */ if (lte->out_refcnt == 0) diff --git a/src/modify.c b/src/modify.c index 141f2dd8..ff6e106c 100644 --- a/src/modify.c +++ b/src/modify.c @@ -186,6 +186,10 @@ static int build_dentry_tree(struct dentry **root_ret, const char *root_disk_pat struct lookup_table_entry *lte; u8 hash[SHA1_HASH_SIZE]; + /* Empty files do not have to have a lookup table entry. */ + if (root_stbuf.st_size == 0) + goto out; + /* For each regular file, we must check to see if the file is in * the lookup table already; if it is, we increment its refcnt; * otherwise, we create a new lookup table entry and insert it. @@ -219,6 +223,7 @@ static int build_dentry_tree(struct dentry **root_ret, const char *root_disk_pat } root->lte = lte; } +out: *root_ret = root; return ret; } -- 2.43.0