@@ -4986,9 +4986,8 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
49864986 }
49874987
49884988 clear_extent_bit (& BTRFS_I (inode )-> io_tree , block_start , block_end ,
4989- EXTENT_DIRTY | EXTENT_DELALLOC |
4990- EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG ,
4991- 0 , 0 , & cached_state );
4989+ EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG ,
4990+ 0 , 0 , & cached_state );
49924991
49934992 ret = btrfs_set_extent_delalloc (inode , block_start , block_end , 0 ,
49944993 & cached_state );
@@ -5372,9 +5371,9 @@ static void evict_inode_truncate_pages(struct inode *inode)
53725371 btrfs_qgroup_free_data (inode , NULL , start , end - start + 1 );
53735372
53745373 clear_extent_bit (io_tree , start , end ,
5375- EXTENT_LOCKED | EXTENT_DIRTY |
5376- EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |
5377- EXTENT_DEFRAG , 1 , 1 , & cached_state );
5374+ EXTENT_LOCKED | EXTENT_DELALLOC |
5375+ EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG , 1 , 1 ,
5376+ & cached_state );
53785377
53795378 cond_resched ();
53805379 spin_lock (& io_tree -> lock );
@@ -7732,12 +7731,9 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
77327731 u64 start = iblock << inode -> i_blkbits ;
77337732 u64 lockstart , lockend ;
77347733 u64 len = bh_result -> b_size ;
7735- int unlock_bits = EXTENT_LOCKED ;
77367734 int ret = 0 ;
77377735
7738- if (create )
7739- unlock_bits |= EXTENT_DIRTY ;
7740- else
7736+ if (!create )
77417737 len = min_t (u64 , len , fs_info -> sectorsize );
77427738
77437739 lockstart = start ;
@@ -7796,9 +7792,8 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
77967792 if (ret < 0 )
77977793 goto unlock_err ;
77987794
7799- /* clear and unlock the entire range */
7800- clear_extent_bit (& BTRFS_I (inode )-> io_tree , lockstart , lockend ,
7801- unlock_bits , 1 , 0 , & cached_state );
7795+ unlock_extent_cached (& BTRFS_I (inode )-> io_tree , lockstart ,
7796+ lockend , & cached_state );
78027797 } else {
78037798 ret = btrfs_get_blocks_direct_read (em , bh_result , inode ,
78047799 start , len );
@@ -7814,9 +7809,8 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
78147809 */
78157810 lockstart = start + bh_result -> b_size ;
78167811 if (lockstart < lockend ) {
7817- clear_extent_bit (& BTRFS_I (inode )-> io_tree , lockstart ,
7818- lockend , unlock_bits , 1 , 0 ,
7819- & cached_state );
7812+ unlock_extent_cached (& BTRFS_I (inode )-> io_tree ,
7813+ lockstart , lockend , & cached_state );
78207814 } else {
78217815 free_extent_state (cached_state );
78227816 }
@@ -7827,8 +7821,8 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
78277821 return 0 ;
78287822
78297823unlock_err :
7830- clear_extent_bit (& BTRFS_I (inode )-> io_tree , lockstart , lockend ,
7831- unlock_bits , 1 , 0 , & cached_state );
7824+ unlock_extent_cached (& BTRFS_I (inode )-> io_tree , lockstart , lockend ,
7825+ & cached_state );
78327826err :
78337827 if (dio_data )
78347828 current -> journal_info = dio_data ;
@@ -8843,8 +8837,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset,
88438837 */
88448838 if (!inode_evicting )
88458839 clear_extent_bit (tree , start , end ,
8846- EXTENT_DIRTY | EXTENT_DELALLOC |
8847- EXTENT_DELALLOC_NEW |
8840+ EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
88488841 EXTENT_LOCKED | EXTENT_DO_ACCOUNTING |
88498842 EXTENT_DEFRAG , 1 , 0 , & cached_state );
88508843 /*
@@ -8899,8 +8892,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset,
88998892 if (PageDirty (page ))
89008893 btrfs_qgroup_free_data (inode , NULL , page_start , PAGE_SIZE );
89018894 if (!inode_evicting ) {
8902- clear_extent_bit (tree , page_start , page_end ,
8903- EXTENT_LOCKED | EXTENT_DIRTY |
8895+ clear_extent_bit (tree , page_start , page_end , EXTENT_LOCKED |
89048896 EXTENT_DELALLOC | EXTENT_DELALLOC_NEW |
89058897 EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG , 1 , 1 ,
89068898 & cached_state );
@@ -9028,9 +9020,8 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
90289020 * reserve data&meta space before lock_page() (see above comments).
90299021 */
90309022 clear_extent_bit (& BTRFS_I (inode )-> io_tree , page_start , end ,
9031- EXTENT_DIRTY | EXTENT_DELALLOC |
9032- EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG ,
9033- 0 , 0 , & cached_state );
9023+ EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |
9024+ EXTENT_DEFRAG , 0 , 0 , & cached_state );
90349025
90359026 ret2 = btrfs_set_extent_delalloc (inode , page_start , end , 0 ,
90369027 & cached_state );
0 commit comments