aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-08-05 15:14:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-08-06 11:57:47 -0400
commit60c371bc753495f36d3a71338b46030f7fffce3b (patch)
treeec83d5b3cc89efcea66310f3a1c6ca3708f6a26e /mm
parentbb39e419740435b7fbb0314e376ba468be7db67a (diff)
[PATCH] fadvise() make POSIX_FADV_NOREUSE a no-op
The POSIX_FADV_NOREUSE hint means "the application will use this range of the file a single time". It seems to be intended that the implementation will use this hint to perform drop-behind of that part of the file when the application gets around to reading or writing it. However for reasons which aren't obvious (or sane?) I mapped POSIX_FADV_NOREUSE onto POSIX_FADV_WILLNEED. ie: it does readahead. That's daft. So for now, make POSIX_FADV_NOREUSE a no-op. This is a non-back-compatible change. If someone was using POSIX_FADV_NOREUSE to perform readahead, they lose. The likelihood is low. If/when we later implement POSIX_FADV_NOREUSE things will get interesting - to do it fully we'll need to maintain file offset/length ranges and peform all sorts of complex tricks, and managing the lifetime of those ranges' data structures will be interesting.. A sensible implementation would probably ignore the file range and would simply mark the entire file as needing some form of drop-behind treatment. Cc: Michael Kerrisk <mtk-manpages@gmx.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/fadvise.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 60a5d55e51d9..168c78a121bb 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -73,7 +73,6 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
73 file->f_ra.ra_pages = bdi->ra_pages * 2; 73 file->f_ra.ra_pages = bdi->ra_pages * 2;
74 break; 74 break;
75 case POSIX_FADV_WILLNEED: 75 case POSIX_FADV_WILLNEED:
76 case POSIX_FADV_NOREUSE:
77 if (!mapping->a_ops->readpage) { 76 if (!mapping->a_ops->readpage) {
78 ret = -EINVAL; 77 ret = -EINVAL;
79 break; 78 break;
@@ -94,6 +93,8 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
94 if (ret > 0) 93 if (ret > 0)
95 ret = 0; 94 ret = 0;
96 break; 95 break;
96 case POSIX_FADV_NOREUSE:
97 break;
97 case POSIX_FADV_DONTNEED: 98 case POSIX_FADV_DONTNEED:
98 if (!bdi_write_congested(mapping->backing_dev_info)) 99 if (!bdi_write_congested(mapping->backing_dev_info))
99 filemap_flush(mapping); 100 filemap_flush(mapping);