truncate.c (91b0abe36a7b2b3b02d7500925a5f8455334f0e5) | truncate.c (449dd6984d0e47643c04c807f609dd56d48d5bcc) |
---|---|
1/* 2 * mm/truncate.c - code for taking down pages from address_spaces 3 * 4 * Copyright (C) 2002, Linus Torvalds 5 * 6 * 10Sep2002 Andrew Morton 7 * Initial version. 8 */ --- 11 unchanged lines hidden (view full) --- 20#include <linux/buffer_head.h> /* grr. try_to_release_page, 21 do_invalidatepage */ 22#include <linux/cleancache.h> 23#include "internal.h" 24 25static void clear_exceptional_entry(struct address_space *mapping, 26 pgoff_t index, void *entry) 27{ | 1/* 2 * mm/truncate.c - code for taking down pages from address_spaces 3 * 4 * Copyright (C) 2002, Linus Torvalds 5 * 6 * 10Sep2002 Andrew Morton 7 * Initial version. 8 */ --- 11 unchanged lines hidden (view full) --- 20#include <linux/buffer_head.h> /* grr. try_to_release_page, 21 do_invalidatepage */ 22#include <linux/cleancache.h> 23#include "internal.h" 24 25static void clear_exceptional_entry(struct address_space *mapping, 26 pgoff_t index, void *entry) 27{ |
28 struct radix_tree_node *node; 29 void **slot; 30 |
|
28 /* Handled by shmem itself */ 29 if (shmem_mapping(mapping)) 30 return; 31 32 spin_lock_irq(&mapping->tree_lock); 33 /* 34 * Regular page slots are stabilized by the page lock even 35 * without the tree itself locked. These unlocked entries 36 * need verification under the tree lock. 37 */ | 31 /* Handled by shmem itself */ 32 if (shmem_mapping(mapping)) 33 return; 34 35 spin_lock_irq(&mapping->tree_lock); 36 /* 37 * Regular page slots are stabilized by the page lock even 38 * without the tree itself locked. These unlocked entries 39 * need verification under the tree lock. 40 */ |
38 if (radix_tree_delete_item(&mapping->page_tree, index, entry) == entry) 39 mapping->nrshadows--; | 41 if (!__radix_tree_lookup(&mapping->page_tree, index, &node, &slot)) 42 goto unlock; 43 if (*slot != entry) 44 goto unlock; 45 radix_tree_replace_slot(slot, NULL); 46 mapping->nrshadows--; 47 if (!node) 48 goto unlock; 49 workingset_node_shadows_dec(node); 50 /* 51 * Don't track node without shadow entries. 52 * 53 * Avoid acquiring the list_lru lock if already untracked. 54 * The list_empty() test is safe as node->private_list is 55 * protected by mapping->tree_lock. 56 */ 57 if (!workingset_node_shadows(node) && 58 !list_empty(&node->private_list)) 59 list_lru_del(&workingset_shadow_nodes, &node->private_list); 60 __radix_tree_delete_node(&mapping->page_tree, node); 61unlock: |
40 spin_unlock_irq(&mapping->tree_lock); 41} 42 43/** 44 * do_invalidatepage - invalidate part or all of a page 45 * @page: the page which is affected 46 * @offset: start of the range to invalidate 47 * @length: length of the range to invalidate --- 706 unchanged lines hidden --- | 62 spin_unlock_irq(&mapping->tree_lock); 63} 64 65/** 66 * do_invalidatepage - invalidate part or all of a page 67 * @page: the page which is affected 68 * @offset: start of the range to invalidate 69 * @length: length of the range to invalidate --- 706 unchanged lines hidden --- |