From: Automatic source maintenance Date: Tue, 7 Dec 2010 01:11:16 +0000 (-0700) Subject: Bootstrapped X-Git-Tag: take1~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8a33c466c764bfe3f710353aeef6e22db52b783;p=thirdparty%2Fsquid.git Bootstrapped --- diff --git a/doc/release-notes/release-3.2.sgml b/doc/release-notes/release-3.2.sgml index 91d0c23809..5216ae3ba6 100644 --- a/doc/release-notes/release-3.2.sgml +++ b/doc/release-notes/release-3.2.sgml @@ -459,6 +459,9 @@ This section gives a thorough account of those changes in three categories: concurrency=N previously called auth_param ... concurrency as a separate option.

Removed Basic, Digest, NTLM, Negotiate auth_param ... concurrency setting option. + cache_dir +

min-size option ported from Squid-2 + cache_peer

htcp-* options collapsed into htcp= taking an optional comma-separated list of flags. The old form is deprecated but still accepted. @@ -792,7 +795,6 @@ This section gives an account of those changes in three categories:

Not yet ported from 2.6 cache_dir -

min-size option not yet ported from Squid-2

COSS storage type is lacking stability fixes from 2.6

COSS overwrite-percent= option not yet ported from 2.6

COSS max-stripe-waste= option not yet ported from 2.6 diff --git a/src/SwapDir.cc b/src/SwapDir.cc index 246a05ed40..49071206ee 100644 --- a/src/SwapDir.cc +++ b/src/SwapDir.cc @@ -159,7 +159,7 @@ SwapDir::getOptionTree() const { ConfigOptionVector *result = new ConfigOptionVector; result->options.push_back(new ConfigOptionAdapter(*const_cast(this), &SwapDir::optionReadOnlyParse, &SwapDir::optionReadOnlyDump)); - result->options.push_back(new ConfigOptionAdapter(*const_cast(this), &SwapDir::optionMaxSizeParse, &SwapDir::optionMaxSizeDump)); + result->options.push_back(new ConfigOptionAdapter(*const_cast(this), &SwapDir::optionObjectSizeParse, &SwapDir::optionObjectSizeDump)); return result; } @@ -236,9 +236,14 @@ SwapDir::optionReadOnlyDump(StoreEntry * e) const } bool -SwapDir::optionMaxSizeParse(char const *option, const char *value, int isaReconfig) +SwapDir::optionObjectSizeParse(char const *option, const char *value, int isaReconfig) { - if (strcmp(option, "max-size") != 0) + int64_t *val; + if (strcmp(option, "max-size") == 0) { + val = &max_objsize; + } else if (strcmp(option, "min-size") == 0) { + val = &min_objsize; + } else return false; if (!value) @@ -246,17 +251,20 @@ SwapDir::optionMaxSizeParse(char const *option, const char *value, int isaReconf int64_t size = strtoll(value, NULL, 10); - if (isaReconfig && max_objsize != size) - debugs(3, 1, "Cache dir '" << path << "' max object size now " << size); + if (isaReconfig && *val != size) + debugs(3, 1, "Cache dir '" << path << "' object " << option << " now " << size); - max_objsize = size; + *val = size; return true; } void -SwapDir::optionMaxSizeDump(StoreEntry * e) const +SwapDir::optionObjectSizeDump(StoreEntry * e) const { + if (min_objsize != -1) + storeAppendPrintf(e, " min-size=%"PRId64, min_objsize); + if (max_objsize != -1) storeAppendPrintf(e, " max-size=%"PRId64, max_objsize); } diff --git a/src/SwapDir.h b/src/SwapDir.h index 408bd5c142..340ed30c54 100644 --- a/src/SwapDir.h +++ b/src/SwapDir.h @@ -113,7 +113,7 @@ class SwapDir : public Store { public: - SwapDir(char const *aType) : theType (aType), cur_size(0), max_size(0), max_objsize (-1), cleanLog(NULL) { + SwapDir(char const *aType) : theType (aType), cur_size(0), max_size(0), min_objsize(-1), max_objsize(-1), cleanLog(NULL) { fs.blksize = 1024; path = NULL; } @@ -148,8 +148,8 @@ protected: private: bool optionReadOnlyParse(char const *option, const char *value, int reconfiguring); void optionReadOnlyDump(StoreEntry * e) const; - bool optionMaxSizeParse(char const *option, const char *value, int reconfiguring); - void optionMaxSizeDump(StoreEntry * e) const; + bool optionObjectSizeParse(char const *option, const char *value, int reconfiguring); + void optionObjectSizeDump(StoreEntry * e) const; char const *theType; public: @@ -157,6 +157,7 @@ public: uint64_t max_size; ///< maximum allocatable size of the storage area char *path; int index; /* This entry's index into the swapDirs array */ + int64_t min_objsize; int64_t max_objsize; RemovalPolicy *repl; int removals; diff --git a/src/store_dir.cc b/src/store_dir.cc index 4c5120847b..cacf8fa1d0 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -146,35 +146,30 @@ StoreController::create() #endif } -/* +/** * Determine whether the given directory can handle this object * size * * Note: if the object size is -1, then the only swapdirs that - * will return true here are ones that have max_obj_size = -1, + * will return true here are ones that have min and max unset, * ie any-sized-object swapdirs. This is a good thing. */ bool SwapDir::objectSizeIsAcceptable(int64_t objsize) const { - /* - * If the swapdir's max_obj_size is -1, then it definitely can - */ - - if (max_objsize == -1) + // If the swapdir has no range limits, then it definitely can + if (min_objsize == -1 && max_objsize == -1) return true; /* - * If the object size is -1, then if the storedir isn't -1 we - * can't store it + * If the object size is -1 and the storedir has limits we + * can't store it there. */ - if ((objsize == -1) && (max_objsize != -1)) + if (objsize == -1) return false; - /* - * Else, make sure that the max object size is larger than objsize - */ - return max_objsize > objsize; + // Else, make sure that the object size will fit. + return min_objsize <= objsize && max_objsize > objsize; }