]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Removed quite pointless mdbox_purge_min_percentage setting.
authorTimo Sirainen <tss@iki.fi>
Tue, 2 Feb 2010 20:23:46 +0000 (22:23 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 2 Feb 2010 20:23:46 +0000 (22:23 +0200)
--HG--
branch : HEAD

doc/example-config/conf.d/mail.conf
src/lib-storage/index/dbox-multi/mdbox-map.c
src/lib-storage/index/dbox-multi/mdbox-settings.c
src/lib-storage/index/dbox-multi/mdbox-settings.h

index 012cef21746192308917116300cf3d9288efc603..4f8393c13a481214e5d4da6ab14107fc041b1ed0 100644 (file)
 # Maximum dbox file age until it's rotated. Typically in days. Day begins
 # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled.
 #mdbox_rotate_interval = 1d
-
-# Don't purge a dbox file until this many % of it contains expunged messages.
-# 0 purges always, 100 purges never.
-#mdbox_purge_min_percentage = 0
index 4699b9c969aff6418957b85fb451445c2a97c923..dc82bd8d556e03c0985a1c90958a092cd52d20aa 100644 (file)
@@ -269,72 +269,6 @@ struct dbox_file_size {
        uoff_t ref0_size;
 };
 
-static void dbox_map_filter_zero_refs(struct dbox_map *map)
-{
-       ARRAY_TYPE(seq_range) new_ref0_file_ids;
-       struct hash_table *hash;
-       struct dbox_file_size *size;
-       struct seq_range_iter iter;
-       const struct mail_index_header *hdr;
-       const struct dbox_map_mail_index_record *rec;
-       const uint16_t *ref16_p;
-       const void *data;
-       uint32_t seq, file_id;
-       unsigned int i;
-       bool expunged;
-       pool_t pool;
-
-       pool = pool_alloconly_create("dbox zero ref count", 8*1024);
-       hash = hash_table_create(default_pool, pool, 0, NULL, NULL);
-
-       /* count file sizes */
-       hdr = mail_index_get_header(map->view);
-       for (seq = 1; seq <= hdr->messages_count; seq++) {
-               mail_index_lookup_ext(map->view, seq, map->map_ext_id,
-                                     &data, &expunged);
-               if (data == NULL || expunged)
-                       continue;
-               rec = data;
-
-               if (!seq_range_exists(&map->ref0_file_ids, rec->file_id))
-                       continue;
-
-               /* this file has at least some zero references. count how many
-                  bytes it has in total and how much of it has refcount=0. */
-               mail_index_lookup_ext(map->view, seq, map->ref_ext_id,
-                                     &data, &expunged);
-               if (data == NULL || expunged)
-                       continue;
-               ref16_p = data;
-
-               size = hash_table_lookup(hash, POINTER_CAST(rec->file_id));
-               if (size == NULL) {
-                       size = p_new(pool, struct dbox_file_size, 1);
-                       hash_table_insert(hash, POINTER_CAST(rec->file_id),
-                                         size);
-               }
-               if (*ref16_p == 0)
-                       size->ref0_size += rec->size;
-               if (size->file_size < rec->offset + rec->size)
-                       size->file_size = rec->offset + rec->size;
-       }
-
-       /* now drop the files that don't have enough deleted space */
-       seq_range_array_iter_init(&iter, &map->ref0_file_ids); i = 0;
-       p_array_init(&new_ref0_file_ids, pool, 
-                    array_count(&map->ref0_file_ids));
-       while (seq_range_array_iter_nth(&iter, i++, &file_id)) {
-               size = hash_table_lookup(hash, POINTER_CAST(file_id));
-               if (size->ref0_size*100 / size->file_size >=
-                   map->set->mdbox_purge_min_percentage)
-                       seq_range_array_add(&new_ref0_file_ids, 0, file_id);
-       }
-       seq_range_array_intersect(&map->ref0_file_ids, &new_ref0_file_ids);
-
-       hash_table_destroy(&hash);
-       pool_unref(&pool);
-}
-
 const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map)
 {
        const struct mail_index_header *hdr;
@@ -349,11 +283,6 @@ const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map)
        else
                i_array_init(&map->ref0_file_ids, 64);
 
-       if (map->set->mdbox_purge_min_percentage >= 100) {
-               /* we're never purging anything */
-               return &map->ref0_file_ids;
-       }
-
        if (dbox_map_open(map, FALSE) < 0) {
                /* some internal error */
                return &map->ref0_file_ids;
@@ -378,9 +307,6 @@ const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map)
                                            rec->file_id);
                }
        }
-       if (map->set->mdbox_purge_min_percentage > 0 &&
-           array_count(&map->ref0_file_ids) > 0)
-               dbox_map_filter_zero_refs(map);
        return &map->ref0_file_ids;
 }
 
index f8ed2c8a37266406b6bbeb9fc1cdbb919368c972..704bb47e9deb256646fe54137e99975701e038b9 100644 (file)
@@ -18,7 +18,6 @@ static const struct setting_define mdbox_setting_defines[] = {
        DEF(SET_SIZE, mdbox_rotate_size),
        DEF(SET_TIME, mdbox_rotate_interval),
        DEF(SET_UINT, mdbox_max_open_files),
-       DEF(SET_UINT, mdbox_purge_min_percentage),
 
        SETTING_DEFINE_LIST_END
 };
@@ -26,8 +25,7 @@ static const struct setting_define mdbox_setting_defines[] = {
 static const struct mdbox_settings mdbox_default_settings = {
        .mdbox_rotate_size = 2*1024*1024,
        .mdbox_rotate_interval = 0,
-       .mdbox_max_open_files = 64,
-       .mdbox_purge_min_percentage = 0
+       .mdbox_max_open_files = 64
 };
 
 static const struct setting_parser_info mdbox_setting_parser_info = {
index 0a68b666de2861b78744752fad5623cc7f2e1d6b..02fd0d0810be9c29057f0f5b4b50528d3599b755 100644 (file)
@@ -5,7 +5,6 @@ struct mdbox_settings {
        uoff_t mdbox_rotate_size;
        unsigned int mdbox_rotate_interval;
        unsigned int mdbox_max_open_files;
-       unsigned int mdbox_purge_min_percentage;
 };
 
 const struct setting_parser_info *mdbox_get_setting_parser_info(void);