[dovecot-cvs] dovecot/src/lib istream-file.c,1.26.2.1,1.26.2.2

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


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

Modified Files:
      Tag: branch_1_0
	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.26.2.1
retrieving revision 1.26.2.2
diff -u -d -r1.26.2.1 -r1.26.2.2
--- istream-file.c	7 Nov 2006 13:58:52 -0000	1.26.2.1
+++ istream-file.c	7 Mar 2007 14:51:01 -0000	1.26.2.2
@@ -16,8 +16,6 @@
 struct file_istream {
 	struct _istream istream;
 
-        struct timeval fstat_cache_stamp;
-
 	size_t max_buffer_size;
 	uoff_t skip_left;
 
@@ -179,10 +177,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;
@@ -191,29 +185,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