~yolanda.robla/ubuntu/trusty/memcached/add_distribution

« back to all changes in this revision

Viewing changes to slabs.c

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2010-05-12 11:41:22 UTC
  • mto: (3.3.3 squeeze) (1.1.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20100512114122-wpynzm9kb1irw1um
Import upstream version 1.4.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
    int i = POWER_SMALLEST - 1;
101
101
    unsigned int size = sizeof(item) + settings.chunk_size;
102
102
 
103
 
    /* Factor of 2.0 means use the default memcached behavior */
104
 
    if (factor == 2.0 && size < 128)
105
 
        size = 128;
106
 
 
107
103
    mem_limit = limit;
108
104
 
109
105
    if (prealloc) {
120
116
 
121
117
    memset(slabclass, 0, sizeof(slabclass));
122
118
 
123
 
    while (++i < POWER_LARGEST && size <= settings.item_size_max / 2) {
 
119
    while (++i < POWER_LARGEST && size <= settings.item_size_max / factor) {
124
120
        /* Make sure items are always n-byte aligned */
125
121
        if (size % CHUNK_ALIGN_BYTES)
126
122
            size += CHUNK_ALIGN_BYTES - (size % CHUNK_ALIGN_BYTES);
313
309
    if (add_stats != NULL) {
314
310
        if (!stat_type) {
315
311
            /* prepare general statistics for the engine */
 
312
            STATS_LOCK();
316
313
            APPEND_STAT("bytes", "%llu", (unsigned long long)stats.curr_bytes);
317
314
            APPEND_STAT("curr_items", "%u", stats.curr_items);
318
315
            APPEND_STAT("total_items", "%u", stats.total_items);
319
316
            APPEND_STAT("evictions", "%llu",
320
317
                        (unsigned long long)stats.evictions);
 
318
            APPEND_STAT("reclaimed", "%llu",
 
319
                        (unsigned long long)stats.reclaimed);
 
320
            STATS_UNLOCK();
321
321
        } else if (nz_strcmp(nkey, stat_type, "items") == 0) {
322
322
            item_stats(add_stats, c);
323
323
        } else if (nz_strcmp(nkey, stat_type, "slabs") == 0) {