hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/gfs2/glock.h
....@@ -1,10 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
34 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4
- *
5
- * This copyrighted material is made available to anyone wishing to use,
6
- * modify, copy, or redistribute it subject to the terms and conditions
7
- * of the GNU General Public License version 2.
85 */
96
107 #ifndef __GLOCK_DOT_H__
....@@ -193,6 +190,7 @@
193190 extern int gfs2_glock_nq(struct gfs2_holder *gh);
194191 extern int gfs2_glock_poll(struct gfs2_holder *gh);
195192 extern int gfs2_glock_wait(struct gfs2_holder *gh);
193
+extern int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs);
196194 extern void gfs2_glock_dq(struct gfs2_holder *gh);
197195 extern void gfs2_glock_dq_wait(struct gfs2_holder *gh);
198196 extern void gfs2_glock_dq_uninit(struct gfs2_holder *gh);
....@@ -202,8 +200,20 @@
202200 struct gfs2_holder *gh);
203201 extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
204202 extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
205
-extern void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl);
206
-#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0)
203
+extern void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl,
204
+ bool fsid);
205
+#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { \
206
+ gfs2_dump_glock(NULL, gl, true); \
207
+ BUG(); } } while(0)
208
+#define gfs2_glock_assert_warn(gl, x) do { if (unlikely(!(x))) { \
209
+ gfs2_dump_glock(NULL, gl, true); \
210
+ gfs2_assert_warn((gl)->gl_name.ln_sbd, (x)); } } \
211
+ while (0)
212
+#define gfs2_glock_assert_withdraw(gl, x) do { if (unlikely(!(x))) { \
213
+ gfs2_dump_glock(NULL, gl, true); \
214
+ gfs2_assert_withdraw((gl)->gl_name.ln_sbd, (x)); } } \
215
+ while (0)
216
+
207217 extern __printf(2, 3)
208218 void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...);
209219
....@@ -234,6 +244,10 @@
234244
235245 extern void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state);
236246 extern void gfs2_glock_complete(struct gfs2_glock *gl, int ret);
247
+extern bool gfs2_queue_delete_work(struct gfs2_glock *gl, unsigned long delay);
248
+extern void gfs2_cancel_delete_work(struct gfs2_glock *gl);
249
+extern bool gfs2_delete_work_queued(const struct gfs2_glock *gl);
250
+extern void gfs2_flush_delete_work(struct gfs2_sbd *sdp);
237251 extern void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);
238252 extern void gfs2_glock_finish_truncate(struct gfs2_inode *ip);
239253 extern void gfs2_glock_thaw(struct gfs2_sbd *sdp);
....@@ -243,9 +257,9 @@
243257 extern int __init gfs2_glock_init(void);
244258 extern void gfs2_glock_exit(void);
245259
246
-extern int gfs2_create_debugfs_file(struct gfs2_sbd *sdp);
260
+extern void gfs2_create_debugfs_file(struct gfs2_sbd *sdp);
247261 extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp);
248
-extern int gfs2_register_debugfs(void);
262
+extern void gfs2_register_debugfs(void);
249263 extern void gfs2_unregister_debugfs(void);
250264
251265 extern const struct lm_lockops gfs2_dlm_ops;
....@@ -260,6 +274,11 @@
260274 return gh->gh_gl;
261275 }
262276
277
+static inline bool gfs2_holder_queued(struct gfs2_holder *gh)
278
+{
279
+ return !list_empty(&gh->gh_list);
280
+}
281
+
263282 /**
264283 * glock_set_object - set the gl_object field of a glock
265284 * @gl: the glock
....@@ -269,7 +288,7 @@
269288 {
270289 spin_lock(&gl->gl_lockref.lock);
271290 if (gfs2_assert_warn(gl->gl_name.ln_sbd, gl->gl_object == NULL))
272
- gfs2_dump_glock(NULL, gl);
291
+ gfs2_dump_glock(NULL, gl, true);
273292 gl->gl_object = object;
274293 spin_unlock(&gl->gl_lockref.lock);
275294 }
....@@ -281,7 +300,7 @@
281300 *
282301 * I'd love to similarly add this:
283302 * else if (gfs2_assert_warn(gl->gl_sbd, gl->gl_object == object))
284
- * gfs2_dump_glock(NULL, gl);
303
+ * gfs2_dump_glock(NULL, gl, true);
285304 * Unfortunately, that's not possible because as soon as gfs2_delete_inode
286305 * frees the block in the rgrp, another process can reassign it for an I_NEW
287306 * inode in gfs2_create_inode because that calls new_inode, not gfs2_iget.
....@@ -300,4 +319,7 @@
300319 spin_unlock(&gl->gl_lockref.lock);
301320 }
302321
322
+extern void gfs2_inode_remember_delete(struct gfs2_glock *gl, u64 generation);
323
+extern bool gfs2_inode_already_deleted(struct gfs2_glock *gl, u64 generation);
324
+
303325 #endif /* __GLOCK_DOT_H__ */