]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/filemap.c
x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
[mirror_ubuntu-jammy-kernel.git] / mm / filemap.c
index 348e22067abdc54f8156b755c423c82f20eca811..42b012b99f4ed94b34927b9303225b47addc3e12 100644 (file)
@@ -2354,8 +2354,12 @@ static void filemap_get_read_batch(struct address_space *mapping,
                        break;
                if (PageReadahead(head))
                        break;
-               xas.xa_index = head->index + thp_nr_pages(head) - 1;
-               xas.xa_offset = (xas.xa_index >> xas.xa_shift) & XA_CHUNK_MASK;
+               if (PageHead(head)) {
+                       xas_set(&xas, head->index + thp_nr_pages(head));
+                       /* Handle wrap correctly */
+                       if (xas.xa_index - 1 >= max)
+                               break;
+               }
                continue;
 put_page:
                put_page(head);