Lines Matching refs:ractl
205 void page_cache_ra_unbounded(struct readahead_control *ractl, in page_cache_ra_unbounded() argument
208 struct address_space *mapping = ractl->mapping; in page_cache_ra_unbounded()
209 unsigned long index = readahead_index(ractl); in page_cache_ra_unbounded()
241 read_pages(ractl); in page_cache_ra_unbounded()
242 ractl->_index++; in page_cache_ra_unbounded()
243 i = ractl->_index + ractl->_nr_pages - index - 1; in page_cache_ra_unbounded()
253 read_pages(ractl); in page_cache_ra_unbounded()
254 ractl->_index++; in page_cache_ra_unbounded()
255 i = ractl->_index + ractl->_nr_pages - index - 1; in page_cache_ra_unbounded()
260 ractl->_workingset |= folio_test_workingset(folio); in page_cache_ra_unbounded()
261 ractl->_nr_pages++; in page_cache_ra_unbounded()
269 read_pages(ractl); in page_cache_ra_unbounded()
281 static void do_page_cache_ra(struct readahead_control *ractl, in do_page_cache_ra() argument
284 struct inode *inode = ractl->mapping->host; in do_page_cache_ra()
285 unsigned long index = readahead_index(ractl); in do_page_cache_ra()
299 page_cache_ra_unbounded(ractl, nr_to_read, lookahead_size); in do_page_cache_ra()
306 void force_page_cache_ra(struct readahead_control *ractl, in force_page_cache_ra() argument
309 struct address_space *mapping = ractl->mapping; in force_page_cache_ra()
310 struct file_ra_state *ra = ractl->ra; in force_page_cache_ra()
321 index = readahead_index(ractl); in force_page_cache_ra()
329 ractl->_index = index; in force_page_cache_ra()
330 do_page_cache_ra(ractl, this_chunk, 0); in force_page_cache_ra()
464 static inline int ra_alloc_folio(struct readahead_control *ractl, pgoff_t index, in ra_alloc_folio() argument
475 err = filemap_add_folio(ractl->mapping, folio, index, gfp); in ra_alloc_folio()
481 ractl->_nr_pages += 1UL << order; in ra_alloc_folio()
482 ractl->_workingset |= folio_test_workingset(folio); in ra_alloc_folio()
486 void page_cache_ra_order(struct readahead_control *ractl, in page_cache_ra_order() argument
489 struct address_space *mapping = ractl->mapping; in page_cache_ra_order()
490 pgoff_t index = readahead_index(ractl); in page_cache_ra_order()
522 err = ra_alloc_folio(ractl, index, mark, order, gfp); in page_cache_ra_order()
533 read_pages(ractl); in page_cache_ra_order()
545 do_page_cache_ra(ractl, ra->size, ra->async_size); in page_cache_ra_order()
551 static void ondemand_readahead(struct readahead_control *ractl, in ondemand_readahead() argument
554 struct backing_dev_info *bdi = inode_to_bdi(ractl->mapping->host); in ondemand_readahead()
555 struct file_ra_state *ra = ractl->ra; in ondemand_readahead()
558 pgoff_t index = readahead_index(ractl); in ondemand_readahead()
602 start = page_cache_next_miss(ractl->mapping, index + 1, in ondemand_readahead()
636 if (try_context_readahead(ractl->mapping, ra, index, req_size, in ondemand_readahead()
644 do_page_cache_ra(ractl, req_size, 0); in ondemand_readahead()
670 ractl->_index = ra->start; in ondemand_readahead()
671 page_cache_ra_order(ractl, ra, order); in ondemand_readahead()
674 void page_cache_sync_ra(struct readahead_control *ractl, in page_cache_sync_ra() argument
677 bool do_forced_ra = ractl->file && (ractl->file->f_mode & FMODE_RANDOM); in page_cache_sync_ra()
685 if (!ractl->ra->ra_pages || blk_cgroup_congested()) { in page_cache_sync_ra()
686 if (!ractl->file) in page_cache_sync_ra()
694 force_page_cache_ra(ractl, req_count); in page_cache_sync_ra()
698 ondemand_readahead(ractl, NULL, req_count); in page_cache_sync_ra()
702 void page_cache_async_ra(struct readahead_control *ractl, in page_cache_async_ra() argument
706 if (!ractl->ra->ra_pages) in page_cache_async_ra()
720 ondemand_readahead(ractl, folio, req_count); in page_cache_async_ra()
781 void readahead_expand(struct readahead_control *ractl, in readahead_expand() argument
784 struct address_space *mapping = ractl->mapping; in readahead_expand()
785 struct file_ra_state *ra = ractl->ra; in readahead_expand()
792 while (ractl->_index > new_index) { in readahead_expand()
793 unsigned long index = ractl->_index - 1; in readahead_expand()
807 !ractl->_workingset) { in readahead_expand()
808 ractl->_workingset = true; in readahead_expand()
809 psi_memstall_enter(&ractl->_pflags); in readahead_expand()
811 ractl->_nr_pages++; in readahead_expand()
812 ractl->_index = folio->index; in readahead_expand()
815 new_len += new_start - readahead_pos(ractl); in readahead_expand()
819 while (ractl->_nr_pages < new_nr_pages) { in readahead_expand()
820 unsigned long index = ractl->_index + ractl->_nr_pages; in readahead_expand()
834 !ractl->_workingset) { in readahead_expand()
835 ractl->_workingset = true; in readahead_expand()
836 psi_memstall_enter(&ractl->_pflags); in readahead_expand()
838 ractl->_nr_pages++; in readahead_expand()