1 // SPDX-License-Identifier: GPL-2.0
4 #include "nocow_locking.h"
7 void __bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *t,
8 struct bpos bucket, int flags)
10 struct bch_fs *c = container_of(t, struct bch_fs, nocow_locks);
11 two_state_lock_t *l = bucket_nocow_lock(t, bucket);
12 u64 start_time = local_clock();
14 bch2_two_state_lock(l, flags & BUCKET_NOCOW_LOCK_UPDATE);
15 bch2_time_stats_update(&c->times[BCH_TIME_nocow_lock_contended], start_time);