Skip to content

Commit fcd4781

Browse files
author
Kent Overstreet
committed
bcachefs: trace_data_update_done_no_rw_devs
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 8cf5406 commit fcd4781

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

fs/bcachefs/data_update.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ static int can_write_extent(struct bch_fs *c, struct data_update *m)
783783
darray_for_each(m->op.devs_have, i)
784784
__clear_bit(*i, devs.d);
785785

786+
CLASS(printbuf, buf)();
787+
buf.atomic++;
788+
786789
guard(rcu)();
787790

788791
unsigned nr_replicas = 0, i;
@@ -794,16 +797,22 @@ static int can_write_extent(struct bch_fs *c, struct data_update *m)
794797
struct bch_dev_usage usage;
795798
bch2_dev_usage_read_fast(ca, &usage);
796799

797-
if (!dev_buckets_free(ca, usage, m->op.watermark))
800+
u64 nr_free = dev_buckets_free(ca, usage, m->op.watermark);
801+
802+
prt_printf(&buf, "%s=%llu ", ca->name, nr_free);
803+
804+
if (!nr_free)
798805
continue;
799806

800807
nr_replicas += ca->mi.durability;
801808
if (nr_replicas >= m->op.nr_replicas)
802809
break;
803810
}
804811

805-
if (!nr_replicas)
812+
if (!nr_replicas) {
813+
trace_data_update_done_no_rw_devs(c, buf.buf);
806814
return bch_err_throw(c, data_update_done_no_rw_devs);
815+
}
807816
if (nr_replicas < m->op.nr_replicas)
808817
return bch_err_throw(c, insufficient_devices);
809818
return 0;

fs/bcachefs/trace.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,11 @@ DEFINE_EVENT(fs_str, data_update,
13301330
TP_ARGS(c, str)
13311331
);
13321332

1333+
DEFINE_EVENT(fs_str, data_update_done_no_rw_devs,
1334+
TP_PROTO(struct bch_fs *c, const char *str),
1335+
TP_ARGS(c, str)
1336+
);
1337+
13331338
DEFINE_EVENT(fs_str, io_move_pred,
13341339
TP_PROTO(struct bch_fs *c, const char *str),
13351340
TP_ARGS(c, str)

0 commit comments

Comments
 (0)