--------------------- PatchSet 358 Date: 2002/12/13 21:27:01 Author: rbcollins Branch: unify-io Tag: (none) Log: move ufs's maintainfs home Members: src/ufscommon.cc:1.4.10.18->1.4.10.19 src/fs/ufs/store_dir_ufs.cc:1.1.20.20->1.1.20.21 Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.18 retrieving revision 1.4.10.19 diff -u -r1.4.10.18 -r1.4.10.19 --- squid3/src/ufscommon.cc 13 Dec 2002 21:25:04 -0000 1.4.10.18 +++ squid3/src/ufscommon.cc 13 Dec 2002 21:27:01 -0000 1.4.10.19 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.18 2002/12/13 21:25:04 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.19 2002/12/13 21:27:01 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1283,46 +1283,6 @@ return 1; } -void -UFSSwapDir::maintainfs() -{ - StoreEntry *e = NULL; - int removed = 0; - int max_scan; - int max_remove; - double f; - RemovalPurgeWalker *walker; - /* We can't delete objects while rebuilding swap */ - if (store_dirs_rebuilding) { - return; - } else { - f = (double) (cur_size - low_size) / (max_size - low_size); - f = f < 0.0 ? 0.0 : f > 1.0 ? 1.0 : f; - max_scan = (int) (f * 400.0 + 100.0); - max_remove = (int) (f * 70.0 + 10.0); - /* - * This is kinda cheap, but so we need this priority hack? - */ - } - debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", - f, max_scan, max_remove); - walker = repl->PurgeInit(repl, max_scan); - while (1) { - if (cur_size < low_size) - break; - if (removed >= max_remove) - break; - e = walker->Next(walker); - if (!e) - break; /* no more objects */ - removed++; - storeRelease(e); - } - walker->Done(walker); - debug(47, (removed ? 2 : 3)) ("commonUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n", - path, removed, max_remove, f, max_scan); -} - #if 0 /* * commonUfsDirCheckObj Index: squid3/src/fs/ufs/store_dir_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_dir_ufs.cc,v retrieving revision 1.1.20.20 retrieving revision 1.1.20.21 diff -u -r1.1.20.20 -r1.1.20.21 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:25:04 -0000 1.1.20.20 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:27:02 -0000 1.1.20.21 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.20 2002/12/13 21:25:04 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.21 2002/12/13 21:27:02 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -328,3 +328,43 @@ storeAppendPrintf(&sentry, " READ-ONLY"); storeAppendPrintf(&sentry, "\n"); } + +void +UFSSwapDir::maintainfs() +{ + StoreEntry *e = NULL; + int removed = 0; + int max_scan; + int max_remove; + double f; + RemovalPurgeWalker *walker; + /* We can't delete objects while rebuilding swap */ + if (store_dirs_rebuilding) { + return; + } else { + f = (double) (cur_size - low_size) / (max_size - low_size); + f = f < 0.0 ? 0.0 : f > 1.0 ? 1.0 : f; + max_scan = (int) (f * 400.0 + 100.0); + max_remove = (int) (f * 70.0 + 10.0); + /* + * This is kinda cheap, but so we need this priority hack? + */ + } + debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", + f, max_scan, max_remove); + walker = repl->PurgeInit(repl, max_scan); + while (1) { + if (cur_size < low_size) + break; + if (removed >= max_remove) + break; + e = walker->Next(walker); + if (!e) + break; /* no more objects */ + removed++; + storeRelease(e); + } + walker->Done(walker); + debug(47, (removed ? 2 : 3)) ("commonUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n", + path, removed, max_remove, f, max_scan); +}