17336d0e6SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b3b94faaSDavid Teigland /*
3b3b94faaSDavid Teigland * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4d0109bfaSBob Peterson * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
5b3b94faaSDavid Teigland */
6b3b94faaSDavid Teigland
7b3b94faaSDavid Teigland #ifndef __LOPS_DOT_H__
8b3b94faaSDavid Teigland #define __LOPS_DOT_H__
9b3b94faaSDavid Teigland
10f2f7ba52SSteven Whitehouse #include <linux/list.h>
11f2f7ba52SSteven Whitehouse #include "incore.h"
12f2f7ba52SSteven Whitehouse
13b09e593dSSteven Whitehouse extern const struct gfs2_log_operations *gfs2_log_ops[];
14*d312fbf6SAndreas Gruenbacher
15*d312fbf6SAndreas Gruenbacher void gfs2_log_incr_head(struct gfs2_sbd *sdp);
16*d312fbf6SAndreas Gruenbacher u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lbn);
17*d312fbf6SAndreas Gruenbacher void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
1882218943SBob Peterson struct page *page, unsigned size, unsigned offset,
1982218943SBob Peterson u64 blkno);
20*d312fbf6SAndreas Gruenbacher void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf);
21*d312fbf6SAndreas Gruenbacher void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
22*d312fbf6SAndreas Gruenbacher int gfs2_find_jhead(struct gfs2_jdesc *jd,
23f4686c26SAbhi Das struct gfs2_log_header_host *head, bool keep_cache);
24*d312fbf6SAndreas Gruenbacher void gfs2_drain_revokes(struct gfs2_sbd *sdp);
25*d312fbf6SAndreas Gruenbacher
buf_limit(struct gfs2_sbd * sdp)262332c443SRobert Peterson static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
272332c443SRobert Peterson {
28458094c2SAndreas Gruenbacher return sdp->sd_ldptrs;
292332c443SRobert Peterson }
302332c443SRobert Peterson
databuf_limit(struct gfs2_sbd * sdp)312332c443SRobert Peterson static inline unsigned int databuf_limit(struct gfs2_sbd *sdp)
322332c443SRobert Peterson {
33458094c2SAndreas Gruenbacher return sdp->sd_ldptrs / 2;
342332c443SRobert Peterson }
352332c443SRobert Peterson
lops_before_commit(struct gfs2_sbd * sdp,struct gfs2_trans * tr)36d69a3c65SSteven Whitehouse static inline void lops_before_commit(struct gfs2_sbd *sdp,
37d69a3c65SSteven Whitehouse struct gfs2_trans *tr)
38b3b94faaSDavid Teigland {
39b3b94faaSDavid Teigland int x;
40b3b94faaSDavid Teigland for (x = 0; gfs2_log_ops[x]; x++)
41b3b94faaSDavid Teigland if (gfs2_log_ops[x]->lo_before_commit)
42d69a3c65SSteven Whitehouse gfs2_log_ops[x]->lo_before_commit(sdp, tr);
43b3b94faaSDavid Teigland }
44b3b94faaSDavid Teigland
lops_after_commit(struct gfs2_sbd * sdp,struct gfs2_trans * tr)4516ca9412SBenjamin Marzinski static inline void lops_after_commit(struct gfs2_sbd *sdp,
4616ca9412SBenjamin Marzinski struct gfs2_trans *tr)
47b3b94faaSDavid Teigland {
48b3b94faaSDavid Teigland int x;
49b3b94faaSDavid Teigland for (x = 0; gfs2_log_ops[x]; x++)
50b3b94faaSDavid Teigland if (gfs2_log_ops[x]->lo_after_commit)
5116ca9412SBenjamin Marzinski gfs2_log_ops[x]->lo_after_commit(sdp, tr);
52b3b94faaSDavid Teigland }
53b3b94faaSDavid Teigland
lops_before_scan(struct gfs2_jdesc * jd,struct gfs2_log_header_host * head,unsigned int pass)54b3b94faaSDavid Teigland static inline void lops_before_scan(struct gfs2_jdesc *jd,
5555167622SAl Viro struct gfs2_log_header_host *head,
56b3b94faaSDavid Teigland unsigned int pass)
57b3b94faaSDavid Teigland {
58b3b94faaSDavid Teigland int x;
59b3b94faaSDavid Teigland for (x = 0; gfs2_log_ops[x]; x++)
60b3b94faaSDavid Teigland if (gfs2_log_ops[x]->lo_before_scan)
61b3b94faaSDavid Teigland gfs2_log_ops[x]->lo_before_scan(jd, head, pass);
62b3b94faaSDavid Teigland }
63b3b94faaSDavid Teigland
lops_scan_elements(struct gfs2_jdesc * jd,u32 start,struct gfs2_log_descriptor * ld,__be64 * ptr,unsigned int pass)647c70b896SBob Peterson static inline int lops_scan_elements(struct gfs2_jdesc *jd, u32 start,
65b3b94faaSDavid Teigland struct gfs2_log_descriptor *ld,
66b3b94faaSDavid Teigland __be64 *ptr,
67b3b94faaSDavid Teigland unsigned int pass)
68b3b94faaSDavid Teigland {
69b3b94faaSDavid Teigland int x, error;
70b3b94faaSDavid Teigland for (x = 0; gfs2_log_ops[x]; x++)
71b3b94faaSDavid Teigland if (gfs2_log_ops[x]->lo_scan_elements) {
72b3b94faaSDavid Teigland error = gfs2_log_ops[x]->lo_scan_elements(jd, start,
73b3b94faaSDavid Teigland ld, ptr, pass);
74b3b94faaSDavid Teigland if (error)
75b3b94faaSDavid Teigland return error;
76b3b94faaSDavid Teigland }
77b3b94faaSDavid Teigland
78b3b94faaSDavid Teigland return 0;
79b3b94faaSDavid Teigland }
80b3b94faaSDavid Teigland
lops_after_scan(struct gfs2_jdesc * jd,int error,unsigned int pass)81b3b94faaSDavid Teigland static inline void lops_after_scan(struct gfs2_jdesc *jd, int error,
82b3b94faaSDavid Teigland unsigned int pass)
83b3b94faaSDavid Teigland {
84b3b94faaSDavid Teigland int x;
85b3b94faaSDavid Teigland for (x = 0; gfs2_log_ops[x]; x++)
86b3b94faaSDavid Teigland if (gfs2_log_ops[x]->lo_before_scan)
87b3b94faaSDavid Teigland gfs2_log_ops[x]->lo_after_scan(jd, error, pass);
88b3b94faaSDavid Teigland }
89b3b94faaSDavid Teigland
90b3b94faaSDavid Teigland #endif /* __LOPS_DOT_H__ */
91b3b94faaSDavid Teigland
92