Skip to contentSkip to conversation

btrfs: Don't balance btree inode pages from buffered write path

PATCH In review Nikolay Borisov 2 participants 2 messages May 28, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Don't balance btree inode pages from buffered write path

The call to btrfs_btree_balance_dirty has been there since the early days of BTRFS, when the btree was directly modified from the write path, hence dirtied btree inode pages. With the implementation of b888db2bd7b6 ("Btrfs: Add delayed allocation to the extent based page tree code") 13 years ago the btree is no longer modified from the write path, hence there is no point in calling this function. Just remove it.

---
 fs/btrfs/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/btrfs/file.c +0 -2
index fde125616687..6a76aea7bcb3 100644
@@ -1784,8 +1784,6 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
 		cond_resched();
 
 		balance_dirty_pages_ratelimited(inode->i_mapping);
-		if (dirty_pages < (fs_info->nodesize >> PAGE_SHIFT) + 1)
-			btrfs_btree_balance_dirty(fs_info);
 
 		pos += copied;
 		num_written += copied;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Nikolay Borisov

The call to btrfs_btree_balance_dirty has been there since the early days of BTRFS, when the btree was directly modified from the write path, hence dirtied btree inode pages. With the implementation of b888db2bd7b6 ("Btrfs: Add delayed allocation to the extent based page tree code") 13 years ago the btree is no longer modified from the write path, hence there is no point in calling this function. Just remove it.

Added to misc-next, thanks.