Re: [squid-users] some Squid implementation questions?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 13 Jun 2001 22:52:45 +0200

Sadhna.Ahuja@nokia.com wrote:

> 1. The first time when Squid is run with the -z option, the directory
> structure is created and the file_map is also created for the SwapDir.
> store_dir.c: storeDirConfigure():
> if (NULL == SD->map)
> SD->map = file_map_create();
> Is this info (or the complete SwapDir struct) stored to be used when Squid
> is run again (without -z) ? Or, is a new file_map created again?

the file_map is runtime only, populated when the in-memory cache index
is rebuilt from swap.state.

file_map is only a cache to quickly being able to determine if a store
file numer is free or not.

> 2. How is the Config.cacheSwap structure initialized every time Squid is
> run?

When squid.conf is parsed, and a cache_dir line is seen.

> 3. When an object needs to be deleted from the cache, storeRelease() is
> used. I can see how StoreEntry is removed from the hash table and all the
> structures are freed up. But how is the actual data on the physical disk
> deleted? I don't believe that only resetting the corresponding bit in the
> file_map would be sufficient, right?

By the call to storeUnlink in storeRelease, the line before where the
bit in the file_map is cleared.

> 4. The max number of files in a swap directory is set to FM_INITIAL_NUMBER =
> (1<<14). Is there a specific reason to choose this number?

It is just an arbitrary number. The size of the file_map is grown as
needed. (from Squid-2.3 and onwards. In squid-2.2 and earlier the
file_map size was fixed at startup time with a more complex calculation)

Note: For Squid-2.4 some of this code has changed, and more so in
Squid-2.5. But basic principles are still the same.

--
Henrik Nordstrom
Squid Hacker
Received on Wed Jun 13 2001 - 15:15:12 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:00:44 MST