On Thu, 14 Feb 2013, Brian K. White wrote:

On 2/14/2013 9:50 AM, Dag Wieers wrote:

 Since a --direct-io feature was requested a few times the past decade
 with little response and the actual patch is quite trivial, I patched
 both v3.0.9 and master branch and included the patches here.

When I drop the 3.0.9 diff into my otherwise working spec file for 3.0.9 on opensuse build service, it patches and builds with no error, but "make test" fails:

Attached is an updated patch which takes care of the test cases.

Kind regards,
--
-- dag wieers, d...@wieers.com, http://dag.wieers.com/
-- dagit linux solutions, i...@dagit.net, http://dagit.net/

[Any errors in spelling, tact or fact are transmission errors]
--- options.c.direct-io	2011-09-14 00:41:26.000000000 +0200
+++ options.c	2013-02-14 14:19:08.000000000 +0100
@@ -120,6 +120,7 @@
 int checksum_seed = 0;
 int inplace = 0;
 int delay_updates = 0;
+int direct_io = 0;
 long block_size = 0; /* "long" because popt can't set an int32. */
 char *skip_compress = NULL;
 
@@ -381,6 +382,7 @@
   rprintf(F,"     --partial               keep partially transferred files\n");
   rprintf(F,"     --partial-dir=DIR       put a partially transferred file into DIR\n");
   rprintf(F,"     --delay-updates         put all updated files into place at transfer's end\n");
+  rprintf(F,"     --direct-io             don't use buffer cache for files being transferedd\n");
   rprintf(F," -m, --prune-empty-dirs      prune empty directory chains from the file-list\n");
   rprintf(F,"     --numeric-ids           don't map uid/gid values by user/group name\n");
   rprintf(F,"     --timeout=SECONDS       set I/O timeout in seconds\n");
@@ -593,6 +595,7 @@
   {"partial-dir",      0,  POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
   {"delay-updates",    0,  POPT_ARG_VAL,    &delay_updates, 1, 0, 0 },
   {"no-delay-updates", 0,  POPT_ARG_VAL,    &delay_updates, 0, 0, 0 },
+  {"direct-io",       'n', POPT_ARG_NONE,   &direct_io, 0, 0, 0 },
   {"prune-empty-dirs",'m', POPT_ARG_VAL,    &prune_empty_dirs, 1, 0, 0 },
   {"no-prune-empty-dirs",0,POPT_ARG_VAL,    &prune_empty_dirs, 0, 0, 0 },
   {"no-m",             0,  POPT_ARG_VAL,    &prune_empty_dirs, 0, 0, 0 },
@@ -2002,6 +2005,9 @@
 	} else if (keep_partial && am_sender)
 		args[ac++] = "--partial";
 
+	if (direct_io)
+		args[ac++] = "--direct-io";
+
 	if (ignore_errors)
 		args[ac++] = "--ignore-errors";
 
--- syscall.c.direct-io	2011-02-21 20:32:51.000000000 +0100
+++ syscall.c	2013-02-14 14:19:52.000000000 +0100
@@ -30,6 +30,7 @@
 #endif
 
 extern int dry_run;
+extern int direct_io;
 extern int am_root;
 extern int read_only;
 extern int list_only;
@@ -143,6 +144,8 @@
 		RETURN_ERROR_IF_RO_OR_LO;
 	}
 
+	if (direct_io) flags |= O_DIRECT;
+
 	return open(pathname, flags | O_BINARY, mode);
 }
 
--- tls.c.orig	2013-02-14 23:03:43.000000000 +0100
+++ tls.c	2013-02-14 23:03:26.000000000 +0100
@@ -42,6 +42,7 @@
 
 /* These are to make syscall.o shut up. */
 int dry_run = 0;
+int direct_io = 0;
 int am_root = 0;
 int read_only = 1;
 int list_only = 0;
--- t_unsafe.c.orig	2013-02-14 23:17:26.000000000 +0100
+++ t_unsafe.c	2013-02-14 23:16:36.000000000 +0100
@@ -24,6 +24,7 @@
 #include "rsync.h"
 
 int dry_run = 0;
+int direct_io = 0;
 int am_root = 0;
 int read_only = 0;
 int list_only = 0;
--- trimslash.c.orig	2013-02-14 23:17:16.000000000 +0100
+++ trimslash.c	2013-02-14 23:16:15.000000000 +0100
@@ -22,6 +22,7 @@
 
 /* These are to make syscall.o shut up. */
 int dry_run = 0;
+int direct_io = 0;
 int am_root = 0;
 int read_only = 1;
 int list_only = 0;
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to