summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-02-03 16:59:04 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-02-03 16:59:04 -0800
commitfccbe3844c29beed4e665b1a5aafada44e133adc (patch)
treed36c55cf2d4c17987889a429457065dd9ac6f2ac /include
parente7bfb1dbceb8015e4cb4900a6f0ce05fd437016b (diff)
[PATCH] implement posix_fadvise64()
An implementation of posix_fadvise64(). It adds 368 bytes to my vmlinux and is worth it. I didn't bother doing posix_fadvise(), as userspace can implement that by calling fadvise64(). The main reason for wanting this syscall is to provide userspace with the ability to explicitly shoot down pagecache when streaming large files. This is what O_STEAMING does, only posix_fadvise() is standards-based, and harder to use. posix_fadvise() also subsumes sys_readahead(). POSIX_FADV_WILLNEED will generally provide asynchronous readahead semantics for small amounts of I/O. As long as things like indirect blocks are aready in core. POSIX_FADV_RANDOM gives unprivileged applications a way of disabling readahead on a per-fd basis, which may provide some benefit for super-seeky access patterns such as databases. The POSIX_FADV_* values are already implemented in glibc, and this patch ensures that they are in sync. A test app (fadvise.c) is available in ext3 CVS. See http://www.zip.com.au/~akpm/linux/ext3/ for CVS details. Ulrich has reviewed this patch (thanks).
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/linux/fadvise.h11
-rw-r--r--include/linux/fs.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index fb5a97ec22f5..d21b3a8a4f4e 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -255,6 +255,8 @@
#define __NR_io_getevents 247
#define __NR_io_submit 248
#define __NR_io_cancel 249
+#define __NR_fadvise64 250
+
#define __NR_exit_group 252
#define __NR_lookup_dcookie 253
#define __NR_epoll_create 254
diff --git a/include/linux/fadvise.h b/include/linux/fadvise.h
new file mode 100644
index 000000000000..6fc656dfb93d
--- /dev/null
+++ b/include/linux/fadvise.h
@@ -0,0 +1,11 @@
+#ifndef FADVISE_H_INCLUDED
+#define FADVISE_H_INCLUDED
+
+#define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+#define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+#define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+#define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+#define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+#define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+
+#endif /* FADVISE_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 76b32526394f..f4c994d02f5d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1102,6 +1102,8 @@ extern int full_check_disk_change(struct block_device *);
extern int __check_disk_change(dev_t);
extern int invalidate_inodes(struct super_block *);
extern int invalidate_device(kdev_t, int);
+extern void invalidate_mapping_pages(struct address_space *mapping,
+ pgoff_t start, pgoff_t end);
extern void invalidate_inode_pages(struct address_space *mapping);
extern void invalidate_inode_pages2(struct address_space *mapping);
extern void write_inode_now(struct inode *, int);