Lines 1850-1871
Link Here
|
1850 |
static void *mapping_get_entry(struct address_space *mapping, pgoff_t index) |
1850 |
static void *mapping_get_entry(struct address_space *mapping, pgoff_t index) |
1851 |
{ |
1851 |
{ |
1852 |
XA_STATE(xas, &mapping->i_pages, index); |
1852 |
XA_STATE(xas, &mapping->i_pages, index); |
1853 |
struct folio *folio; |
1853 |
struct folio *folio; |
1854 |
|
1854 |
|
1855 |
rcu_read_lock(); |
1855 |
rcu_read_lock(); |
1856 |
repeat: |
1856 |
repeat: |
1857 |
xas_reset(&xas); |
1857 |
xas_reset(&xas); |
1858 |
folio = xas_load(&xas); |
1858 |
folio = xas_load(&xas); |
1859 |
if (xas_retry(&xas, folio)) |
1859 |
if (xas_retry(&xas, folio)) |
1860 |
goto repeat; |
1860 |
goto repeat; |
|
|
1861 |
if (WARN_ON(xa_is_internal(folio))) |
1862 |
goto repeat; |
1861 |
/* |
1863 |
/* |
1862 |
* A shadow entry of a recently evicted page, or a swap entry from |
1864 |
* A shadow entry of a recently evicted page, or a swap entry from |
1863 |
* shmem/tmpfs. Return it without attempting to raise page count. |
1865 |
* shmem/tmpfs. Return it without attempting to raise page count. |
1864 |
*/ |
1866 |
*/ |
1865 |
if (!folio || xa_is_value(folio)) |
1867 |
if (!folio || xa_is_value(folio)) |
1866 |
goto out; |
1868 |
goto out; |
1867 |
|
1869 |
|
1868 |
if (!folio_try_get_rcu(folio)) |
1870 |
if (!folio_try_get_rcu(folio)) |
1869 |
goto repeat; |
1871 |
goto repeat; |
1870 |
|
1872 |
|
1871 |
if (unlikely(folio != xas_reload(&xas))) { |
1873 |
if (unlikely(folio != xas_reload(&xas))) { |