aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-07-29 11:20:47 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-01 08:04:38 -0400
commitc2790a2e2bc824084717fde031a8e0d370fc8650 (patch)
tree60e3b32889e7a7368a11ed80ca233d638ea245d7 /fs/btrfs/extent_io.c
parent8068a47e2a77ecae27cfd0298e8732756f565ed1 (diff)
Btrfs: cleanup arguments to extent_clear_unlock_delalloc
This patch removes the io_tree argument for extent_clear_unlock_delalloc since we always use &BTRFS_I(inode)->io_tree, and it separates out the extent tree operations from the page operations. This way we just pass in the extent bits we want to clear and then pass in the operations we want done to the pages. This is because I'm going to fix what extent bits we clear in some cases and rather than add a bunch of new flags we'll just use the actual extent bits we want to clear. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index daf180dafe39..c137f98fbd24 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1678,31 +1678,21 @@ out_failed:
1678 return found; 1678 return found;
1679} 1679}
1680 1680
1681int extent_clear_unlock_delalloc(struct inode *inode, 1681int extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
1682 struct extent_io_tree *tree, 1682 struct page *locked_page,
1683 u64 start, u64 end, struct page *locked_page, 1683 unsigned long clear_bits,
1684 unsigned long op) 1684 unsigned long page_ops)
1685{ 1685{
1686 struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
1686 int ret; 1687 int ret;
1687 struct page *pages[16]; 1688 struct page *pages[16];
1688 unsigned long index = start >> PAGE_CACHE_SHIFT; 1689 unsigned long index = start >> PAGE_CACHE_SHIFT;
1689 unsigned long end_index = end >> PAGE_CACHE_SHIFT; 1690 unsigned long end_index = end >> PAGE_CACHE_SHIFT;
1690 unsigned long nr_pages = end_index - index + 1; 1691 unsigned long nr_pages = end_index - index + 1;
1691 int i; 1692 int i;
1692 unsigned long clear_bits = 0;
1693
1694 if (op & EXTENT_CLEAR_UNLOCK)
1695 clear_bits |= EXTENT_LOCKED;
1696 if (op & EXTENT_CLEAR_DIRTY)
1697 clear_bits |= EXTENT_DIRTY;
1698
1699 if (op & EXTENT_CLEAR_DELALLOC)
1700 clear_bits |= EXTENT_DELALLOC;
1701 1693
1702 clear_extent_bit(tree, start, end, clear_bits, 1, 0, NULL, GFP_NOFS); 1694 clear_extent_bit(tree, start, end, clear_bits, 1, 0, NULL, GFP_NOFS);
1703 if (!(op & (EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | 1695 if (page_ops == 0)
1704 EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK |
1705 EXTENT_SET_PRIVATE2)))
1706 return 0; 1696 return 0;
1707 1697
1708 while (nr_pages > 0) { 1698 while (nr_pages > 0) {
@@ -1711,20 +1701,20 @@ int extent_clear_unlock_delalloc(struct inode *inode,
1711 nr_pages, ARRAY_SIZE(pages)), pages); 1701 nr_pages, ARRAY_SIZE(pages)), pages);
1712 for (i = 0; i < ret; i++) { 1702 for (i = 0; i < ret; i++) {
1713 1703
1714 if (op & EXTENT_SET_PRIVATE2) 1704 if (page_ops & PAGE_SET_PRIVATE2)
1715 SetPagePrivate2(pages[i]); 1705 SetPagePrivate2(pages[i]);
1716 1706
1717 if (pages[i] == locked_page) { 1707 if (pages[i] == locked_page) {
1718 page_cache_release(pages[i]); 1708 page_cache_release(pages[i]);
1719 continue; 1709 continue;
1720 } 1710 }
1721 if (op & EXTENT_CLEAR_DIRTY) 1711 if (page_ops & PAGE_CLEAR_DIRTY)
1722 clear_page_dirty_for_io(pages[i]); 1712 clear_page_dirty_for_io(pages[i]);
1723 if (op & EXTENT_SET_WRITEBACK) 1713 if (page_ops & PAGE_SET_WRITEBACK)
1724 set_page_writeback(pages[i]); 1714 set_page_writeback(pages[i]);
1725 if (op & EXTENT_END_WRITEBACK) 1715 if (page_ops & PAGE_END_WRITEBACK)
1726 end_page_writeback(pages[i]); 1716 end_page_writeback(pages[i]);
1727 if (op & EXTENT_CLEAR_UNLOCK_PAGE) 1717 if (page_ops & PAGE_UNLOCK)
1728 unlock_page(pages[i]); 1718 unlock_page(pages[i]);
1729 page_cache_release(pages[i]); 1719 page_cache_release(pages[i]);
1730 } 1720 }