ASF Bugzilla – Attachment 18154 Details for
Bug 39380
mod_disk_cache eats memory, has no LFS support, etc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Implement Large File Support in mod_disk_cache
httpd-2.2.1-disk_cache-lfs.patch (text/plain), 4.36 KB, created by
Niklas Edmundsson
on 2006-04-22 09:46:57 UTC
(
hide
)
Description:
Implement Large File Support in mod_disk_cache
Filename:
MIME Type:
Creator:
Niklas Edmundsson
Created:
2006-04-22 09:46:57 UTC
Size:
4.36 KB
patch
obsolete
>diff -ru ../dist/modules/cache/mod_disk_cache.c ./modules/cache/mod_disk_cache.c >--- ../dist/modules/cache/mod_disk_cache.c 2006-04-01 08:26:56.000000000 +0200 >+++ ./modules/cache/mod_disk_cache.c 2006-04-22 11:27:04.000000000 +0200 >@@ -757,9 +757,30 @@ > apr_bucket *e; > disk_cache_object_t *dobj = (disk_cache_object_t*) h->cache_obj->vobj; > >- e = apr_bucket_file_create(dobj->fd, 0, (apr_size_t) dobj->file_size, p, >- bb->bucket_alloc); >- APR_BRIGADE_INSERT_HEAD(bb, e); >+ >+ /* For platforms where the size of the file may be larger than >+ * that which can be stored in a single bucket (where the >+ * length field is an apr_size_t), split it into several >+ * buckets: */ >+ if (sizeof(apr_off_t) > sizeof(apr_size_t) >+ && dobj->file_size > AP_MAX_SENDFILE) { >+ apr_off_t fsize = dobj->file_size; >+ e = apr_bucket_file_create(dobj->fd, 0, AP_MAX_SENDFILE, >+ p, bb->bucket_alloc); >+ while (fsize > AP_MAX_SENDFILE) { >+ APR_BRIGADE_INSERT_TAIL(bb, e); >+ apr_bucket_copy(e, &e); >+ e->start += AP_MAX_SENDFILE; >+ fsize -= AP_MAX_SENDFILE; >+ } >+ e->length = (apr_size_t)fsize; /* Resize just the last bucket */ >+ } >+ else { >+ e = apr_bucket_file_create(dobj->fd, 0, (apr_size_t)dobj->file_size, p, >+ bb->bucket_alloc); >+ } >+ >+ APR_BRIGADE_INSERT_TAIL(bb, e); > e = apr_bucket_eos_create(bb->bucket_alloc); > APR_BRIGADE_INSERT_TAIL(bb, e); > >@@ -1005,8 +1026,8 @@ > dobj->file_size += written; > if (dobj->file_size > conf->maxfs) { > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >- "cache_disk: URL %s failed the size check " >- "(%" APR_OFF_T_FMT ">%" APR_SIZE_T_FMT ")", >+ "disk_cache: URL %s failed the size check " >+ "(%" APR_OFF_T_FMT ">%" APR_OFF_T_FMT ")", > h->cache_obj->key, dobj->file_size, conf->maxfs); > /* Remove the intermediate cache file and return non-APR_SUCCESS */ > file_cache_errorcleanup(dobj, r); >@@ -1029,8 +1050,8 @@ > } > if (dobj->file_size < conf->minfs) { > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >- "cache_disk: URL %s failed the size check " >- "(%" APR_OFF_T_FMT "<%" APR_SIZE_T_FMT ")", >+ "disk_cache: URL %s failed the size check " >+ "(%" APR_OFF_T_FMT "<%" APR_OFF_T_FMT ")", > h->cache_obj->key, dobj->file_size, conf->minfs); > /* Remove the intermediate cache file and return non-APR_SUCCESS */ > file_cache_errorcleanup(dobj, r); >@@ -1117,7 +1138,10 @@ > { > disk_cache_conf *conf = ap_get_module_config(parms->server->module_config, > &disk_cache_module); >- conf->minfs = atoi(arg); >+ >+ if (sscanf(arg, "%" APR_OFF_T_FMT, &conf->minfs) != 1) { >+ return "CacheMinFileSize argument must be an integer representing the min size of a file to cache in bytes."; >+ } > return NULL; > } > static const char >@@ -1125,7 +1149,11 @@ > { > disk_cache_conf *conf = ap_get_module_config(parms->server->module_config, > &disk_cache_module); >- conf->maxfs = atoi(arg); >+ >+ if (sscanf(arg, "%" APR_OFF_T_FMT, &conf->maxfs) != 1) { >+ return "CacheMaxFileSize argument must be an integer representing the max size of a file to cache in bytes."; >+ } >+ > return NULL; > } > >diff -ru ../dist/modules/cache/mod_disk_cache.h ./modules/cache/mod_disk_cache.h >--- ../dist/modules/cache/mod_disk_cache.h 2005-09-29 23:30:30.000000000 +0200 >+++ ./modules/cache/mod_disk_cache.h 2006-04-22 11:22:55.000000000 +0200 >@@ -88,8 +88,8 @@ > apr_size_t cache_root_len; > int dirlevels; /* Number of levels of subdirectories */ > int dirlength; /* Length of subdirectory names */ >- apr_size_t minfs; /* minumum file size for cached files */ >- apr_size_t maxfs; /* maximum file size for cached files */ >+ apr_off_t minfs; /* minumum file size for cached files */ >+ apr_off_t maxfs; /* maximum file size for cached files */ > } disk_cache_conf; > > #endif /*MOD_DISK_CACHE_H*/
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39380
:
18152
|
18154
|
18155
|
18157
|
18158
|
18159
|
18860
|
18861
|
18916
|
18968
|
18969
|
18979
|
18980
|
19418
|
20558
|
21016
|
21519
|
21715
|
22127