summaryrefslogtreecommitdiff
path: root/libbcachefs/move.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-25 21:51:30 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-25 21:51:30 -0500
commit3a0cc86e767b95366b9cbdba7a1453454f1b5a41 (patch)
tree56fc9015ed1c97b3a98d7592ad81a9d40a8d3f9b /libbcachefs/move.h
parent138397d89212cd0b5abdbfdd644dc7702ea00f4a (diff)
Update bcachefs sources to 8c94740b1bf8 bcachefs: Add missing vaidation for jset_entry_data_usage
Diffstat (limited to 'libbcachefs/move.h')
-rw-r--r--libbcachefs/move.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbcachefs/move.h b/libbcachefs/move.h
index cedde6ee..53196567 100644
--- a/libbcachefs/move.h
+++ b/libbcachefs/move.h
@@ -38,6 +38,25 @@ struct moving_context {
wait_queue_head_t wait;
};
+#define move_ctxt_wait_event_timeout(_ctxt, _cond, _timeout) \
+({ \
+ int _ret = 0; \
+ while (true) { \
+ bool cond_finished = false; \
+ bch2_moving_ctxt_do_pending_writes(_ctxt); \
+ \
+ if (_cond) \
+ break; \
+ bch2_trans_unlock_long((_ctxt)->trans); \
+ _ret = __wait_event_timeout((_ctxt)->wait, \
+ bch2_moving_ctxt_next_pending_write(_ctxt) || \
+ (cond_finished = (_cond)), _timeout); \
+ if (_ret || ( cond_finished)) \
+ break; \
+ } \
+ _ret; \
+})
+
#define move_ctxt_wait_event(_ctxt, _cond) \
do { \
bool cond_finished = false; \