@@ -1731,28 +1731,22 @@ STATIC u64 find_lock_delalloc_range(struct inode *inode,
1731
1731
return found ;
1732
1732
}
1733
1733
1734
- void extent_clear_unlock_delalloc (struct inode * inode , u64 start , u64 end ,
1735
- u64 delalloc_end , struct page * locked_page ,
1736
- unsigned clear_bits ,
1737
- unsigned long page_ops )
1734
+ static void __process_pages_contig (struct address_space * mapping ,
1735
+ struct page * locked_page ,
1736
+ pgoff_t start_index , pgoff_t end_index ,
1737
+ unsigned long page_ops )
1738
1738
{
1739
- struct extent_io_tree * tree = & BTRFS_I ( inode ) -> io_tree ;
1740
- int ret ;
1739
+ unsigned long nr_pages = end_index - start_index + 1 ;
1740
+ pgoff_t index = start_index ;
1741
1741
struct page * pages [16 ];
1742
- unsigned long index = start >> PAGE_SHIFT ;
1743
- unsigned long end_index = end >> PAGE_SHIFT ;
1744
- unsigned long nr_pages = end_index - index + 1 ;
1742
+ unsigned ret ;
1745
1743
int i ;
1746
1744
1747
- clear_extent_bit (tree , start , end , clear_bits , 1 , 0 , NULL , GFP_NOFS );
1748
- if (page_ops == 0 )
1749
- return ;
1750
-
1751
1745
if ((page_ops & PAGE_SET_ERROR ) && nr_pages > 0 )
1752
- mapping_set_error (inode -> i_mapping , - EIO );
1746
+ mapping_set_error (mapping , - EIO );
1753
1747
1754
1748
while (nr_pages > 0 ) {
1755
- ret = find_get_pages_contig (inode -> i_mapping , index ,
1749
+ ret = find_get_pages_contig (mapping , index ,
1756
1750
min_t (unsigned long ,
1757
1751
nr_pages , ARRAY_SIZE (pages )), pages );
1758
1752
for (i = 0 ; i < ret ; i ++ ) {
@@ -1782,6 +1776,19 @@ void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
1782
1776
}
1783
1777
}
1784
1778
1779
+ void extent_clear_unlock_delalloc (struct inode * inode , u64 start , u64 end ,
1780
+ u64 delalloc_end , struct page * locked_page ,
1781
+ unsigned clear_bits ,
1782
+ unsigned long page_ops )
1783
+ {
1784
+ clear_extent_bit (& BTRFS_I (inode )-> io_tree , start , end , clear_bits , 1 , 0 ,
1785
+ NULL , GFP_NOFS );
1786
+
1787
+ __process_pages_contig (inode -> i_mapping , locked_page ,
1788
+ start >> PAGE_SHIFT , end >> PAGE_SHIFT ,
1789
+ page_ops );
1790
+ }
1791
+
1785
1792
/*
1786
1793
* count the number of bytes in the tree that have a given bit(s)
1787
1794
* set. This can be fairly slow, except for EXTENT_DIRTY which is
0 commit comments