Patch FIOFLUSH
Subsystems (2)
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
fs/ioctl.c +7 -0
@@ -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);
include/asm-i386/ioctls.h +1 -0
@@ -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
Quoted 6 lines · Ross Biro
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)
On Wednesday 21 May 2003 19:38, Christoph Hellwig wrote:
Hi Christoph,
Quoted 2 lines
This came up at SGI some time ago and the right solution is _not_ a new
ioctl butfadvise(..., 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.
Quoted 1 line
once 2.4.21 is out (if that will ever happen)
ROTFL! :-)
ciao, Marc