Lines Matching refs:storage
13 #include "mdbox-storage.h"
17 #include "mdbox-storage-rebuild.h"
47 struct mdbox_storage *storage;
68 mdbox_storage_rebuild_init(struct mdbox_storage *storage,
73 i_assert(!storage->rebuilding_storage);
76 ctx->storage = storage;
84 ctx->storage->rebuilding_storage = TRUE;
91 i_assert(ctx->storage->rebuilding_storage);
93 ctx->storage->rebuilding_storage = FALSE;
223 ctx->storage->storage_dir, guid,
289 (unlikely) or it exists in both alt and primary storage.
297 file = mdbox_file_init(ctx->storage, file_id);
329 ctx->storage->map->map_ext_id,
336 struct mdbox_map *map = ctx->storage->map;
528 hdr.map_uid_validity = mdbox_map_get_uid_validity(mbox->storage->map);
560 if (box->storage != &ctx->storage->storage.storage) {
592 mail_index_sync_set_reason(sync_ctx, "mdbox storage rebuild");
636 struct mail_storage *storage = &ctx->storage->storage.storage;
639 for (ns = storage->user->namespaces; ns != NULL; ns = ns->next) {
640 if (ns->storage == storage && ns->alias_for == NULL) {
646 i_panic("No namespace found for storage=%s", storage->name);
652 mail_index_sync_set_reason(msg->sync_ctx, "mdbox storage rebuild");
663 struct mail_storage *storage = &ctx->storage->storage.storage;
677 file = mdbox_file_init(ctx->storage, msg->file_id);
713 i_assert(box->storage == storage);
828 ctx->storage->map->ref_ext_id,
833 ctx->storage->map->ref_ext_id,
842 ctx->storage->map->ref_ext_id,
863 ctx->storage->map->map_ext_id,
881 mail_storage_set_critical(&ctx->storage->storage.storage,
892 mail_storage_set_critical(&ctx->storage->storage.storage,
897 mail_storage_set_critical(&ctx->storage->storage.storage,
909 if (mdbox_map_open_or_create(ctx->storage->map) < 0)
914 if (mdbox_map_atomic_lock(ctx->atomic, "mdbox storage rebuild") < 0)
918 if (mail_index_fsck(ctx->storage->map->index) < 0) {
919 mail_storage_set_index_error(&ctx->storage->storage.storage,
920 ctx->storage->map->index);
926 ctx->storage->map->map_ext_id,
933 /* get storage rebuild counter after locking */
934 ctx->rebuild_count = mdbox_map_get_rebuild_count(ctx->storage->map);
935 if (ctx->rebuild_count != ctx->storage->corrupted_rebuild_count &&
936 ctx->storage->corrupted) {
937 /* storage was already rebuilt by someone else */
941 i_warning("mdbox %s: rebuilding indexes", ctx->storage->storage_dir);
943 if (mdbox_storage_rebuild_scan_dir(ctx, ctx->storage->storage_dir,
946 if (ctx->storage->alt_storage_dir != NULL) {
948 ctx->storage->alt_storage_dir, TRUE) < 0)
961 int mdbox_storage_rebuild_in_context(struct mdbox_storage *storage,
967 if (dbox_verify_alt_storage(storage->map->root_list) < 0) {
968 mail_storage_set_critical(&storage->storage.storage,
969 "mdbox rebuild: Alt storage %s not mounted, aborting",
970 storage->alt_storage_dir);
975 ctx = mdbox_storage_rebuild_init(storage, atomic);
980 storage->corrupted = FALSE;
981 storage->corrupted_rebuild_count = 0;
986 int mdbox_storage_rebuild(struct mdbox_storage *storage)
991 atomic = mdbox_map_atomic_begin(storage->map);
992 ret = mdbox_storage_rebuild_in_context(storage, atomic);