shmem.c (7b8d046fba91d62beb8a8f78244aaa3c23a60cdd) | shmem.c (c121d3bb717ee932caf031c6a7923547f7f83163) |
---|---|
1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 636 unchanged lines hidden (view full) --- 645 __dec_node_page_state(page, NR_FILE_PAGES); 646 __dec_node_page_state(page, NR_SHMEM); 647 xa_unlock_irq(&mapping->i_pages); 648 put_page(page); 649 BUG_ON(error); 650} 651 652/* | 1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 636 unchanged lines hidden (view full) --- 645 __dec_node_page_state(page, NR_FILE_PAGES); 646 __dec_node_page_state(page, NR_SHMEM); 647 xa_unlock_irq(&mapping->i_pages); 648 put_page(page); 649 BUG_ON(error); 650} 651 652/* |
653 * Remove swap entry from radix tree, free the swap and its page cache. | 653 * Remove swap entry from page cache, free the swap and its page cache. |
654 */ 655static int shmem_free_swap(struct address_space *mapping, 656 pgoff_t index, void *radswap) 657{ 658 void *old; 659 660 xa_lock_irq(&mapping->i_pages); | 654 */ 655static int shmem_free_swap(struct address_space *mapping, 656 pgoff_t index, void *radswap) 657{ 658 void *old; 659 660 xa_lock_irq(&mapping->i_pages); |
661 old = radix_tree_delete_item(&mapping->i_pages, index, radswap); | 661 old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0); |
662 xa_unlock_irq(&mapping->i_pages); 663 if (old != radswap) 664 return -ENOENT; 665 free_swap_and_cache(radix_to_swp_entry(radswap)); 666 return 0; 667} 668 669/* --- 3342 unchanged lines hidden --- | 662 xa_unlock_irq(&mapping->i_pages); 663 if (old != radswap) 664 return -ENOENT; 665 free_swap_and_cache(radix_to_swp_entry(radswap)); 666 return 0; 667} 668 669/* --- 3342 unchanged lines hidden --- |