]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Split struct mail_private.stats_dentry_lookup_count to open/stat counts.
authorTimo Sirainen <tss@iki.fi>
Wed, 29 Apr 2009 19:08:34 +0000 (15:08 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 29 Apr 2009 19:08:34 +0000 (15:08 -0400)
--HG--
branch : HEAD

src/lib-storage/index/cydir/cydir-mail.c
src/lib-storage/index/dbox/dbox-mail.c
src/lib-storage/index/index-search.c
src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/raw/raw-mail.c
src/lib-storage/mail-storage-private.h

index bb5f7c9f861421e1708c9e132d55e1b8ad9a6769..62aa3250786cdfff02f1b7a88355208d3de75550 100644 (file)
@@ -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) {
index 27e17bf5c1199e8bcdc0377424175cb989c9445d..2bb996973274eecb936409552e2b30c861e92ee0 100644 (file)
@@ -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);
index a240840d3ae63168896964595aec0e214fecf569..74fb7a92d1dcc77ab108cb5863aa0b24e944cd37 100644 (file)
@@ -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;
index 87200d03ee9b81ecec734e39a04d02c186a0d17f..33e22140603a626f27fbe83f9432a2ca4cdc547b 100644 (file)
@@ -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,
index 162bec57b3c3944fda524ba1a8e0e03f2ef07b9a..2e20c60c368e4a528b3979f897385390f9fe0492 100644 (file)
@@ -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,
index c71bc25302ae1743f01991a9cc81c1dbb5d081d9..15a25718c86f8f384e69739758bada83ba7a289a 100644 (file)
@@ -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 */