[dovecot-cvs] dovecot/src/lib istream-file.c,1.28,1.29

tss at dovecot.org tss at dovecot.org
Wed Mar 7 16:51:06 EET 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv30990

Modified Files:
	istream-file.c 
Log Message:
Removed caching from i_stream_stat(). The changes could be important in mbox
syncing.



Index: istream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- istream-file.c	6 Feb 2007 10:40:16 -0000	1.28
+++ istream-file.c	7 Mar 2007 14:51:04 -0000	1.29
@@ -16,8 +16,6 @@
 struct file_istream {
 	struct _istream istream;
 
-        struct timeval fstat_cache_stamp;
-
 	size_t max_buffer_size;
 	uoff_t skip_left;
 
@@ -182,10 +180,6 @@
 
 static void _sync(struct _istream *stream)
 {
-	struct file_istream *fstream = (struct file_istream *) stream;
-
-	fstream->fstat_cache_stamp.tv_sec = 0;
-
 	if (!stream->istream.seekable) {
 		/* can't do anything or data would be lost */
 		return;
@@ -194,29 +188,16 @@
 	stream->skip = stream->pos = 0;
 }
 
-static int fstat_cached(struct file_istream *fstream)
-{
-	if (fstream->fstat_cache_stamp.tv_sec == ioloop_timeval.tv_sec &&
-	    fstream->fstat_cache_stamp.tv_usec == ioloop_timeval.tv_usec)
-		return 0;
-
-	if (fstat(fstream->istream.fd, &fstream->istream.statbuf) < 0) {
-		i_error("file_istream.fstat() failed: %m");
-		return -1;
-	}
-
-	fstream->fstat_cache_stamp = ioloop_timeval;
-	return 0;
-}
-
 static const struct stat *
 _stat(struct _istream *stream, bool exact __attr_unused__)
 {
 	struct file_istream *fstream = (struct file_istream *) stream;
 
 	if (fstream->file) {
-		if (fstat_cached(fstream) < 0)
+		if (fstat(fstream->istream.fd, &fstream->istream.statbuf) < 0) {
+			i_error("file_istream.fstat() failed: %m");
 			return NULL;
+		}
 	}
 
 	return &stream->statbuf;



More information about the dovecot-cvs mailing list