]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
filemap: i don't know if we even need this
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 30 Dec 2022 11:46:46 +0000 (06:46 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 30 Dec 2022 14:02:15 +0000 (09:02 -0500)
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/linux/xarray.h
mm/filemap.c

index 44dd6d6e01bccbfaafb6462b13248ac5bbd578b0..cc1fd1f849a7eddbc2cd7f24a073e49503ad171b 100644 (file)
@@ -1617,6 +1617,12 @@ static inline void xas_advance(struct xa_state *xas, unsigned long index)
        xas->xa_offset = (index >> shift) & XA_CHUNK_MASK;
 }
 
+static inline void xas_adjust_order(struct xa_state *xas, unsigned int order)
+{
+       xas->xa_shift = order - (order % XA_CHUNK_SHIFT);
+       xas->xa_sibs = (1 << (order % XA_CHUNK_SHIFT)) - 1;
+}
+
 /**
  * xas_set_order() - Set up XArray operation state for a multislot entry.
  * @xas: XArray operation state.
@@ -1628,8 +1634,7 @@ static inline void xas_set_order(struct xa_state *xas, unsigned long index,
 {
 #ifdef CONFIG_XARRAY_MULTI
        xas->xa_index = order < BITS_PER_LONG ? (index >> order) << order : 0;
-       xas->xa_shift = order - (order % XA_CHUNK_SHIFT);
-       xas->xa_sibs = (1 << (order % XA_CHUNK_SHIFT)) - 1;
+       xas_adjust_order(xas, order);
        xas->xa_node = XAS_RESTART;
 #else
        BUG_ON(order > 0);
index c4d4ace9cc700300d966328d9769b5527d91ca8b..9daecbef6672b519a7d8a1e0ce241fcf94d30167 100644 (file)
@@ -305,11 +305,13 @@ static void page_cache_delete_batch(struct address_space *mapping,
 
                WARN_ON_ONCE(!folio_test_locked(folio));
 
+               if (!folio_test_hugetlb(folio))
+                       xas_adjust_order(&xas, folio_order(folio));
+               xas_store(&xas, NULL);
                folio->mapping = NULL;
                /* Leave folio->index set: truncation lookup relies on it */
 
                i++;
-               xas_store(&xas, NULL);
                total_pages += folio_nr_pages(folio);
        }
        mapping->nrpages -= total_pages;