Skip to content

Commit 844f766

Browse files
author
Kent Overstreet
committed
bcachefs: Improve want_cached_ptr()
If promote target isn't set, rebalance should still leave a cached copy on the faster device. Fall back to foreground_target if it's set, or allow a cached copy on any device if neither are set. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent df2e19a commit 844f766

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/bcachefs/extents.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,9 @@ bch2_extent_has_ptr(struct bkey_s_c k1, struct extent_ptr_decoded p1, struct bke
10561056
static bool want_cached_ptr(struct bch_fs *c, struct bch_io_opts *opts,
10571057
struct bch_extent_ptr *ptr)
10581058
{
1059-
if (!opts->promote_target ||
1060-
!bch2_dev_in_target(c, ptr->dev, opts->promote_target))
1059+
unsigned target = opts->promote_target ?: opts->foreground_target;
1060+
1061+
if (target && !bch2_dev_in_target(c, ptr->dev, target))
10611062
return false;
10621063

10631064
struct bch_dev *ca = bch2_dev_rcu_noerror(c, ptr->dev);

0 commit comments

Comments
 (0)