dovecot-2.2: lib-fs: fs-metawrap should prefetch using the same ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 26 15:53:42 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/2f8ccc958a6d
changeset: 15975:2f8ccc958a6d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 26 15:53:30 2013 +0200
description:
lib-fs: fs-metawrap should prefetch using the same file as it uses for reading.

diffstat:

 src/lib-fs/fs-metawrap.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 90d6ba26fb95 -r 2f8ccc958a6d src/lib-fs/fs-metawrap.c
--- a/src/lib-fs/fs-metawrap.c	Tue Feb 26 13:04:50 2013 +0200
+++ b/src/lib-fs/fs-metawrap.c	Tue Feb 26 15:53:30 2013 +0200
@@ -119,7 +119,8 @@
 	flags &= ~FS_OPEN_FLAG_SEEKABLE;
 
 	file->super = fs_file_init(fs->super, path, mode | flags);
-	if (mode == FS_OPEN_MODE_READONLY && (flags & FS_OPEN_FLAG_ASYNC) == 0) {
+	if (file->fs->wrap_metadata && mode == FS_OPEN_MODE_READONLY &&
+	    (flags & FS_OPEN_FLAG_ASYNC) == 0) {
 		/* use async stream for super, so fs_read_stream() won't create
 		   another seekable stream unneededly */
 		file->super_read = fs_file_init(fs->super, path, mode | flags |
@@ -211,7 +212,10 @@
 {
 	struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file;
 
-	return fs_prefetch(file->super, length);
+	if (!file->fs->wrap_metadata)
+		return fs_prefetch(file->super, length);
+	else
+		return fs_prefetch(file->super_read, length);
 }
 
 static ssize_t fs_metawrap_read(struct fs_file *_file, void *buf, size_t size)


More information about the dovecot-cvs mailing list