mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-08 00:00:12 +03:00
Update bcachefs sources to c241a5bf54ed bcachefs: nopromote sub counters
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
This commit is contained in:
parent
36a3634c5e
commit
b261da891a
@ -1 +1 @@
|
|||||||
8efd93eb2d0f977564b0db7d9e54369ae870c437
|
c241a5bf54ed4aeb29d029d8f1dae1dd592cdda4
|
||||||
|
|||||||
@ -1336,6 +1336,10 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
|
|||||||
k = bkey_p_next(k);
|
k = bkey_p_next(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (k = i->start; k != vstruct_last(i);) {
|
||||||
|
BUG_ON(!k->u64s);
|
||||||
|
}
|
||||||
|
|
||||||
bch2_bset_build_aux_tree(b, b->set, false);
|
bch2_bset_build_aux_tree(b, b->set, false);
|
||||||
|
|
||||||
set_needs_whiteout(btree_bset_first(b), true);
|
set_needs_whiteout(btree_bset_first(b), true);
|
||||||
|
|||||||
@ -39,38 +39,73 @@ MODULE_PARM_DESC(read_corrupt_ratio, "");
|
|||||||
|
|
||||||
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
||||||
|
|
||||||
|
static inline u32 bch2_dev_congested_read(struct bch_dev *ca, u64 now)
|
||||||
|
{
|
||||||
|
s64 congested = atomic_read(&ca->congested);
|
||||||
|
u64 last = READ_ONCE(ca->congested_last);
|
||||||
|
if (time_after64(now, last))
|
||||||
|
congested -= (now - last) >> 12;
|
||||||
|
|
||||||
|
return clamp(congested, 0LL, CONGESTED_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
static bool bch2_target_congested(struct bch_fs *c, u16 target)
|
static bool bch2_target_congested(struct bch_fs *c, u16 target)
|
||||||
{
|
{
|
||||||
const struct bch_devs_mask *devs;
|
const struct bch_devs_mask *devs;
|
||||||
unsigned d, nr = 0, total = 0;
|
unsigned d, nr = 0, total = 0;
|
||||||
u64 now = local_clock(), last;
|
u64 now = local_clock();
|
||||||
s64 congested;
|
|
||||||
struct bch_dev *ca;
|
|
||||||
|
|
||||||
if (!target)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
guard(rcu)();
|
guard(rcu)();
|
||||||
devs = bch2_target_to_mask(c, target) ?:
|
devs = bch2_target_to_mask(c, target) ?:
|
||||||
&c->rw_devs[BCH_DATA_user];
|
&c->rw_devs[BCH_DATA_user];
|
||||||
|
|
||||||
for_each_set_bit(d, devs->d, BCH_SB_MEMBERS_MAX) {
|
for_each_set_bit(d, devs->d, BCH_SB_MEMBERS_MAX) {
|
||||||
ca = rcu_dereference(c->devs[d]);
|
struct bch_dev *ca = rcu_dereference(c->devs[d]);
|
||||||
if (!ca)
|
if (!ca)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
congested = atomic_read(&ca->congested);
|
total += bch2_dev_congested_read(ca, now);
|
||||||
last = READ_ONCE(ca->congested_last);
|
|
||||||
if (time_after64(now, last))
|
|
||||||
congested -= (now - last) >> 12;
|
|
||||||
|
|
||||||
total += max(congested, 0LL);
|
|
||||||
nr++;
|
nr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_random_u32_below(nr * CONGESTED_MAX) < total;
|
return get_random_u32_below(nr * CONGESTED_MAX) < total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bch2_dev_congested_to_text(struct printbuf *out, struct bch_dev *ca)
|
||||||
|
{
|
||||||
|
printbuf_tabstop_push(out, 32);
|
||||||
|
|
||||||
|
prt_printf(out, "current:\t%u%%\n",
|
||||||
|
bch2_dev_congested_read(ca, local_clock()) *
|
||||||
|
100 / CONGESTED_MAX);
|
||||||
|
|
||||||
|
prt_printf(out, "raw:\t%i/%u\n", atomic_read(&ca->congested), CONGESTED_MAX);
|
||||||
|
|
||||||
|
prt_printf(out, "last io over threshold:\t");
|
||||||
|
bch2_pr_time_units(out, local_clock() - ca->congested_last);
|
||||||
|
prt_newline(out);
|
||||||
|
|
||||||
|
prt_printf(out, "read latency threshold:\t");
|
||||||
|
bch2_pr_time_units(out,
|
||||||
|
ca->io_latency[READ].quantiles.entries[QUANTILE_IDX(1)].m * 2);
|
||||||
|
prt_newline(out);
|
||||||
|
|
||||||
|
prt_printf(out, "median read latency:\t");
|
||||||
|
bch2_pr_time_units(out,
|
||||||
|
ca->io_latency[READ].quantiles.entries[QUANTILE_IDX(7)].m);
|
||||||
|
prt_newline(out);
|
||||||
|
|
||||||
|
prt_printf(out, "write latency threshold:\t");
|
||||||
|
bch2_pr_time_units(out,
|
||||||
|
ca->io_latency[WRITE].quantiles.entries[QUANTILE_IDX(1)].m * 3);
|
||||||
|
prt_newline(out);
|
||||||
|
|
||||||
|
prt_printf(out, "median write latency:\t");
|
||||||
|
bch2_pr_time_units(out,
|
||||||
|
ca->io_latency[WRITE].quantiles.entries[QUANTILE_IDX(7)].m);
|
||||||
|
prt_newline(out);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static bool bch2_target_congested(struct bch_fs *c, u16 target)
|
static bool bch2_target_congested(struct bch_fs *c, u16 target)
|
||||||
@ -130,22 +165,32 @@ static inline int should_promote(struct bch_fs *c, struct bkey_s_c k,
|
|||||||
if (!have_io_error(failed)) {
|
if (!have_io_error(failed)) {
|
||||||
BUG_ON(!opts.promote_target);
|
BUG_ON(!opts.promote_target);
|
||||||
|
|
||||||
if (!(flags & BCH_READ_may_promote))
|
if (!(flags & BCH_READ_may_promote)) {
|
||||||
|
count_event(c, io_read_nopromote_may_not);
|
||||||
return bch_err_throw(c, nopromote_may_not);
|
return bch_err_throw(c, nopromote_may_not);
|
||||||
|
}
|
||||||
|
|
||||||
if (bch2_bkey_has_target(c, k, opts.promote_target))
|
if (bch2_bkey_has_target(c, k, opts.promote_target)) {
|
||||||
|
count_event(c, io_read_nopromote_already_promoted);
|
||||||
return bch_err_throw(c, nopromote_already_promoted);
|
return bch_err_throw(c, nopromote_already_promoted);
|
||||||
|
}
|
||||||
|
|
||||||
if (bkey_extent_is_unwritten(k))
|
if (bkey_extent_is_unwritten(k)) {
|
||||||
|
count_event(c, io_read_nopromote_unwritten);
|
||||||
return bch_err_throw(c, nopromote_unwritten);
|
return bch_err_throw(c, nopromote_unwritten);
|
||||||
|
}
|
||||||
|
|
||||||
if (bch2_target_congested(c, opts.promote_target))
|
if (bch2_target_congested(c, opts.promote_target)) {
|
||||||
|
count_event(c, io_read_nopromote_congested);
|
||||||
return bch_err_throw(c, nopromote_congested);
|
return bch_err_throw(c, nopromote_congested);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rhashtable_lookup_fast(&c->promote_table, &pos,
|
if (rhashtable_lookup_fast(&c->promote_table, &pos,
|
||||||
bch_promote_params))
|
bch_promote_params)) {
|
||||||
|
count_event(c, io_read_nopromote_in_flight);
|
||||||
return bch_err_throw(c, nopromote_in_flight);
|
return bch_err_throw(c, nopromote_in_flight);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,10 @@
|
|||||||
#include "extents_types.h"
|
#include "extents_types.h"
|
||||||
#include "reflink.h"
|
#include "reflink.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
||||||
|
void bch2_dev_congested_to_text(struct printbuf *, struct bch_dev *);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct bch_read_bio {
|
struct bch_read_bio {
|
||||||
struct bch_fs *c;
|
struct bch_fs *c;
|
||||||
u64 start_time;
|
u64 start_time;
|
||||||
|
|||||||
@ -13,6 +13,11 @@ enum counters_flags {
|
|||||||
x(io_read_hole, 81, TYPE_SECTORS) \
|
x(io_read_hole, 81, TYPE_SECTORS) \
|
||||||
x(io_read_promote, 30, TYPE_COUNTER) \
|
x(io_read_promote, 30, TYPE_COUNTER) \
|
||||||
x(io_read_nopromote, 85, TYPE_COUNTER) \
|
x(io_read_nopromote, 85, TYPE_COUNTER) \
|
||||||
|
x(io_read_nopromote_may_not, 86, TYPE_COUNTER) \
|
||||||
|
x(io_read_nopromote_already_promoted, 87, TYPE_COUNTER) \
|
||||||
|
x(io_read_nopromote_unwritten, 88, TYPE_COUNTER) \
|
||||||
|
x(io_read_nopromote_congested, 89, TYPE_COUNTER) \
|
||||||
|
x(io_read_nopromote_in_flight, 90, TYPE_COUNTER) \
|
||||||
x(io_read_bounce, 31, TYPE_COUNTER) \
|
x(io_read_bounce, 31, TYPE_COUNTER) \
|
||||||
x(io_read_split, 33, TYPE_COUNTER) \
|
x(io_read_split, 33, TYPE_COUNTER) \
|
||||||
x(io_read_reuse_race, 34, TYPE_COUNTER) \
|
x(io_read_reuse_race, 34, TYPE_COUNTER) \
|
||||||
|
|||||||
@ -172,7 +172,9 @@ read_attribute(io_latency_read);
|
|||||||
read_attribute(io_latency_write);
|
read_attribute(io_latency_write);
|
||||||
read_attribute(io_latency_stats_read);
|
read_attribute(io_latency_stats_read);
|
||||||
read_attribute(io_latency_stats_write);
|
read_attribute(io_latency_stats_write);
|
||||||
|
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
||||||
read_attribute(congested);
|
read_attribute(congested);
|
||||||
|
#endif
|
||||||
|
|
||||||
read_attribute(btree_write_stats);
|
read_attribute(btree_write_stats);
|
||||||
|
|
||||||
@ -942,9 +944,10 @@ SHOW(bch2_dev)
|
|||||||
if (attr == &sysfs_io_latency_stats_write)
|
if (attr == &sysfs_io_latency_stats_write)
|
||||||
bch2_time_stats_to_text(out, &ca->io_latency[WRITE].stats);
|
bch2_time_stats_to_text(out, &ca->io_latency[WRITE].stats);
|
||||||
|
|
||||||
sysfs_printf(congested, "%u%%",
|
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
||||||
clamp(atomic_read(&ca->congested), 0, CONGESTED_MAX)
|
if (attr == &sysfs_congested)
|
||||||
* 100 / CONGESTED_MAX);
|
bch2_dev_congested_to_text(out, ca);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (attr == &sysfs_alloc_debug)
|
if (attr == &sysfs_alloc_debug)
|
||||||
bch2_dev_alloc_debug_to_text(out, ca);
|
bch2_dev_alloc_debug_to_text(out, ca);
|
||||||
@ -1015,7 +1018,9 @@ struct attribute *bch2_dev_files[] = {
|
|||||||
&sysfs_io_latency_write,
|
&sysfs_io_latency_write,
|
||||||
&sysfs_io_latency_stats_read,
|
&sysfs_io_latency_stats_read,
|
||||||
&sysfs_io_latency_stats_write,
|
&sysfs_io_latency_stats_write,
|
||||||
|
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
|
||||||
&sysfs_congested,
|
&sysfs_congested,
|
||||||
|
#endif
|
||||||
|
|
||||||
&sysfs_read_fua_test,
|
&sysfs_read_fua_test,
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user