From: Timo Sirainen Date: Mon, 29 Nov 2021 17:24:30 +0000 (+0100) Subject: lib-storage: Rename mail.mail_stream_opened to mail_stream_accessed X-Git-Tag: 2.3.18~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7b8c4097185e2ab40acf43524f48fcde80f615d;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Rename mail.mail_stream_opened to mail_stream_accessed It is set to TRUE even if the mail stream couldn't successfully be opened, so this describes it better. Also it's now consistent with mail_metadata_accessed. --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-mail.c b/src/lib-storage/index/dbox-multi/mdbox-mail.c index 001af75dcc..22f46427bb 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-mail.c +++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c @@ -103,7 +103,7 @@ int mdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r, mail_set_aborted(_mail); return -1; } - _mail->mail_stream_opened = TRUE; + _mail->mail_stream_accessed = TRUE; do { if (mail->open_file != NULL) { diff --git a/src/lib-storage/index/dbox-single/sdbox-mail.c b/src/lib-storage/index/dbox-single/sdbox-mail.c index d53aa11a38..380fddf286 100644 --- a/src/lib-storage/index/dbox-single/sdbox-mail.c +++ b/src/lib-storage/index/dbox-single/sdbox-mail.c @@ -125,7 +125,7 @@ int sdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r, mail_set_aborted(_mail); return -1; } - _mail->mail_stream_opened = TRUE; + _mail->mail_stream_accessed = TRUE; ret = sdbox_mail_file_set(mail); if (ret < 0) diff --git a/src/lib-storage/index/imapc/imapc-mail-fetch.c b/src/lib-storage/index/imapc/imapc-mail-fetch.c index 03ad26844d..1aaa4f58e3 100644 --- a/src/lib-storage/index/imapc/imapc-mail-fetch.c +++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c @@ -217,7 +217,7 @@ imapc_mail_send_fetch(struct mail *_mail, enum mail_fetch_field fields, mail_set_aborted(_mail); return -1; } - _mail->mail_stream_opened = TRUE; + _mail->mail_stream_accessed = TRUE; /* drop any fields that we may already be fetching currently */ fields &= ENUM_NEGATE(mail->fetching_fields); diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index afa9f4de20..d62ff4a7cf 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -1350,7 +1350,7 @@ int index_mail_init_stream(struct index_mail *mail, bool has_nuls, body_size_from_stream = FALSE; int ret; - _mail->mail_stream_opened = TRUE; + _mail->mail_stream_accessed = TRUE; if (!data->initialized_wrapper_stream && _mail->transaction->stats_track) { @@ -1865,7 +1865,7 @@ static void index_mail_reset_data(struct index_mail *mail) mail->mail.mail.has_nuls = FALSE; mail->mail.mail.has_no_nuls = FALSE; mail->mail.mail.saving = FALSE; - mail->mail.mail.mail_stream_opened = FALSE; + mail->mail.mail.mail_stream_accessed = FALSE; mail->mail.mail.mail_metadata_accessed = FALSE; } diff --git a/src/lib-storage/index/index-mailbox-size.c b/src/lib-storage/index/index-mailbox-size.c index 0ac22bce6f..35b1081dd5 100644 --- a/src/lib-storage/index/index-mailbox-size.c +++ b/src/lib-storage/index/index-mailbox-size.c @@ -330,7 +330,7 @@ index_mailbox_vsize_hdr_add_missing(struct mailbox_vsize_update *update, while (mailbox_search_next(search_ctx, &mail)) { if (mails_left == 0) { - if (mail->mail_stream_opened) { + if (mail->mail_stream_accessed) { /* Seems stream is opened by mailbox search, so we will stop here, and finish it on background. */ index_mailbox_vsize_finish_bg(update, @@ -353,7 +353,8 @@ index_mailbox_vsize_hdr_add_missing(struct mailbox_vsize_update *update, index_mailbox_vsize_finish_bg(update, require_result); break; } - if (mail->mail_stream_opened || mail->mail_metadata_accessed) { + if (mail->mail_stream_accessed || + mail->mail_metadata_accessed) { /* slow vsize lookup */ i_assert(mails_left > 0); mails_left--; diff --git a/src/lib-storage/index/index-sort.c b/src/lib-storage/index/index-sort.c index cf391573a0..924a8d1ae2 100644 --- a/src/lib-storage/index/index-sort.c +++ b/src/lib-storage/index/index-sort.c @@ -171,7 +171,7 @@ void index_sort_list_add(struct mail_search_sort_program *program, struct mail *mail) { enum mail_access_type orig_access_type = mail->access_type; - bool prev_slow = mail->mail_stream_opened || + bool prev_slow = mail->mail_stream_accessed || mail->mail_metadata_accessed; i_assert(mail->transaction == program->t); @@ -188,7 +188,7 @@ void index_sort_list_add(struct mail_search_sort_program *program, } T_END; mail->access_type = orig_access_type; - if (!prev_slow && (mail->mail_stream_opened || + if (!prev_slow && (mail->mail_stream_accessed || mail->mail_metadata_accessed)) { i_assert(program->slow_mails_left > 0); program->slow_mails_left--; @@ -549,7 +549,7 @@ static void index_sort_set_seq(struct mail_search_sort_program *program, struct mail *mail, uint32_t seq) { - if ((mail->mail_stream_opened || mail->mail_metadata_accessed) && + if ((mail->mail_stream_accessed || mail->mail_metadata_accessed) && program->slow_mails_left > 0) program->slow_mails_left--; mail_set_seq(mail, seq); diff --git a/src/lib-storage/index/mbox/mbox-mail.c b/src/lib-storage/index/mbox/mbox-mail.c index 557d409cf2..53e1499309 100644 --- a/src/lib-storage/index/mbox/mbox-mail.c +++ b/src/lib-storage/index/mbox/mbox-mail.c @@ -45,7 +45,7 @@ static int mbox_mail_seek(struct index_mail *mail) mail_set_aborted(_mail); return -1; } - _mail->mail_stream_opened = TRUE; + _mail->mail_stream_accessed = TRUE; if (mbox->mbox_stream != NULL && istream_raw_mbox_is_corrupted(mbox->mbox_stream)) { diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index 8487d520bc..b9c5127e89 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -406,9 +406,10 @@ struct mail { bool has_nuls:1; /* message data is known to contain NULs */ bool has_no_nuls:1; /* -''- known to not contain NULs */ - /* Mail's header/body stream was opened within this request. - If lookup_abort!=MAIL_LOOKUP_ABORT_NEVER, this can't become TRUE. */ - bool mail_stream_opened:1; + /* Mail's header/body stream was opened (or attempted to be opened) + within this request. If lookup_abort!=MAIL_LOOKUP_ABORT_NEVER, this + can't become TRUE. */ + bool mail_stream_accessed:1; /* Mail's fast metadata was accessed within this request, e.g. the mail file was stat()ed. If mail_stream_opened==TRUE, this value isn't accurate anymore, because some backends may always set this when