mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
page cache: use xa_lock
Remove the address_space ->tree_lock and use the xa_lock newly added to the radix_tree_root. Rename the address_space ->page_tree to ->i_pages, since we don't really care that it's a tree. [[email protected]: fix nds32, fs/dax.c] Link: http://lkml.kernel.org/r/[email protected]: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Acked-by: Jeff Layton <[email protected]> Cc: Darrick J. Wong <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Ryusuke Konishi <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f6bb2a2c0b
commit
b93b016313
39 changed files with 345 additions and 366 deletions
|
|
@ -193,9 +193,9 @@ retry:
|
|||
(unsigned long long)oldkey,
|
||||
(unsigned long long)newkey);
|
||||
|
||||
spin_lock_irq(&btnc->tree_lock);
|
||||
err = radix_tree_insert(&btnc->page_tree, newkey, obh->b_page);
|
||||
spin_unlock_irq(&btnc->tree_lock);
|
||||
xa_lock_irq(&btnc->i_pages);
|
||||
err = radix_tree_insert(&btnc->i_pages, newkey, obh->b_page);
|
||||
xa_unlock_irq(&btnc->i_pages);
|
||||
/*
|
||||
* Note: page->index will not change to newkey until
|
||||
* nilfs_btnode_commit_change_key() will be called.
|
||||
|
|
@ -251,11 +251,11 @@ void nilfs_btnode_commit_change_key(struct address_space *btnc,
|
|||
(unsigned long long)newkey);
|
||||
mark_buffer_dirty(obh);
|
||||
|
||||
spin_lock_irq(&btnc->tree_lock);
|
||||
radix_tree_delete(&btnc->page_tree, oldkey);
|
||||
radix_tree_tag_set(&btnc->page_tree, newkey,
|
||||
xa_lock_irq(&btnc->i_pages);
|
||||
radix_tree_delete(&btnc->i_pages, oldkey);
|
||||
radix_tree_tag_set(&btnc->i_pages, newkey,
|
||||
PAGECACHE_TAG_DIRTY);
|
||||
spin_unlock_irq(&btnc->tree_lock);
|
||||
xa_unlock_irq(&btnc->i_pages);
|
||||
|
||||
opage->index = obh->b_blocknr = newkey;
|
||||
unlock_page(opage);
|
||||
|
|
@ -283,9 +283,9 @@ void nilfs_btnode_abort_change_key(struct address_space *btnc,
|
|||
return;
|
||||
|
||||
if (nbh == NULL) { /* blocksize == pagesize */
|
||||
spin_lock_irq(&btnc->tree_lock);
|
||||
radix_tree_delete(&btnc->page_tree, newkey);
|
||||
spin_unlock_irq(&btnc->tree_lock);
|
||||
xa_lock_irq(&btnc->i_pages);
|
||||
radix_tree_delete(&btnc->i_pages, newkey);
|
||||
xa_unlock_irq(&btnc->i_pages);
|
||||
unlock_page(ctxt->bh->b_page);
|
||||
} else
|
||||
brelse(nbh);
|
||||
|
|
|
|||
|
|
@ -331,15 +331,15 @@ repeat:
|
|||
struct page *page2;
|
||||
|
||||
/* move the page to the destination cache */
|
||||
spin_lock_irq(&smap->tree_lock);
|
||||
page2 = radix_tree_delete(&smap->page_tree, offset);
|
||||
xa_lock_irq(&smap->i_pages);
|
||||
page2 = radix_tree_delete(&smap->i_pages, offset);
|
||||
WARN_ON(page2 != page);
|
||||
|
||||
smap->nrpages--;
|
||||
spin_unlock_irq(&smap->tree_lock);
|
||||
xa_unlock_irq(&smap->i_pages);
|
||||
|
||||
spin_lock_irq(&dmap->tree_lock);
|
||||
err = radix_tree_insert(&dmap->page_tree, offset, page);
|
||||
xa_lock_irq(&dmap->i_pages);
|
||||
err = radix_tree_insert(&dmap->i_pages, offset, page);
|
||||
if (unlikely(err < 0)) {
|
||||
WARN_ON(err == -EEXIST);
|
||||
page->mapping = NULL;
|
||||
|
|
@ -348,11 +348,11 @@ repeat:
|
|||
page->mapping = dmap;
|
||||
dmap->nrpages++;
|
||||
if (PageDirty(page))
|
||||
radix_tree_tag_set(&dmap->page_tree,
|
||||
radix_tree_tag_set(&dmap->i_pages,
|
||||
offset,
|
||||
PAGECACHE_TAG_DIRTY);
|
||||
}
|
||||
spin_unlock_irq(&dmap->tree_lock);
|
||||
xa_unlock_irq(&dmap->i_pages);
|
||||
}
|
||||
unlock_page(page);
|
||||
}
|
||||
|
|
@ -474,15 +474,15 @@ int __nilfs_clear_page_dirty(struct page *page)
|
|||
struct address_space *mapping = page->mapping;
|
||||
|
||||
if (mapping) {
|
||||
spin_lock_irq(&mapping->tree_lock);
|
||||
xa_lock_irq(&mapping->i_pages);
|
||||
if (test_bit(PG_dirty, &page->flags)) {
|
||||
radix_tree_tag_clear(&mapping->page_tree,
|
||||
radix_tree_tag_clear(&mapping->i_pages,
|
||||
page_index(page),
|
||||
PAGECACHE_TAG_DIRTY);
|
||||
spin_unlock_irq(&mapping->tree_lock);
|
||||
xa_unlock_irq(&mapping->i_pages);
|
||||
return clear_page_dirty_for_io(page);
|
||||
}
|
||||
spin_unlock_irq(&mapping->tree_lock);
|
||||
xa_unlock_irq(&mapping->i_pages);
|
||||
return 0;
|
||||
}
|
||||
return TestClearPageDirty(page);
|
||||
|
|
|
|||
Loading…
Reference in a new issue