Skip to content

Commit

Permalink
lib-index: fsck now adds MAIL_INDEX_HDR_FLAG_FSCKD to header.
Browse files Browse the repository at this point in the history
It can only be removed by an explicit header update.
  • Loading branch information
sirainen committed Nov 25, 2016
1 parent 745c851 commit ead5dce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib-index/mail-index-fsck.c
Expand Up @@ -433,6 +433,7 @@ mail_index_fsck_map(struct mail_index *index, struct mail_index_map *map)
mail_index_fsck_extensions(index, map, &hdr);
mail_index_fsck_records(index, map, &hdr);

hdr.flags |= MAIL_INDEX_HDR_FLAG_FSCKD;
map->hdr = hdr;
i_assert(map->hdr_copy_buf->used == map->hdr.header_size);
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib-index/mail-index-sync-update.c
Expand Up @@ -1012,6 +1012,8 @@ int mail_index_sync_map(struct mail_index_map **_map,
mail_transaction_log_view_get_prev_pos(view->log_view,
&prev_seq, &prev_offset);
map = mail_index_map_alloc(index);
if ((index->map->hdr.flags & MAIL_INDEX_HDR_FLAG_FSCKD) != 0)
map->hdr.flags |= MAIL_INDEX_HDR_FLAG_FSCKD;
map->hdr.log_file_seq = prev_seq;
map->hdr.log_file_tail_offset = 0;
mail_index_sync_replace_map(&sync_map_ctx, map);
Expand Down
5 changes: 4 additions & 1 deletion src/lib-index/mail-index.h
Expand Up @@ -46,7 +46,10 @@ enum mail_index_header_compat_flags {
enum mail_index_header_flag {
/* Index file is corrupted, reopen or recreate it. */
MAIL_INDEX_HDR_FLAG_CORRUPTED = 0x0001,
MAIL_INDEX_HDR_FLAG_HAVE_DIRTY = 0x0002
MAIL_INDEX_HDR_FLAG_HAVE_DIRTY = 0x0002,
/* Index has been fsck'd. The caller may want to resync the index
to make sure it's valid and drop this flag. */
MAIL_INDEX_HDR_FLAG_FSCKD = 0x0004,
};

enum mail_index_mail_flags {
Expand Down

0 comments on commit ead5dce

Please sign in to comment.