From: Pankaj Raghav <p.raghav@xxxxxxxxxxx>Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
filemap_create_folio() and do_read_cache_folio() were always allocating
folio of order 0. __filemap_get_folio was trying to allocate higher
order folios when fgp_flags had higher order hint set but it will default
to order 0 folio if higher order memory allocation fails.
As we bring the notion of mapping_min_order, make sure these functions
allocate at least folio of mapping_min_order as we need to guarantee it
in the page cache.
Add some additional VM_BUG_ON() in page_cache_delete[batch] and
__filemap_add_folio to catch errors where we delete or add folios that
has order less than min_order.
Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
mm/filemap.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)