From: Timo Sirainen Date: Tue, 22 Oct 2019 16:59:43 +0000 (+0300) Subject: lib-storage: Copy vsize record even when destination mailbox doesn't have it X-Git-Tag: 2.3.9~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=096a532f25610ddfc9583766473dd881366c3086;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Copy vsize record even when destination mailbox doesn't have it It's almost guaranteed that if the source mailbox has vsize then we want the destination mailbox to also have it. This condition now happens mainly when copying mails to a newly created mailbox where the vsize lookups haven't occurred yet. It's better to do this immediately to avoid unnecessarily slow lookups later on. --- diff --git a/src/lib-storage/index/index-storage.c b/src/lib-storage/index/index-storage.c index 49ff555719..8ca20cf305 100644 --- a/src/lib-storage/index/index-storage.c +++ b/src/lib-storage/index/index-storage.c @@ -1015,7 +1015,6 @@ static void index_copy_vsize_extension(struct mail_save_context *ctx, struct mail *src_mail, uint32_t dest_seq) { - unsigned int idx; const uint32_t *vsizep; bool expunged ATTR_UNUSED; @@ -1024,11 +1023,8 @@ index_copy_vsize_extension(struct mail_save_context *ctx, return; uint32_t vsize = *vsizep; - if (mail_index_map_get_ext_idx(ctx->transaction->view->map, - ctx->transaction->box->mail_vsize_ext_id, - &idx) && - vsize < (uint32_t)-1) { - uint32_t vsize = src_imail->data.virtual_size+1; + if (vsize < (uint32_t)-1) { + /* copy the vsize record to the destination index */ mail_index_update_ext(ctx->transaction->itrans, dest_seq, ctx->transaction->box->mail_vsize_ext_id, &vsize, NULL);