From: Timo Sirainen Date: Wed, 29 Apr 2009 19:08:34 +0000 (-0400) Subject: Split struct mail_private.stats_dentry_lookup_count to open/stat counts. X-Git-Tag: 2.0.alpha1~878 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1eb17e61d3d38372674aa0c55caedb0185a985f5;p=thirdparty%2Fdovecot%2Fcore.git Split struct mail_private.stats_dentry_lookup_count to open/stat counts. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/cydir/cydir-mail.c b/src/lib-storage/index/cydir/cydir-mail.c index bb5f7c9f86..62aa325078 100644 --- a/src/lib-storage/index/cydir/cydir-mail.c +++ b/src/lib-storage/index/cydir/cydir-mail.c @@ -26,7 +26,7 @@ static int cydir_mail_stat(struct mail *mail, struct stat *st_r) if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) return mail_set_aborted(mail); - p->stats_dentry_lookup_count++; + p->stats_stat_lookup_count++; path = cydir_mail_get_path(mail); if (stat(path, st_r) < 0) { if (errno == ENOENT) @@ -100,7 +100,7 @@ cydir_mail_get_stream(struct mail *_mail, struct message_size *hdr_size, int fd; if (mail->data.stream == NULL) { - mail->mail.stats_dentry_lookup_count++; + mail->mail.stats_open_lookup_count++; path = cydir_mail_get_path(_mail); fd = open(path, O_RDONLY); if (fd == -1) { diff --git a/src/lib-storage/index/dbox/dbox-mail.c b/src/lib-storage/index/dbox/dbox-mail.c index 27e17bf5c1..2bb9969732 100644 --- a/src/lib-storage/index/dbox/dbox-mail.c +++ b/src/lib-storage/index/dbox/dbox-mail.c @@ -159,7 +159,7 @@ static int dbox_mail_open(struct dbox_mail *mail, } if (!dbox_file_is_open(mail->open_file)) - mail->imail.mail.stats_dentry_lookup_count++; + mail->imail.mail.stats_open_lookup_count++; if (dbox_file_open(mail->open_file, &deleted) <= 0) return -1; if (deleted) { @@ -237,7 +237,7 @@ static int dbox_mail_get_save_date(struct mail *_mail, time_t *date_r) if (data->save_date == 0) { /* missing / corrupted save time - use the file's ctime */ i_assert(file->fd != -1); - mail->imail.mail.stats_attr_lookup_count++; + mail->imail.mail.stats_fstat_lookup_count++; if (fstat(file->fd, &st) < 0) { mail_storage_set_critical(_mail->box->storage, "fstat(%s) failed: %m", file->current_path); diff --git a/src/lib-storage/index/index-search.c b/src/lib-storage/index/index-search.c index a240840d3a..74fb7a92d1 100644 --- a/src/lib-storage/index/index-search.c +++ b/src/lib-storage/index/index-search.c @@ -1202,8 +1202,9 @@ static bool search_has_static_nonmatches(struct mail_search_arg *arg) static unsigned long long search_mail_get_cost(struct mail_private *mail) { - return mail->stats_dentry_lookup_count * SEARCH_COST_DENTRY + - mail->stats_attr_lookup_count * SEARCH_COST_ATTR + + return mail->stats_open_lookup_count * SEARCH_COST_DENTRY + + mail->stats_stat_lookup_count * SEARCH_COST_DENTRY + + mail->stats_fstat_lookup_count * SEARCH_COST_ATTR + mail->stats_cache_hit_count * SEARCH_COST_CACHE + mail->stats_files_read_count * SEARCH_COST_FILES_READ + (mail->stats_files_read_bytes/1024) * SEARCH_COST_KBYTE; diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index 87200d03ee..33e2214060 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -50,7 +50,7 @@ maildir_open_mail(struct maildir_mailbox *mbox, struct mail *mail, *deleted_r = FALSE; - p->stats_dentry_lookup_count++; + p->stats_open_lookup_count++; if (mail->uid != 0) { if (maildir_file_do(mbox, mail->uid, do_open, &fd) < 0) return NULL; @@ -89,14 +89,14 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st) fd = i_stream_get_fd(imail->data.stream); i_assert(fd != -1); - imail->mail.stats_attr_lookup_count++; + imail->mail.stats_fstat_lookup_count++; if (fstat(fd, st) < 0) { mail_storage_set_critical(&mbox->storage->storage, "fstat(maildir) failed: %m"); return -1; } } else if (mail->uid != 0) { - imail->mail.stats_dentry_lookup_count++; + imail->mail.stats_stat_lookup_count++; ret = maildir_file_do(mbox, mail->uid, do_stat, st); if (ret <= 0) { if (ret == 0) @@ -104,7 +104,7 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st) return -1; } } else { - imail->mail.stats_dentry_lookup_count++; + imail->mail.stats_stat_lookup_count++; path = maildir_save_file_get_path(mail->transaction, mail->seq); if (stat(path, st) < 0) { mail_storage_set_critical(mail->box->storage, diff --git a/src/lib-storage/index/raw/raw-mail.c b/src/lib-storage/index/raw/raw-mail.c index 162bec57b3..2e20c60c36 100644 --- a/src/lib-storage/index/raw/raw-mail.c +++ b/src/lib-storage/index/raw/raw-mail.c @@ -18,7 +18,7 @@ static int raw_mail_stat(struct mail *mail) if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) return mail_set_aborted(mail); - p->stats_attr_lookup_count++; + p->stats_fstat_lookup_count++; st = i_stream_stat(mbox->input, TRUE); if (st == NULL) { mail_storage_set_critical(mail->box->storage, diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index c71bc25302..15a25718c8 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -294,10 +294,9 @@ struct mail_private { /* these statistics are never reset by mail-storage API: */ - /* open(), stat(), .. */ - unsigned long stats_dentry_lookup_count; - /* fstat() mostly */ - unsigned long stats_attr_lookup_count; + unsigned long stats_open_lookup_count; + unsigned long stats_stat_lookup_count; + unsigned long stats_fstat_lookup_count; /* number of files we've opened and read */ unsigned long stats_files_read_count; /* number of bytes we've had to read from files */