]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Use ATTR_COLD for error/corruption handling functions
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 2 Dec 2021 09:35:20 +0000 (11:35 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 21 Dec 2021 06:21:02 +0000 (06:21 +0000)
This could reduce CPU usage due to better branch prediction.

src/lib-index/mail-cache-private.h
src/lib-index/mail-cache.h
src/lib-index/mail-index-private.h
src/lib-index/mail-index-strmap.h
src/lib-index/mail-index-sync-private.h
src/lib-index/mail-index.h
src/lib-index/mail-transaction-log-private.h
src/lib-index/mail-transaction-log.h

index 4871c9bbb867f64bf45173f3614d84d6fd769394..c2fee1761218ade47360fefd663f4874361064be 100644 (file)
@@ -416,6 +416,6 @@ int mail_cache_expunge_handler(struct mail_index_sync_map_ctx *sync_ctx,
                               const void *data, void **sync_context);
 
 void mail_cache_set_syscall_error(struct mail_cache *cache,
-                                 const char *function);
+                                 const char *function) ATTR_COLD;
 
 #endif
index a42baf84329c5e3b29e77226440238260e0bff5f..09fde2941fbe6d6918128bdd84886ed7089ef710 100644 (file)
@@ -179,9 +179,10 @@ int mail_cache_lookup_headers(struct mail_cache_view *view, string_t *dest,
 
 /* "Error in index cache file %s: ...". */
 void mail_cache_set_corrupted(struct mail_cache *cache, const char *fmt, ...)
-       ATTR_FORMAT(2, 3);
+       ATTR_FORMAT(2, 3) ATTR_COLD;
 void mail_cache_set_seq_corrupted_reason(struct mail_cache_view *cache_view,
-                                        uint32_t seq, const char *reason);
+                                        uint32_t seq, const char *reason)
+       ATTR_COLD;
 
 /* Returns human-readable reason for why a cached field is missing for
    the specified mail. This is mainly for debugging purposes, so the exact
index 7efaf6bf5dc88dda9f01234c85487f60341ceefe..e0736daf5c096a56e3af03f1e8ab52b472a87aad 100644 (file)
@@ -412,15 +412,16 @@ void mail_index_fsck_locked(struct mail_index *index);
 /* Log an error and set it as the index's current error that is available
    with mail_index_get_error_message(). */
 void mail_index_set_error(struct mail_index *index, const char *fmt, ...)
-       ATTR_FORMAT(2, 3);
+       ATTR_FORMAT(2, 3) ATTR_COLD;
 /* Same as mail_index_set_error(), but don't log the error. */
-void mail_index_set_error_nolog(struct mail_index *index, const char *str);
+void mail_index_set_error_nolog(struct mail_index *index, const char *str)
+       ATTR_COLD;
 /* "%s failed with index file %s: %m" */
 void mail_index_set_syscall_error(struct mail_index *index,
-                                 const char *function);
+                                 const char *function) ATTR_COLD;
 /* "%s failed with file %s: %m" */
 void mail_index_file_set_syscall_error(struct mail_index *index,
                                       const char *filepath,
-                                      const char *function);
+                                      const char *function) ATTR_COLD;
 
 #endif
index 5366a9747915ffafc0e7a36f8a3dfb92a2316b99..c61afa629a50a59021f07eda1f26cd95d839fea6 100644 (file)
@@ -56,7 +56,8 @@ mail_index_strmap_view_open(struct mail_index_strmap *strmap,
                            const ARRAY_TYPE(mail_index_strmap_rec) **recs_r,
                            const struct hash2_table **hash_r);
 void mail_index_strmap_view_close(struct mail_index_strmap_view **view);
-void mail_index_strmap_view_set_corrupted(struct mail_index_strmap_view *view);
+void mail_index_strmap_view_set_corrupted(struct mail_index_strmap_view *view)
+       ATTR_COLD;
 
 /* Return the highest used string index. */
 uint32_t mail_index_strmap_view_get_highest_idx(struct mail_index_strmap_view *view);
index 4dbf37be75ade63cf7dc402d68fa325fc0a64ee5..094c83d90b88415d5a57bd05881334cc5b3e234f 100644 (file)
@@ -94,7 +94,8 @@ mail_index_sync_keywords_reset(struct mail_index_sync_map_ctx *ctx,
                               const struct mail_transaction_keyword_reset *r);
 
 void mail_index_sync_set_corrupted(struct mail_index_sync_map_ctx *ctx,
-                                  const char *fmt, ...) ATTR_FORMAT(2, 3);
+                                  const char *fmt, ...)
+       ATTR_FORMAT(2, 3) ATTR_COLD;
 
 #ifdef DEBUG
 void mail_index_map_check(struct mail_index_map *map);
index 4a397f4810f4c054ae242ccfccf5146f9e788d9f..de8c285b8153b38c3bbef2289f2a14894460d4e2 100644 (file)
@@ -556,10 +556,10 @@ bool mail_index_is_locked(struct mail_index *index);
 /* Mark index file corrupted in memory and delete it from disk.
    Invalidates all views. This should be called only for index files that can
    safely be recreated without any data loss. */
-void mail_index_mark_corrupted(struct mail_index *index);
+void mail_index_mark_corrupted(struct mail_index *index) ATTR_COLD;
 /* Check and fix any found problems. Returns -1 if we couldn't lock for sync,
    0 if everything went ok. */
-int mail_index_fsck(struct mail_index *index);
+int mail_index_fsck(struct mail_index *index) ATTR_COLD;
 /* Returns TRUE if mail_index_fsck() has been called since the last
    mail_index_reset_fscked() call. */
 bool mail_index_reset_fscked(struct mail_index *index);
index f08aefb0250fcf6f5071117be73f8a15de05676f..4961fe0ab1ada47721e9a56e392f926b2d38cd6d 100644 (file)
@@ -141,7 +141,7 @@ struct mail_transaction_log {
 void
 mail_transaction_log_file_set_corrupted(struct mail_transaction_log_file *file,
                                        const char *fmt, ...)
-       ATTR_FORMAT(2, 3);
+       ATTR_FORMAT(2, 3) ATTR_COLD;
 
 void mail_transaction_log_get_dotlock_set(struct mail_transaction_log *log,
                                          struct dotlock_settings *set_r);
index 59a6e93cb422501174393cbc7c01760ed7fabcae..c19bb206a00f85058a74aafef663887adf30d5ab 100644 (file)
@@ -450,7 +450,7 @@ bool mail_transaction_log_view_is_last(struct mail_transaction_log_view *view);
 void
 mail_transaction_log_view_set_corrupted(struct mail_transaction_log_view *view,
                                        const char *fmt, ...)
-       ATTR_FORMAT(2, 3);
+       ATTR_FORMAT(2, 3) ATTR_COLD;
 bool
 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view);