History

Revert "fanotify: disable readahead if we have pre-content watches"

This reverts commit fac84846a28c0950d4433118b3dffd44306df62d.

Amir Goldstein committed 1 year ago

Commit 252256e1 parent 4f4dc3a2 files · +0 −26Browse files

Unified · Split

2 files
  1. mm/filemap.c +0 −12
  2. mm/readahead.c +0 −14
mm/filemap.c+0−12
@@ -3197,14 +3197,6 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) · 3196 unmodified lines
3197 unsigned long vm_flags = vmf->vma->vm_flags;3197 unsigned long vm_flags = vmf->vma->vm_flags;
3198 unsigned int mmap_miss;3198 unsigned int mmap_miss;
3199 3199
3200 /*
3201 * If we have pre-content watches we need to disable readahead to make
3202 * sure that we don't populate our mapping with 0 filled pages that we
3203 * never emitted an event for.
3204 */
3205 if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode)))
3206 return fpin;
3207
3208#ifdef CONFIG_TRANSPARENT_HUGEPAGE3200#ifdef CONFIG_TRANSPARENT_HUGEPAGE
3209 /* Use the readahead code, even if readahead is disabled */3201 /* Use the readahead code, even if readahead is disabled */
3210 if ((vm_flags & VM_HUGEPAGE) && HPAGE_PMD_ORDER <= MAX_PAGECACHE_ORDER) {3202 if ((vm_flags & VM_HUGEPAGE) && HPAGE_PMD_ORDER <= MAX_PAGECACHE_ORDER) {
@@ -3273,10 +3265,6 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf, · 62 unmodified lines
3273 struct file *fpin = NULL;3265 struct file *fpin = NULL;
3274 unsigned int mmap_miss;3266 unsigned int mmap_miss;
3275 3267
3276 /* See comment in do_sync_mmap_readahead. */
3277 if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode)))
3278 return fpin;
3279
3280 /* If we don't want any read-ahead, don't bother */3268 /* If we don't want any read-ahead, don't bother */
3281 if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages)3269 if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages)
3282 return fpin;3270 return fpin;
mm/readahead.c+0−14
@@ -128,7 +128,6 @@ · 127 unmodified lines
128#include <linux/blk-cgroup.h>128#include <linux/blk-cgroup.h>
129#include <linux/fadvise.h>129#include <linux/fadvise.h>
130#include <linux/sched/mm.h>130#include <linux/sched/mm.h>
131#include <linux/fsnotify.h>
132 131
133#include "internal.h"132#include "internal.h"
134 133
@@ -558,15 +557,6 @@ void page_cache_sync_ra(struct readahead_control *ractl, · 423 unmodified lines
558 unsigned long max_pages, contig_count;557 unsigned long max_pages, contig_count;
559 pgoff_t prev_index, miss;558 pgoff_t prev_index, miss;
560 559
561 /*
562 * If we have pre-content watches we need to disable readahead to make
563 * sure that we don't find 0 filled pages in cache that we never emitted
564 * events for. Filesystems supporting HSM must make sure to not call
565 * this function with ractl->file unset for files handled by HSM.
566 */
567 if (ractl->file && unlikely(FMODE_FSNOTIFY_HSM(ractl->file->f_mode)))
568 return;
569
570 /*560 /*
571 * Even if readahead is disabled, issue this request as readahead561 * Even if readahead is disabled, issue this request as readahead
572 * as we'll need it to satisfy the requested range. The forced562 * as we'll need it to satisfy the requested range. The forced
@@ -645,10 +635,6 @@ void page_cache_async_ra(struct readahead_control *ractl, · 72 unmodified lines
645 if (!ra->ra_pages)635 if (!ra->ra_pages)
646 return;636 return;
647 637
648 /* See the comment in page_cache_sync_ra. */
649 if (ractl->file && unlikely(FMODE_FSNOTIFY_HSM(ractl->file->f_mode)))
650 return;
651
652 /*638 /*
653 * Same bit is used for PG_readahead and PG_reclaim.639 * Same bit is used for PG_readahead and PG_reclaim.
654 */640 */