I'd like to suggest adding the ability to dd(1) to open the file in
concurrent I/O mode.  This applies only to AIX systems and the JFS2
filesystem.  I had a need to do this and was able to do it easily thanks
to the design of coreutils.  As a sysadmin sometimes you have to open a
file in CIO mode because if any other program has the file open already
in CIO mode, the OS will not allow it to be opened in "normal" mode.
Also when using CIO mode, I/O that is not block-aligned is very slow.
This makes dd a good utility for copying data to/from files in CIO mode.

Anyway, here are some simple patches to coreutils and gnulib that give this
capability to dd.

Thanks,
Matt Harden
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index bbc2710..cf575dc 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7729,6 +7729,12 @@ If you combine this flag with the @samp{...@var{file}} 
operand,
 you should also specify @samp{conv=notrunc} unless you want the
 output file to be truncated before being appended to.
 
+...@item cio
+...@opindex cio
+...@cindex concurrent I/O (AIX)
+Use JFS2 concurrent I/O for data.  This is an option specific
+to JFS2 filesystems on the AIX operating system.
+
 @item direct
 @opindex direct
 @cindex direct I/O
diff --git a/src/dd.c b/src/dd.c
index e54cc14..37c55e8 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -288,6 +288,7 @@ static struct symbol_value const flags[] =
 {
   {"append",   O_APPEND},
   {"binary",   O_BINARY},
+  {"cio",      O_CIO},
   {"direct",   O_DIRECT},
   {"directory",        O_DIRECTORY},
   {"dsync",    O_DSYNC},
@@ -508,6 +509,8 @@ Each FLAG symbol may be:\n\
 \n\
   append    append mode (makes sense only for output; conv=notrunc 
suggested)\n\
 "), stdout);
+      if (O_CIO)
+       fputs (_("  cio       use JFS2 concurrent I/O for data\n"), stdout);
       if (O_DIRECT)
        fputs (_("  direct    use direct I/O for data\n"), stdout);
       if (O_DIRECTORY)
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index fd7520e..dea7449 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -70,6 +70,10 @@ extern void _gl_register_fd (int fd, const char *filename);
 
 /* Fix up the O_* macros.  */
 
+#ifndef O_CIO
+# define O_CIO 0
+#endif
+
 #if !defined O_DIRECT && defined O_DIRECTIO
 /* Tru64 spells it `O_DIRECTIO'.  */
 # define O_DIRECT O_DIRECTIO
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to