Commit 844245b4 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: add a flush step for delayed iputs

Delayed iputs could very well free up enough space without needing to
commit the transaction, so make this step it's own step.  This will
allow us to skip the step for evictions in a later patch.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e11c0406
...@@ -2548,7 +2548,8 @@ enum btrfs_flush_state { ...@@ -2548,7 +2548,8 @@ enum btrfs_flush_state {
FLUSH_DELALLOC_WAIT = 6, FLUSH_DELALLOC_WAIT = 6,
ALLOC_CHUNK = 7, ALLOC_CHUNK = 7,
ALLOC_CHUNK_FORCE = 8, ALLOC_CHUNK_FORCE = 8,
COMMIT_TRANS = 9, RUN_DELAYED_IPUTS = 9,
COMMIT_TRANS = 10,
}; };
int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
......
...@@ -664,7 +664,7 @@ static void flush_space(struct btrfs_fs_info *fs_info, ...@@ -664,7 +664,7 @@ static void flush_space(struct btrfs_fs_info *fs_info,
if (ret > 0 || ret == -ENOSPC) if (ret > 0 || ret == -ENOSPC)
ret = 0; ret = 0;
break; break;
case COMMIT_TRANS: case RUN_DELAYED_IPUTS:
/* /*
* If we have pending delayed iputs then we could free up a * If we have pending delayed iputs then we could free up a
* bunch of pinned space, so make sure we run the iputs before * bunch of pinned space, so make sure we run the iputs before
...@@ -672,7 +672,8 @@ static void flush_space(struct btrfs_fs_info *fs_info, ...@@ -672,7 +672,8 @@ static void flush_space(struct btrfs_fs_info *fs_info,
*/ */
btrfs_run_delayed_iputs(fs_info); btrfs_run_delayed_iputs(fs_info);
btrfs_wait_on_delayed_iputs(fs_info); btrfs_wait_on_delayed_iputs(fs_info);
break;
case COMMIT_TRANS:
ret = may_commit_transaction(fs_info, space_info); ret = may_commit_transaction(fs_info, space_info);
break; break;
default: default:
......
...@@ -1088,6 +1088,7 @@ TRACE_EVENT(btrfs_trigger_flush, ...@@ -1088,6 +1088,7 @@ TRACE_EVENT(btrfs_trigger_flush,
{ FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS"}, \ { FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS"}, \
{ ALLOC_CHUNK, "ALLOC_CHUNK"}, \ { ALLOC_CHUNK, "ALLOC_CHUNK"}, \
{ ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE"}, \ { ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE"}, \
{ RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS"}, \
{ COMMIT_TRANS, "COMMIT_TRANS"}) { COMMIT_TRANS, "COMMIT_TRANS"})
TRACE_EVENT(btrfs_flush_space, TRACE_EVENT(btrfs_flush_space,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment