dovecot-2.0: Split struct mail_private.stats_dentry_lookup_count...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 29 22:10:01 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/1ad6926f46a2
changeset: 9174:1ad6926f46a2
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 29 15:08:34 2009 -0400
description:
Split struct mail_private.stats_dentry_lookup_count to open/stat counts.

diffstat:

6 files changed, 15 insertions(+), 15 deletions(-)
src/lib-storage/index/cydir/cydir-mail.c     |    4 ++--
src/lib-storage/index/dbox/dbox-mail.c       |    4 ++--
src/lib-storage/index/index-search.c         |    5 +++--
src/lib-storage/index/maildir/maildir-mail.c |    8 ++++----
src/lib-storage/index/raw/raw-mail.c         |    2 +-
src/lib-storage/mail-storage-private.h       |    7 +++----

diffs (124 lines):

diff -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/index/cydir/cydir-mail.c
--- a/src/lib-storage/index/cydir/cydir-mail.c	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/index/cydir/cydir-mail.c	Wed Apr 29 15:08:34 2009 -0400
@@ -26,7 +26,7 @@ static int cydir_mail_stat(struct mail *
 	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
 	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 -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/index/dbox/dbox-mail.c
--- a/src/lib-storage/index/dbox/dbox-mail.c	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/index/dbox/dbox-mail.c	Wed Apr 29 15:08:34 2009 -0400
@@ -159,7 +159,7 @@ static int dbox_mail_open(struct dbox_ma
 		}
 
 		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(struc
 	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 -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/index/index-search.c
--- a/src/lib-storage/index/index-search.c	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/index/index-search.c	Wed Apr 29 15:08:34 2009 -0400
@@ -1202,8 +1202,9 @@ static bool search_has_static_nonmatches
 
 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 -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Wed Apr 29 15:08:34 2009 -0400
@@ -50,7 +50,7 @@ maildir_open_mail(struct maildir_mailbox
 
 	*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
 		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
 			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 -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/index/raw/raw-mail.c
--- a/src/lib-storage/index/raw/raw-mail.c	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/index/raw/raw-mail.c	Wed Apr 29 15:08:34 2009 -0400
@@ -18,7 +18,7 @@ static int raw_mail_stat(struct mail *ma
 	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 -r 396cd2e86103 -r 1ad6926f46a2 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Wed Apr 29 14:49:10 2009 -0400
+++ b/src/lib-storage/mail-storage-private.h	Wed Apr 29 15:08:34 2009 -0400
@@ -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 */


More information about the dovecot-cvs mailing list