Re: [RFC v2 04/14] readahead: set file_ra_state->ra_pages to be at least mapping_min_order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/13/24 10:37, Pankaj Raghav (Samsung) wrote:
From: Luis Chamberlain <mcgrof@xxxxxxxxxx>

Set the file_ra_state->ra_pages in file_ra_state_init() to be at least
mapping_min_order of pages if the bdi->ra_pages is less than that.

Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
  mm/readahead.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/mm/readahead.c b/mm/readahead.c
index 2648ec4f0494..4fa7d0e65706 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -138,7 +138,12 @@
  void
  file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
  {
+	unsigned int min_nrpages = mapping_min_folio_nrpages(mapping);
+	unsigned int max_pages = inode_to_bdi(mapping->host)->io_pages;
+
  	ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages;
+	if (ra->ra_pages < min_nrpages && min_nrpages < max_pages)
+		ra->ra_pages = min_nrpages;
  	ra->prev_pos = -1;
  }
  EXPORT_SYMBOL_GPL(file_ra_state_init);

Reviewed-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux