Re: [squid-users] different size cache_dir usage question

From: Brian <hiryuu@dont-contact.us>
Date: Sun, 07 Jul 2002 18:57:28 -0400

On Sunday 07 July 2002 05:30 pm, Henrik Nordstrom wrote:
> On Sunday 07 July 2002 21.47, Brian wrote:
> > Squid fills the directories based on space remaining (total - in
> > use) instead of percentage. I assume that's to avoid floating
> > point math, but it is kind of annoying with different sized
> > directories.
>
> Patches are welcome if you find something annoying and have a better
> way to deal with it..

This looks reasonably correct. I'll let you know how it goes.

        -- Brian

--- src/store_dir.c.old Wed Mar 28 11:34:41 2001
+++ src/store_dir.c Sun Jul 7 18:55:22 2002
@@ -197,7 +197,9 @@
            continue;
        if (load > least_load)
            continue;
- cur_free = SD->max_size - SD->cur_size;
+ /* Ratio (0 - 65536) of used to max */
+ cur_free = SD->cur_size / ( SD->max_size >> 16 );
+
        /* If the load is equal, then look in more details */
        if (load == least_load) {
            /* closest max_objsize fit */
@@ -205,7 +207,7 @@
                if (SD->max_size > least_objsize || SD->max_size == -1)
                    continue;
            /* most free */
- if (cur_free < most_free)
+ if (cur_free > most_free)
                continue;
        }
        least_load = load;
Received on Sun Jul 07 2002 - 16:57:59 MDT

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