spi: dt-bindings: cadence: add missing 'required'
[platform/kernel/linux-rpi.git] / mm / filemap.c
index dae4812..dbc4617 100644 (file)
@@ -90,7 +90,7 @@
  *      ->lock_page            (filemap_fault, access_process_vm)
  *
  *  ->i_rwsem                  (generic_perform_write)
- *    ->mmap_lock              (fault_in_pages_readable->do_page_fault)
+ *    ->mmap_lock              (fault_in_readable->do_page_fault)
  *
  *  bdi->wb.list_lock
  *    sb_lock                  (fs/fs-writeback.c)
@@ -2090,10 +2090,13 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t start,
 
        rcu_read_lock();
        while ((page = find_get_entry(&xas, end, XA_PRESENT))) {
+               unsigned long next_idx = xas.xa_index + 1;
+
                if (!xa_is_value(page)) {
+                       if (PageTransHuge(page))
+                               next_idx = page->index + thp_nr_pages(page);
                        if (page->index < start)
                                goto put;
-                       VM_BUG_ON_PAGE(page->index != xas.xa_index, page);
                        if (page->index + thp_nr_pages(page) - 1 > end)
                                goto put;
                        if (!trylock_page(page))
@@ -2112,13 +2115,11 @@ unlock:
 put:
                put_page(page);
 next:
-               if (!xa_is_value(page) && PageTransHuge(page)) {
-                       unsigned int nr_pages = thp_nr_pages(page);
-
+               if (next_idx != xas.xa_index + 1) {
                        /* Final THP may cross MAX_LFS_FILESIZE on 32-bit */
-                       xas_set(&xas, page->index + nr_pages);
-                       if (xas.xa_index < nr_pages)
+                       if (next_idx < xas.xa_index)
                                break;
+                       xas_set(&xas, next_idx);
                }
        }
        rcu_read_unlock();
@@ -2355,8 +2356,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);
@@ -3757,7 +3762,7 @@ again:
                 * same page as we're writing to, without it being marked
                 * up-to-date.
                 */
-               if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
+               if (unlikely(fault_in_iov_iter_readable(i, bytes))) {
                        status = -EFAULT;
                        break;
                }