mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
bcachefs: handle restarts in bch2_bucket_io_time_reset()
bch2_bucket_io_time_reset() doesn't need to succeed, which is why it didn't previously retry on transaction restart - but we're now treating these as errors. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
29fd10a36a
commit
6bee2a04c5
@ -2351,24 +2351,19 @@ int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
|
||||
|
||||
/* Bucket IO clocks: */
|
||||
|
||||
int bch2_bucket_io_time_reset(struct btree_trans *trans, unsigned dev,
|
||||
size_t bucket_nr, int rw)
|
||||
static int __bch2_bucket_io_time_reset(struct btree_trans *trans, unsigned dev,
|
||||
size_t bucket_nr, int rw)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
|
||||
struct btree_iter iter;
|
||||
struct bkey_i_alloc_v4 *a;
|
||||
u64 now;
|
||||
int ret = 0;
|
||||
|
||||
if (bch2_trans_relock(trans))
|
||||
bch2_trans_begin(trans);
|
||||
|
||||
a = bch2_trans_start_alloc_update_noupdate(trans, &iter, POS(dev, bucket_nr));
|
||||
ret = PTR_ERR_OR_ZERO(a);
|
||||
struct bkey_i_alloc_v4 *a =
|
||||
bch2_trans_start_alloc_update_noupdate(trans, &iter, POS(dev, bucket_nr));
|
||||
int ret = PTR_ERR_OR_ZERO(a);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
now = bch2_current_io_time(c, rw);
|
||||
u64 now = bch2_current_io_time(c, rw);
|
||||
if (a->v.io_time[rw] == now)
|
||||
goto out;
|
||||
|
||||
@ -2381,6 +2376,15 @@ int bch2_bucket_io_time_reset(struct btree_trans *trans, unsigned dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int bch2_bucket_io_time_reset(struct btree_trans *trans, unsigned dev,
|
||||
size_t bucket_nr, int rw)
|
||||
{
|
||||
if (bch2_trans_relock(trans))
|
||||
bch2_trans_begin(trans);
|
||||
|
||||
return nested_lockrestart_do(trans, __bch2_bucket_io_time_reset(trans, dev, bucket_nr, rw));
|
||||
}
|
||||
|
||||
/* Startup/shutdown (ro/rw): */
|
||||
|
||||
void bch2_recalc_capacity(struct bch_fs *c)
|
||||
|
Loading…
Reference in New Issue
Block a user