* squid-2.3.STABLE1-storeio-mod.1.swapout_meta_size.patch * Sat Jan 15 20:45:59 CET 2000 Modified Files in squid/src store_swapout.c Calculate the swap meta data size prior to storeCreate, so the filesystem will know the exact size of the created object (if the content-length is known that is). Index: squid/src/store_swapout.c diff -u squid/src/store_swapout.c:1.1.1.21 squid/src/store_swapout.c:1.1.1.21.4.1 --- squid/src/store_swapout.c:1.1.1.21 Sat Jan 15 00:40:47 2000 +++ squid/src/store_swapout.c Sat Jan 15 20:45:58 2000 @@ -50,6 +50,16 @@ tlv *tlv_list; char *buf; assert(mem); + /* Build the swap metadata, so the filesystem will know how much + * metadata there is to store + */ + debug(20, 5) ("storeSwapOutStart: Begin SwapOut '%s' to dirno %d, fileno %08X\n", + storeUrl(e), e->swap_dirn, e->swap_filen); + tlv_list = storeSwapMetaBuild(e); + buf = storeSwapMetaPack(tlv_list, &swap_hdr_sz); + storeSwapTLVFree(tlv_list); + mem->swap_hdr_sz = (size_t) swap_hdr_sz; + /* Create the swap file */ storeLockObject(e); c = xcalloc(1, sizeof(*c)); c->data = e; @@ -61,19 +71,15 @@ e->swap_dirn = -1; cbdataFree(c); storeUnlockObject(e); + xfree(buf); return; } - /* Should I touch the StoreEntry * when it goes through storeCreate ? */ + /* Pick up the file number if it was assigned immediately */ e->swap_filen = mem->swapout.sio->swap_filen; e->swap_dirn = mem->swapout.sio->swap_dirn; e->swap_status = SWAPOUT_WRITING; + /* write out the swap metadata */ cbdataLock(mem->swapout.sio); - debug(20, 5) ("storeSwapOutStart: Begin SwapOut '%s' to dirno %d, fileno %08X\n", - storeUrl(e), e->swap_dirn, e->swap_filen); - tlv_list = storeSwapMetaBuild(e); - buf = storeSwapMetaPack(tlv_list, &swap_hdr_sz); - storeSwapTLVFree(tlv_list); - mem->swap_hdr_sz = (size_t) swap_hdr_sz; storeWrite(mem->swapout.sio, buf, mem->swap_hdr_sz, 0, xfree); }