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

This reverts commit fac84846a28c0950d4433118b3dffd44306df62d.

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

authored by Amir Goldstein and committed by Jan Kara 252256e4 4f4dc3a9

-26
-12
mm/filemap.c
··· 3197 3197 unsigned long vm_flags = vmf->vma->vm_flags; 3198 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 3200 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 3209 3201 /* Use the readahead code, even if readahead is disabled */ 3210 3202 if ((vm_flags & VM_HUGEPAGE) && HPAGE_PMD_ORDER <= MAX_PAGECACHE_ORDER) { ··· 3264 3272 DEFINE_READAHEAD(ractl, file, ra, file->f_mapping, vmf->pgoff); 3265 3273 struct file *fpin = NULL; 3266 3274 unsigned int mmap_miss; 3267 - 3268 - /* See comment in do_sync_mmap_readahead. */ 3269 - if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode))) 3270 - return fpin; 3271 3275 3272 3276 /* If we don't want any read-ahead, don't bother */ 3273 3277 if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages)
-14
mm/readahead.c
··· 128 128 #include <linux/blk-cgroup.h> 129 129 #include <linux/fadvise.h> 130 130 #include <linux/sched/mm.h> 131 - #include <linux/fsnotify.h> 132 131 133 132 #include "internal.h" 134 133 ··· 558 559 pgoff_t prev_index, miss; 559 560 560 561 /* 561 - * If we have pre-content watches we need to disable readahead to make 562 - * sure that we don't find 0 filled pages in cache that we never emitted 563 - * events for. Filesystems supporting HSM must make sure to not call 564 - * this function with ractl->file unset for files handled by HSM. 565 - */ 566 - if (ractl->file && unlikely(FMODE_FSNOTIFY_HSM(ractl->file->f_mode))) 567 - return; 568 - 569 - /* 570 562 * Even if readahead is disabled, issue this request as readahead 571 563 * as we'll need it to satisfy the requested range. The forced 572 564 * readahead will do the right thing and limit the read to just the ··· 633 643 634 644 /* no readahead */ 635 645 if (!ra->ra_pages) 636 - return; 637 - 638 - /* See the comment in page_cache_sync_ra. */ 639 - if (ractl->file && unlikely(FMODE_FSNOTIFY_HSM(ractl->file->f_mode))) 640 646 return; 641 647 642 648 /*