Alas, both POSIX and I got the fadvise() interface wrong.  It needs to take a
64-bit length, not a 32-bit one.  Because fadvise(POSIX_FADV_DONTNEED) on a
4TB file will require 1000 syscalls.  Silly.

There are glibc's in the wild which use the existing syscall, so we must
make a new one.



 arch/i386/kernel/entry.S  |    3 ++-
 include/asm-i386/unistd.h |    3 ++-
 mm/fadvise.c              |    8 +++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff -puN mm/fadvise.c~fadvise64-64 mm/fadvise.c
--- 25/mm/fadvise.c~fadvise64-64	2003-08-08 03:06:25.000000000 -0700
+++ 25-akpm/mm/fadvise.c	2003-08-08 03:06:25.000000000 -0700
@@ -20,7 +20,7 @@
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
  */
-long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
+long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
 {
 	struct file *file = fget(fd);
 	struct inode *inode;
@@ -79,3 +79,9 @@ out:
 	fput(file);
 	return ret;
 }
+
+long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
+{
+	return sys_fadvise64_64(fd, offset, len, advice);
+}
+
diff -puN arch/i386/kernel/entry.S~fadvise64-64 arch/i386/kernel/entry.S
--- 25/arch/i386/kernel/entry.S~fadvise64-64	2003-08-08 03:06:41.000000000 -0700
+++ 25-akpm/arch/i386/kernel/entry.S	2003-08-08 03:07:12.000000000 -0700
@@ -904,7 +904,8 @@ ENTRY(sys_call_table)
 	.long sys_fstatfs64	
 	.long sys_tgkill	/* 270 */
 	.long sys_utimes
- 
+ 	.long sys_fadvise64_64
+
 nr_syscalls=(.-sys_call_table)/4
 
 
diff -puN include/asm-i386/unistd.h~fadvise64-64 include/asm-i386/unistd.h
--- 25/include/asm-i386/unistd.h~fadvise64-64	2003-08-08 03:06:51.000000000 -0700
+++ 25-akpm/include/asm-i386/unistd.h	2003-08-08 03:07:30.000000000 -0700
@@ -277,8 +277,9 @@
 #define __NR_fstatfs64		269
 #define __NR_tgkill		270
 #define __NR_utimes		271
+#define __NR_fadvise64_64	272
 
-#define NR_syscalls 272
+#define NR_syscalls 273
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 

_