login
Header Space

 
 

[PATCH] pack-objects: fix delta cache size accounting

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Linus Torvalds <torvalds@...>, Jon Smirl <jonsmirl@...>, Git Mailing List <git@...>
Date: Friday, December 7, 2007 - 9:27 pm

The wrong value was substracted from delta_cache_size when replacing
a cached delta, as trg_entry->delta_size was used after the old size
had been replaced by the new size.

Noticed by Linus.

Signed-off-by: Nicolas Pitre <nico@cam.org> 
---

On Fri, 7 Dec 2007, Linus Torvalds wrote:


Doh!  Mea culpa.

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 4f44658..350ece4 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1422,10 +1422,6 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
 		}
 	}
 
-	trg_entry->delta = src_entry;
-	trg_entry->delta_size = delta_size;
-	trg->depth = src->depth + 1;
-
 	/*
 	 * Handle memory allocation outside of the cache
 	 * accounting lock.  Compiler will optimize the strangeness
@@ -1439,7 +1435,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
 		trg_entry->delta_data = NULL;
 	}
 	if (delta_cacheable(src_size, trg_size, delta_size)) {
-		delta_cache_size += trg_entry->delta_size;
+		delta_cache_size += delta_size;
 		cache_unlock();
 		trg_entry->delta_data = xrealloc(delta_buf, delta_size);
 	} else {
@@ -1447,6 +1443,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
 		free(delta_buf);
 	}
 
+	trg_entry->delta = src_entry;
+	trg_entry->delta_size = delta_size;
+	trg->depth = src->depth + 1;
+
 	return 1;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Something is broken in repack, Jon Smirl, (Fri Dec 7, 7:05 pm)
Re: Something is broken in repack, Nicolas Pitre, (Mon Dec 10, 3:56 pm)
Re: Something is broken in repack, Jon Smirl, (Mon Dec 10, 4:05 pm)
Re: Something is broken in repack, Morten Welinder, (Mon Dec 10, 4:16 pm)
Re: Something is broken in repack, Nicolas Pitre, (Fri Dec 7, 9:46 pm)
Re: Something is broken in repack, Jon Smirl, (Fri Dec 7, 10:22 pm)
Re: Something is broken in repack, Jon Smirl, (Fri Dec 7, 10:04 pm)
Re: Something is broken in repack, Nicolas Pitre, (Fri Dec 7, 10:28 pm)
Re: Something is broken in repack, Jon Smirl, (Fri Dec 7, 11:29 pm)
Re: Something is broken in repack, David Brown, (Fri Dec 7, 11:37 pm)
Re: Something is broken in repack, Jon Smirl, (Sat Dec 8, 12:22 am)
Re: Something is broken in repack, Nicolas Pitre, (Sat Dec 8, 12:30 am)
Re: Something is broken in repack, Jon Smirl, (Sat Dec 8, 1:01 am)
Re: Something is broken in repack, Nicolas Pitre, (Sat Dec 8, 1:12 am)
Re: Something is broken in repack, Harvey Harrison, (Fri Dec 7, 11:48 pm)
Re: Something is broken in repack, Junio C Hamano, (Sat Dec 8, 6:18 pm)
Re: Something is broken in repack, Nicolas Pitre, (Sun Dec 9, 10:49 pm)
Re: Something is broken in repack, Junio C Hamano, (Sun Dec 9, 4:05 am)
Re: Something is broken in repack, Jon Smirl, (Sun Dec 9, 2:25 pm)
Re: Something is broken in repack, Nicolas Pitre, (Sun Dec 9, 9:07 pm)
Re: Something is broken in repack, Jon Smirl, (Sun Dec 9, 11:19 am)
Re: Something is broken in repack, Harvey Harrison, (Fri Dec 7, 11:44 pm)
Re: Something is broken in repack, Linus Torvalds, (Fri Dec 7, 8:37 pm)
[PATCH] pack-objects: fix delta cache size accounting, Nicolas Pitre, (Fri Dec 7, 9:27 pm)
Re: Something is broken in repack, Jon Smirl, (Mon Dec 10, 10:25 pm)
Re: Something is broken in repack, Nicolas Pitre, (Mon Dec 10, 11:49 pm)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 1:25 am)
Re: Something is broken in repack, Sean, (Tue Dec 11, 2:01 am)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 2:20 am)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 1:29 am)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 9:31 am)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 3:01 am)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 9:49 am)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 11:00 am)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 12:20 pm)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 12:21 pm)
Re: Something is broken in repack, Nicolas Pitre, (Wed Dec 12, 1:12 am)
Re: Something is broken in repack, Nicolas Pitre, (Wed Dec 12, 12:13 pm)
Re: Something is broken in repack, Andreas Ericsson, (Thu Dec 13, 3:32 am)
Re: Something is broken in repack, Wolfram Gloger, (Fri Dec 14, 12:03 pm)
Re: Something is broken in repack, Nicolas Pitre, (Wed Dec 12, 11:48 am)
Re: Something is broken in repack, Nguyen Thai Ngoc Duy, (Thu Dec 13, 9:32 am)
Re: Something is broken in repack, Paolo Bonzini, (Thu Dec 13, 11:32 am)
Re: Something is broken in repack, Johannes Sixt, (Thu Dec 13, 12:39 pm)
Re: Something is broken in repack, Paolo Bonzini, (Thu Dec 13, 12:29 pm)
Re: Something is broken in repack, Linus Torvalds, (Wed Dec 12, 12:37 pm)
Re: Something is broken in repack, Wolfram Gloger, (Fri Dec 14, 12:12 pm)
Re: Something is broken in repack, David Kastrup, (Fri Dec 14, 12:45 pm)
Re: Something is broken in repack, Wolfram Gloger, (Fri Dec 14, 12:59 pm)
Re: Something is broken in repack, Jon Smirl, (Wed Dec 12, 1:12 pm)
Re: Something is broken in repack, David Miller, (Wed Dec 12, 12:42 pm)
Re: Something is broken in repack, Linus Torvalds, (Wed Dec 12, 12:54 pm)
Re: Something is broken in repack, David Kastrup, (Wed Dec 12, 4:05 am)
Re: Something is broken in repack, Wolfram Gloger, (Fri Dec 14, 12:18 pm)
Re: Something is broken in repack, Jon Smirl, (Tue Dec 11, 11:36 am)
Re: Something is broken in repack, Linus Torvalds, (Tue Dec 11, 12:33 pm)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 1:21 pm)
Re: Something is broken in repack, David Miller, (Tue Dec 11, 1:24 pm)
Re: Something is broken in repack, Nicolas Pitre, (Tue Dec 11, 1:44 pm)
Re: Something is broken in repack, Andreas Ericsson, (Tue Dec 11, 4:26 pm)
Re: Something is broken in repack, Daniel Berlin, (Tue Dec 11, 1:28 pm)
Re: Something is broken in repack, Andreas Ericsson, (Tue Dec 11, 3:34 am)
Re: Something is broken in repack, Junio C Hamano, (Mon Dec 10, 10:55 pm)
Re: Something is broken in repack, Nicolas Pitre, (Mon Dec 10, 11:27 pm)
Re: Something is broken in repack, David Kastrup, (Tue Dec 11, 7:08 am)
Re: Something is broken in repack, Pierre Habouzit, (Tue Dec 11, 8:08 am)
Re: Something is broken in repack, David Kastrup, (Tue Dec 11, 8:18 am)
Re: Something is broken in repack, David Brown, (Fri Dec 7, 10:56 pm)
speck-geostationary