diff options
author | Filipe Manana <fdmanana@suse.com> | 2014-10-13 07:28:38 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-11-20 20:14:29 -0500 |
commit | e38e2ed701ff5f3d889c8dda5fe863e165e60d61 (patch) | |
tree | 315b8703ca6c3317996de05a55ceb252257cbcff /fs/btrfs/transaction.c | |
parent | 663dfbb07774e0fe1049e8db3054a08500122f18 (diff) |
Btrfs: make find_first_extent_bit be able to cache any state
Right now the only caller of find_first_extent_bit() that is interested
in caching extent states (transaction or log commit), never gets an extent
state cached. This is because find_first_extent_bit() only caches states
that have at least one of the flags EXTENT_IOBITS or EXTENT_BOUNDARY, and
the transaction/log commit caller always passes a tree that doesn't have
ever extent states with any of those flags (they can only have one of the
following flags: EXTENT_DIRTY, EXTENT_NEW or EXTENT_NEED_WAIT).
This change together with the following one in the patch series (titled
"Btrfs: avoid returning -ENOMEM in convert_extent_bit() too early") will
help reduce significantly the chances of calls to convert_extent_bit()
fail with -ENOMEM when called from the transaction/log commit code.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 04dbc800c209..16c704b68704 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -883,6 +883,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root, | |||
883 | werr = err; | 883 | werr = err; |
884 | else if (wait_writeback) | 884 | else if (wait_writeback) |
885 | werr = filemap_fdatawait_range(mapping, start, end); | 885 | werr = filemap_fdatawait_range(mapping, start, end); |
886 | free_extent_state(cached_state); | ||
886 | cached_state = NULL; | 887 | cached_state = NULL; |
887 | cond_resched(); | 888 | cond_resched(); |
888 | start = end + 1; | 889 | start = end + 1; |
@@ -927,6 +928,8 @@ int btrfs_wait_marked_extents(struct btrfs_root *root, | |||
927 | err = filemap_fdatawait_range(mapping, start, end); | 928 | err = filemap_fdatawait_range(mapping, start, end); |
928 | if (err) | 929 | if (err) |
929 | werr = err; | 930 | werr = err; |
931 | free_extent_state(cached_state); | ||
932 | cached_state = NULL; | ||
930 | cond_resched(); | 933 | cond_resched(); |
931 | start = end + 1; | 934 | start = end + 1; |
932 | } | 935 | } |