Skip to content

Commit 252256e

Browse files
amir73iljankara
authored andcommitted
Revert "fanotify: disable readahead if we have pre-content watches"
This reverts commit fac8484. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250312073852.2123409-7-amir73il@gmail.com
1 parent 4f4dc3a commit 252256e

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

mm/filemap.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,14 +3197,6 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
31973197
unsigned long vm_flags = vmf->vma->vm_flags;
31983198
unsigned int mmap_miss;
31993199

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-
32083200
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
32093201
/* Use the readahead code, even if readahead is disabled */
32103202
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,
32733265
struct file *fpin = NULL;
32743266
unsigned int mmap_miss;
32753267

3276-
/* See comment in do_sync_mmap_readahead. */
3277-
if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode)))
3278-
return fpin;
3279-
32803268
/* If we don't want any read-ahead, don't bother */
32813269
if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages)
32823270
return fpin;

mm/readahead.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
#include <linux/blk-cgroup.h>
129129
#include <linux/fadvise.h>
130130
#include <linux/sched/mm.h>
131-
#include <linux/fsnotify.h>
132131

133132
#include "internal.h"
134133

@@ -558,15 +557,6 @@ void page_cache_sync_ra(struct readahead_control *ractl,
558557
unsigned long max_pages, contig_count;
559558
pgoff_t prev_index, miss;
560559

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-
570560
/*
571561
* Even if readahead is disabled, issue this request as readahead
572562
* 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,
645635
if (!ra->ra_pages)
646636
return;
647637

648-
/* See the comment in page_cache_sync_ra. */
649-
if (ractl->file && unlikely(FMODE_FSNOTIFY_HSM(ractl->file->f_mode)))
650-
return;
651-
652638
/*
653639
* Same bit is used for PG_readahead and PG_reclaim.
654640
*/

0 commit comments

Comments
 (0)