Skip to contentSkip to conversation

Btrfs: remove wait_ordered_range in btrfs_evict_inode

PATCH Superseded Liu Bo 2 participants 5 messages Sep 12, 2018 – Sep 21, 2018 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Btrfs: remove wait_ordered_range in btrfs_evict_inode

As VFS has called ->invalidatepage() to get all ordered extents done and truncated all page cache pages, wait_ordered_range() is just a noop.

---
 fs/btrfs/inode.c | 3 ---
 1 file changed, 3 deletions(-)
fs/btrfs/inode.c +0 -3
index ff1d2ed2dc94..d3febc3a6bc0 100644
@@ -5390,9 +5390,6 @@ void btrfs_evict_inode(struct inode *inode)
 
 	if (is_bad_inode(inode))
 		goto no_delete;
-	/* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */
-	if (!special_file(inode->i_mode))
-		btrfs_wait_ordered_range(inode, 0, (u64)-1);
 
 	btrfs_free_io_failure_record(BTRFS_I(inode), 0, (u64)-1);
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Liu Bo

As VFS has called ->invalidatepage() to get all ordered extents done and truncated all page cache pages, wait_ordered_range() is just a noop.

Agreed, though looking up the exact points when there are no pages to be waited for took me some time. More references and hints in the changelog would be good. I'll add the patch to misc-next so it can be tested, but please send me an update if you have idea how to rephrase the changelog. Thanks.

author
#2 lore raw
Quoted 5 lines · David Sterba
Quoted 3 lines · Liu Bo

As VFS has called ->invalidatepage() to get all ordered extents done and truncated all page cache pages, wait_ordered_range() is just a noop.

Quoted 7 lines

Agreed, though looking up the exact points when there are no pages to be waited for took me some time. More references and hints in the changelog would be good. I'll add the patch to misc-next so it can be tested, but please send me an update if you have idea how to rephrase the changelog. Thanks.

OK, I'll add some call stack, hopefully can make it better.

thanks,
-liubo

author
#3 lore raw

PATCH v2 1/1 Btrfs: remove wait_ordered_rane in btrfs_evict_inode

In reply to Liu Bo

When we delete an inode,

btrfs_evict_inode() {
    truncate_inode_pages_final()
        truncate_inode_pages_range()
            lock_page()
            truncate_cleanup_page()
                 btrfs_invalidatepage()
                      wait_on_page_writeback
                           btrfs_lookup_ordered_range()
                 cancel_dirty_page()
           unlock_page()
     ...    
     btrfs_wait_ordered_range()
     ...

As VFS has called ->invalidatepage() to get all ordered extents done (if there is any) and truncated all page cache pages (no dirty pages to writeback after this step), wait_ordered_range() is just a noop.

---
v2: More details in the description.

 fs/btrfs/inode.c | 3 ---
 1 file changed, 3 deletions(-)
fs/btrfs/inode.c +0 -3
index ff1d2ed2dc94..d3febc3a6bc0 100644
@@ -5390,9 +5390,6 @@ void btrfs_evict_inode(struct inode *inode)
 
 	if (is_bad_inode(inode))
 		goto no_delete;
-	/* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */
-	if (!special_file(inode->i_mode))
-		btrfs_wait_ordered_range(inode, 0, (u64)-1);
 
 	btrfs_free_io_failure_record(BTRFS_I(inode), 0, (u64)-1);
 
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [PATCH v2] Btrfs: remove wait_ordered_rane in btrfs_evict_inode

Quoted 16 lines · Liu Bo

When we delete an inode,

btrfs_evict_inode() {
    truncate_inode_pages_final()
        truncate_inode_pages_range()
            lock_page()
            truncate_cleanup_page()
                 btrfs_invalidatepage()
                      wait_on_page_writeback
                           btrfs_lookup_ordered_range()
                 cancel_dirty_page()
           unlock_page()
     ...    
     btrfs_wait_ordered_range()
     ...
Quoted 8 lines

As VFS has called ->invalidatepage() to get all ordered extents done (if there is any) and truncated all page cache pages (no dirty pages to writeback after this step), wait_ordered_range() is just a noop.

---
v2: More details in the description.

Thanks, patch updated.