Skip to content

Commit 925a6ef

Browse files
author
Josef Bacik
committed
Btrfs: stop using try_to_writeback_inodes_sb_nr to flush delalloc
try_to_writeback_inodes_sb_nr returns 1 if writeback is already underway, which is completely fraking useless for us as we need to make sure pages are actually written before we go and check if there are ordered extents. So replace this with an open coding of try_to_writeback_inodes_sb_nr minus the writeback underway check so that we are sure to actually have flushed some dirty pages out and will have ordered extents to use. With this patch xfstests generic/273 now passes. Thanks, Signed-off-by: Josef Bacik <[email protected]>
1 parent b150a4f commit 925a6ef

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/btrfs/extent-tree.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,12 +3943,11 @@ static void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root,
39433943
unsigned long nr_pages)
39443944
{
39453945
struct super_block *sb = root->fs_info->sb;
3946-
int started;
39473946

3948-
/* If we can not start writeback, just sync all the delalloc file. */
3949-
started = try_to_writeback_inodes_sb_nr(sb, nr_pages,
3950-
WB_REASON_FS_FREE_SPACE);
3951-
if (!started) {
3947+
if (down_read_trylock(&sb->s_umount)) {
3948+
writeback_inodes_sb_nr(sb, nr_pages, WB_REASON_FS_FREE_SPACE);
3949+
up_read(&sb->s_umount);
3950+
} else {
39523951
/*
39533952
* We needn't worry the filesystem going from r/w to r/o though
39543953
* we don't acquire ->s_umount mutex, because the filesystem

0 commit comments

Comments
 (0)