summaryrefslogtreecommitdiff
path: root/fs/bcachefs/nocow_locking.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/nocow_locking.c')
-rw-r--r--fs/bcachefs/nocow_locking.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/bcachefs/nocow_locking.c b/fs/bcachefs/nocow_locking.c
new file mode 100644
index 000000000000..8f06e08370a2
--- /dev/null
+++ b/fs/bcachefs/nocow_locking.c
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include "bcachefs.h"
+#include "nocow_locking.h"
+#include "util.h"
+
+void __bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *t,
+ two_state_lock_t *l, int flags)
+{
+ struct bch_fs *c = container_of(t, struct bch_fs, nocow_locks);
+ u64 start_time = local_clock();
+
+ bch2_two_state_lock(l, flags & BUCKET_NOCOW_LOCK_UPDATE);
+ bch2_time_stats_update(&c->times[BCH_TIME_nocow_lock_contended], start_time);
+}