All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch FIOFLUSH
@ 2003-05-21 17:28 Ross Biro
  2003-05-21 17:38 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Biro @ 2003-05-21 17:28 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]


Here's a patch against 2.4.18 that allows user space to flush a file 
from both the buffer cache and the page cache.  The reason for flushing 
a file from the caches is to the read the file again to verify it made 
it to more permanent storage correctly.  Someone may want to add 
similiar code to 2.5.

    Ross


[-- Attachment #2: linux-2.4-FIOFLUSH.patch --]
[-- Type: text/plain, Size: 1144 bytes --]

diff -urdbB linux-2.4.18-58/fs/ioctl.c linux-2.4.18-59/fs/ioctl.c
--- linux-2.4.18-58/fs/ioctl.c	Fri Feb  9 11:29:44 2001
+++ linux-2.4.18-59/fs/ioctl.c	Thu May  1 09:52:18 2003
@@ -39,6 +39,13 @@
 			return put_user(inode->i_sb->s_blocksize, (int *) arg);
 		case FIONREAD:
 			return put_user(inode->i_size - filp->f_pos, (int *) arg);
+
+                case FIOFLUSH:
+                        write_inode_now(inode, 1);
+                        invalidate_inode_buffers(inode);
+                        invalidate_inode_pages(inode);
+                        return 0;
+
 	}
 	if (filp->f_op && filp->f_op->ioctl)
 		return filp->f_op->ioctl(inode, filp, cmd, arg);
diff -urdbB linux-2.4.18-58/include/asm/ioctls.h linux-2.4.18-59/include/asm/ioctls.h
--- linux-2.4.18-58/include/asm-i386/ioctls.h	Fri Jul 24 11:10:16 1998
+++ linux-2.4.18-59/include/asm-i386/ioctls.h	Thu May  1 09:53:51 2003
@@ -32,6 +32,7 @@
 #define TIOCGSOFTCAR	0x5419
 #define TIOCSSOFTCAR	0x541A
 #define FIONREAD	0x541B
+#define FIOFLUSH	_IO('F', 1) /* flush a file out of the caches */
 #define TIOCINQ		FIONREAD
 #define TIOCLINUX	0x541C
 #define TIOCCONS	0x541D

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch FIOFLUSH
  2003-05-21 17:28 Patch FIOFLUSH Ross Biro
@ 2003-05-21 17:38 ` Christoph Hellwig
  2003-05-21 17:44   ` Marc-Christian Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-05-21 17:38 UTC (permalink / raw)
  To: Ross Biro; +Cc: linux-kernel

On Wed, May 21, 2003 at 10:28:03AM -0700, Ross Biro wrote:
> 
> Here's a patch against 2.4.18 that allows user space to flush a file 
> from both the buffer cache and the page cache.  The reason for flushing 
> a file from the caches is to the read the file again to verify it made 
> it to more permanent storage correctly.  Someone may want to add 
> similiar code to 2.5.

This came up at SGI some time ago and the right solution is _not_ a new
ioctl but fadvise(..., POSIX_FADV_DONTNEED).   I'll submit a clean backport
once 2.4.21 is out (if that will ever happen)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch FIOFLUSH
  2003-05-21 17:38 ` Christoph Hellwig
@ 2003-05-21 17:44   ` Marc-Christian Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Marc-Christian Petersen @ 2003-05-21 17:44 UTC (permalink / raw)
  To: Christoph Hellwig, Ross Biro; +Cc: linux-kernel

On Wednesday 21 May 2003 19:38, Christoph Hellwig wrote:

Hi Christoph,

> This came up at SGI some time ago and the right solution is _not_ a new
> ioctl but fadvise(..., POSIX_FADV_DONTNEED).   I'll submit a clean backport
could you please send it to me even 2.4.21 is not out? Thank you.

> once 2.4.21 is out (if that will ever happen)
ROTFL! :-)

ciao, Marc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-21 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-21 17:28 Patch FIOFLUSH Ross Biro
2003-05-21 17:38 ` Christoph Hellwig
2003-05-21 17:44   ` Marc-Christian Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.