dovecot-2.2: doveadm fs delete: Reverted last two patches - they...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 5 10:37:42 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/9b2b3c609367
changeset: 18519:9b2b3c609367
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 05 13:30:38 2015 +0300
description:
doveadm fs delete: Reverted last two patches - they were all completely wrong..

diffstat:

 src/doveadm/doveadm-fs.c |  32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diffs (79 lines):

diff -r 5d67814a596d -r 9b2b3c609367 src/doveadm/doveadm-fs.c
--- a/src/doveadm/doveadm-fs.c	Tue May 05 13:13:42 2015 +0300
+++ b/src/doveadm/doveadm-fs.c	Tue May 05 13:30:38 2015 +0300
@@ -217,14 +217,9 @@
 	fs_deinit(&fs);
 }
 
-struct fs_delete_file {
-	struct fs_file *file;
-	bool finished;
-};
-
 struct fs_delete_ctx {
 	unsigned int files_count;
-	struct fs_delete_file *files;
+	struct fs_file **files;
 };
 
 static bool cmd_fs_delete_ctx_run(struct fs_delete_ctx *ctx)
@@ -233,20 +228,17 @@
 	bool ret = FALSE;
 
 	for (i = 0; i < ctx->files_count; i++) {
-		if (ctx->files[i].file == NULL || ctx->files[i].finished)
+		if (ctx->files[i] == NULL)
 			;
-		else if (fs_delete(ctx->files[i].file) == 0) {
-			fs_file_deinit(&ctx->files[i].file);
-			ctx->files[i].finished = TRUE;
-		} else if (errno == EAGAIN)
+		else if (fs_delete(ctx->files[i]) == 0)
+			fs_file_deinit(&ctx->files[i]);
+		else if (errno == EAGAIN)
 			ret = TRUE;
 		else {
 			i_error("fs_delete(%s) failed: %s",
-				fs_file_path(ctx->files[i].file),
-				fs_file_last_error(ctx->files[i].file));
+				fs_file_path(ctx->files[i]),
+				fs_file_last_error(ctx->files[i]));
 			doveadm_exit_code = EX_TEMPFAIL;
-			fs_file_deinit(&ctx->files[i].file);
-			ctx->files[i].finished = TRUE;
 		}
 	}
 	return ret;
@@ -264,7 +256,7 @@
 
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.files_count = I_MAX(async_count, 1);
-	ctx.files = t_new(struct fs_delete_file, ctx.files_count);
+	ctx.files = t_new(struct fs_file *, ctx.files_count);
 
 	/* delete subdirs first. all fs backends can't handle recursive
 	   lookups, so save the list first. */
@@ -309,10 +301,10 @@
 		fname = *fnamep;
 	retry:
 		for (i = 0; i < ctx.files_count; i++) {
-			if (ctx.files[i].file != NULL || ctx.files[i].finished)
+			if (ctx.files[i] != NULL)
 				continue;
 
-			ctx.files[i].file = fs_file_init(fs,
+			ctx.files[i] = fs_file_init(fs,
 				t_strdup_printf("%s%s", path_prefix, fname),
 				FS_OPEN_MODE_READONLY | FS_OPEN_FLAG_ASYNC |
 				FS_OPEN_FLAG_ASYNC_NOQUEUE);
@@ -337,8 +329,8 @@
 		}
 	}
 	for (i = 0; i < ctx.files_count; i++) {
-		if (ctx.files[i].file != NULL)
-			fs_file_deinit(&ctx.files[i].file);
+		if (ctx.files[i] != NULL)
+			fs_file_deinit(&ctx.files[i]);
 	}
 }
 


More information about the dovecot-cvs mailing list