changeset 8995:e14f1d4b6688 HEAD

Split struct mail_private.stats_dentry_lookup_count to open/stat counts.
author Timo Sirainen <tss@iki.fi>
date Wed, 29 Apr 2009 15:05:53 -0400
parents ace37e01c2e0
children c34010571c02
files 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
diffstat 6 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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:05:53 2009 -0400
@@ -26,7 +26,7 @@
 	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 @@
 	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) {
--- 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:05:53 2009 -0400
@@ -79,7 +79,7 @@
 		return -1;
 
 	if (!dbox_file_is_open(*file_r))
-		mail->imail.mail.stats_dentry_lookup_count++;
+		mail->imail.mail.stats_open_lookup_count++;
 
 	ret = dbox_file_metadata_seek_mail_offset(*file_r, offset, &expunged);
 	if (ret <= 0) {
@@ -255,7 +255,7 @@
 			return -1;
 
 		if (!dbox_file_is_open(mail->open_file))
-			mail->imail.mail.stats_dentry_lookup_count++;
+			mail->imail.mail.stats_open_lookup_count++;
 		ret = dbox_file_get_mail_stream(mail->open_file, offset, &uid,
 						&size, &input, &expunged);
 		if (ret < 0)
--- 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:05:53 2009 -0400
@@ -1202,8 +1202,9 @@
 
 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;
--- 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:05:53 2009 -0400
@@ -50,7 +50,7 @@
 
 	*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 @@
 		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 @@
 			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,
--- 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:05:53 2009 -0400
@@ -18,7 +18,7 @@
 	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,
--- 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:05:53 2009 -0400
@@ -286,10 +286,9 @@
 
 	/* 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 */