diff options
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 3a5be0feb6af..1c702f6f1241 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -357,42 +357,6 @@ export: | |||
357 | } | 357 | } |
358 | 358 | ||
359 | /* | 359 | /* |
360 | * Lockless lookup of swap entry in radix tree, avoiding refcount on pages. | ||
361 | */ | ||
362 | static pgoff_t shmem_find_swap(struct address_space *mapping, void *radswap) | ||
363 | { | ||
364 | void **slots[PAGEVEC_SIZE]; | ||
365 | pgoff_t indices[PAGEVEC_SIZE]; | ||
366 | unsigned int nr_found; | ||
367 | |||
368 | restart: | ||
369 | nr_found = 1; | ||
370 | indices[0] = -1; | ||
371 | while (nr_found) { | ||
372 | pgoff_t index = indices[nr_found - 1] + 1; | ||
373 | unsigned int i; | ||
374 | |||
375 | rcu_read_lock(); | ||
376 | nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree, | ||
377 | slots, indices, index, PAGEVEC_SIZE); | ||
378 | for (i = 0; i < nr_found; i++) { | ||
379 | void *item = radix_tree_deref_slot(slots[i]); | ||
380 | if (radix_tree_deref_retry(item)) { | ||
381 | rcu_read_unlock(); | ||
382 | goto restart; | ||
383 | } | ||
384 | if (item == radswap) { | ||
385 | rcu_read_unlock(); | ||
386 | return indices[i]; | ||
387 | } | ||
388 | } | ||
389 | rcu_read_unlock(); | ||
390 | cond_resched(); | ||
391 | } | ||
392 | return -1; | ||
393 | } | ||
394 | |||
395 | /* | ||
396 | * Remove swap entry from radix tree, free the swap and its page cache. | 360 | * Remove swap entry from radix tree, free the swap and its page cache. |
397 | */ | 361 | */ |
398 | static int shmem_free_swap(struct address_space *mapping, | 362 | static int shmem_free_swap(struct address_space *mapping, |
@@ -612,7 +576,7 @@ static int shmem_unuse_inode(struct shmem_inode_info *info, | |||
612 | int error; | 576 | int error; |
613 | 577 | ||
614 | radswap = swp_to_radix_entry(swap); | 578 | radswap = swp_to_radix_entry(swap); |
615 | index = shmem_find_swap(mapping, radswap); | 579 | index = radix_tree_locate_item(&mapping->page_tree, radswap); |
616 | if (index == -1) | 580 | if (index == -1) |
617 | return 0; | 581 | return 0; |
618 | 582 | ||