The unified diff between revisions [6d9381f5..] and [f35cd536..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "src/fs/aufs/store_dir_aufs.c"
#  from [323cdf961a164cc4a8a1a4c304b20a5bc5d86bd4]
#    to [434e3a5f048cd6111395e88fb1397144b4f2cc14]
#
# patch "src/fs/coss/store_dir_coss.c"
#  from [76fa0c36aeb9fe9686300c9510eee08786bfdb95]
#    to [371e6c070f6001f5e22de7286ec60b880529ff4b]
#
# patch "src/fs/diskd/store_dir_diskd.c"
#  from [914cb5910c1c7948856f7c7ecf30cdb7f32a6b47]
#    to [29790dc96bd0f60cad3f36d201be8a32655cf28d]
#
# patch "src/fs/null/store_null.c"
#  from [e0f5a054b8726ecf54ca634771f958004fa80433]
#    to [eda38ac409bcb678d4d853ce97e8eecb25ee57e7]
#
# patch "src/fs/ufs/store_dir_ufs.c"
#  from [dccf7803c07b1fc7e38e934e671a166bb2d8f560]
#    to [7fea6eabaa15ef88ff1cbbc3b2a8f95da3419aa6]
#
# patch "src/store_dir.c"
#  from [e795049d82fdee67d27f34a53aed344c9c60f488]
#    to [299ef0c831c2b8f781cfe9992ca0912e5baa5792]
#
# patch "src/store_io.c"
#  from [84709eba66ebe42416b22fcea47946e4b37114c8]
#    to [8a31eb00c0678314dbf38b0fa41d2bbd3f96f3b9]
#
# patch "src/typedefs.h"
#  from [46547ecc7cfd53f7995b2043f00d273feaf2a0f5]
#    to [af3aabd123fce77fbe2ce6bfc45c942e516c8640]
#
============================================================
--- src/fs/aufs/store_dir_aufs.c	323cdf961a164cc4a8a1a4c304b20a5bc5d86bd4
+++ src/fs/aufs/store_dir_aufs.c	434e3a5f048cd6111395e88fb1397144b4f2cc14
@@ -1592,29 +1592,13 @@ storeAufsDirMaintain(SwapDir * SD)
  * object is able to be stored on this filesystem. AUFS filesystems will
  * happily store anything as long as the LRU time isn't too small.
  */
-int
+char
 storeAufsDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
-    int loadav;
-    int ql;
-
-#if OLD_UNUSED_CODE
-    if (storeAufsDirExpiredReferenceAge(SD) < 300) {
-	debug(47, 3) ("storeAufsDirCheckObj: NO: LRU Age = %d\n",
-	    storeAufsDirExpiredReferenceAge(SD));
-	/* store_check_cachable_hist.no.lru_age_too_low++; */
-	return -1;
-    }
-#endif
-    ql = aioQueueSize();
-    if (ql == 0)
-	loadav = 0;
-    loadav = ql * 1000 / MAGIC1;
-    debug(47, 9) ("storeAufsDirCheckObj: load=%d\n", loadav);
-    return loadav;
+    return 1;
 }

-char
+int
 storeAufsDirCheckLoadAv(SwapDir *SD, store_op_t op)
 {
 	int loadav, ql;
@@ -1624,7 +1608,7 @@ storeAufsDirCheckLoadAv(SwapDir *SD, sto
 		return 1;
 	}
 	loadav = ql * 1000 / MAGIC1;
-	return (loadav < 1000);
+	return loadav;
 }

 /*
============================================================
--- src/fs/coss/store_dir_coss.c	76fa0c36aeb9fe9686300c9510eee08786bfdb95
+++ src/fs/coss/store_dir_coss.c	371e6c070f6001f5e22de7286ec60b880529ff4b
@@ -691,28 +691,24 @@ storeCossDirShutdown(SwapDir * SD)
  * not store everything. We don't check for maxobjsize here since its
  * done by the upper layers.
  */
-int
+char
 storeCossDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
-    CossInfo *cs = (CossInfo *) SD->fsdata;
-    int loadav;
-
     /* Check if the object is a special object, we can't cache these */
     if (EBIT_TEST(e->flags, ENTRY_SPECIAL))
-	return -1;
-
-    /* Otherwise, we're ok */
-    /* Return load, cs->aq.aq_numpending out of MAX_ASYNCOP */
-    loadav = cs->aq.aq_numpending * 1000 / MAX_ASYNCOP;
-    return loadav;
+	return 0;
+    return 1;
 }

-char
+int
 storeCossDirCheckLoadAv(SwapDir *SD, store_op_t op)
 {
     CossInfo *cs = (CossInfo *) SD->fsdata;
+    int loadav;

-    return (cs->aq.aq_numpending < MAX_ASYNCOP);
+    /* Return load, cs->aq.aq_numpending out of MAX_ASYNCOP */
+    loadav = cs->aq.aq_numpending * 1000 / MAX_ASYNCOP;
+    return loadav;
 }


============================================================
--- src/fs/diskd/store_dir_diskd.c	914cb5910c1c7948856f7c7ecf30cdb7f32a6b47
+++ src/fs/diskd/store_dir_diskd.c	29790dc96bd0f60cad3f36d201be8a32655cf28d
@@ -1820,25 +1820,25 @@ storeDiskdDirMaintain(SwapDir * SD)
  * object is able to be stored on this filesystem. DISKD filesystems will
  * happily store anything as long as the LRU time isn't too small.
  */
-int
+char
 storeDiskdDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
     diskdinfo_t *diskdinfo = SD->fsdata;
     /* Check the queue length */
     if (diskdinfo->away >= diskdinfo->magic1)
-	return -1;
-    /* Calculate the storedir load relative to magic2 on a scale of 0 .. 1000 */
-    /* the parse function guarantees magic2 is positivie */
-    return diskdinfo->away * 1000 / diskdinfo->magic2;
+	return 0;
+    return 1;
 }

-char
+int
 storeDiskdDirCheckLoadAv(SwapDir *SD, store_op_t op)
 {
     diskdinfo_t *diskdinfo = SD->fsdata;
+    /* Calculate the storedir load relative to magic2 on a scale of 0 .. 1000 */
+    /* the parse function guarantees magic2 is positivie */
     if (diskdinfo->away >= diskdinfo->magic1)
-        return 0;
-    return 1;
+	return -1;
+    return diskdinfo->away * 1000 / diskdinfo->magic2;
 }

 /*
============================================================
--- src/fs/null/store_null.c	e0f5a054b8726ecf54ca634771f958004fa80433
+++ src/fs/null/store_null.c	eda38ac409bcb678d4d853ce97e8eecb25ee57e7
@@ -87,19 +87,19 @@ storeNullDirRebuildComplete(void *unused
     storeRebuildComplete(&counts);
 }

-static int
+static char
 storeNullDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
-    return -1;
+    return 0;
 }

 /*
  * We should never, in theory, see an open/create, but just in case..
  */
-static char
+static int
 storeNullDirCheckLoadAv(SwapDir *SD, store_op_t op)
 {
-    return 0;
+    return -1;
 }

 static int
============================================================
--- src/fs/ufs/store_dir_ufs.c	dccf7803c07b1fc7e38e934e671a166bb2d8f560
+++ src/fs/ufs/store_dir_ufs.c	7fea6eabaa15ef88ff1cbbc3b2a8f95da3419aa6
@@ -1614,24 +1614,22 @@ storeUfsDirMaintain(SwapDir * SD)
  * object is able to be stored on this filesystem. UFS filesystems will
  * happily store anything as long as the LRU time isn't too small.
  */
-int
+char
 storeUfsDirCheckObj(SwapDir * SD, const StoreEntry * e)
 {
-    ufsinfo_t *ufsinfo = SD->fsdata;
-    return 500 + ufsinfo->open_files / 2;
+    return 1;
 }

 /*
  * storeUfsDirCheckLoadAv
  *
- * Return 1 whether the store isn't too busy to service the current operation,
- * 0 otherwise.
+ * Return load average from 0 to 1000.
  */
-char
+int
 storeUfsDirCheckLoadAv(SwapDir *SD, store_op_t op)
 {
-	/* ufs will always be fine doing IO. */
-	return 1;
+    ufsinfo_t *ufsinfo = SD->fsdata;
+    return 500 + ufsinfo->open_files / 2;
 }

 /*
============================================================
--- src/store_dir.c	e795049d82fdee67d27f34a53aed344c9c60f488
+++ src/store_dir.c	299ef0c831c2b8f781cfe9992ca0912e5baa5792
@@ -156,7 +156,10 @@ storeDirSelectSwapDirRoundRobin(const St
 	if (!storeDirValidSwapDirSize(dirn, objsize))
 	    continue;
 	/* check for error or overload condition */
-	load = sd->checkobj(sd, e);
+        if (sd->checkobj(sd, e) == 0) {
+            continue;
+        }
+	load = sd->checkload(sd, ST_OP_CREATE);
 	if (load < 0 || load > 1000) {
 	    continue;
 	}
@@ -197,7 +200,10 @@ storeDirSelectSwapDirLeastLoad(const Sto
     for (i = 0; i < Config.cacheSwap.n_configured; i++) {
 	SD = &Config.cacheSwap.swapDirs[i];
 	SD->flags.selected = 0;
-	load = SD->checkobj(SD, e);
+        if (SD->checkobj(SD, e) == 0) {
+            continue;
+        }
+	load = SD->checkload(SD, ST_OP_CREATE);
 	if (load < 0 || load > 1000) {
 	    continue;
 	}
============================================================
--- src/store_io.c	84709eba66ebe42416b22fcea47946e4b37114c8
+++ src/store_io.c	8a31eb00c0678314dbf38b0fa41d2bbd3f96f3b9
@@ -67,11 +67,13 @@ storeOpen(StoreEntry * e, STFNCB * file_
 storeOpen(StoreEntry * e, STFNCB * file_callback, STIOCB * callback,
     void *callback_data)
 {
+    int load;
     storeIOState *sio;

     SwapDir *SD = &Config.cacheSwap.swapDirs[e->swap_dirn];
     store_io_stats.open.calls++;
-    if (SD->checkload(SD, ST_OP_OPEN) == 0) {
+    load = SD->checkload(SD, ST_OP_OPEN);
+    if (load < 0 || load > 1000) {
         store_io_stats.open.loadav_fail++;
         return NULL;
     }
============================================================
--- src/typedefs.h	46547ecc7cfd53f7995b2043f00d273feaf2a0f5
+++ src/typedefs.h	af3aabd123fce77fbe2ce6bfc45c942e516c8640
@@ -288,8 +288,8 @@ typedef void STMAINTAINFS(SwapDir *);
 typedef int STDBLCHECK(SwapDir *, StoreEntry *);
 typedef void STSTATFS(SwapDir *, StoreEntry *);
 typedef void STMAINTAINFS(SwapDir *);
-typedef char STCHECKLOADAV(SwapDir *, store_op_t op);
-typedef int STCHECKOBJ(SwapDir *, const StoreEntry *);
+typedef int STCHECKLOADAV(SwapDir *, store_op_t op);
+typedef char STCHECKOBJ(SwapDir *, const StoreEntry *);
 typedef void STREFOBJ(SwapDir *, StoreEntry *);
 typedef void STUNREFOBJ(SwapDir *, StoreEntry *);
 typedef void STSETUP(storefs_entry_t *);