Thomas Gleixner | 7336d0e | 2019-05-31 01:09:56 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
Bob Peterson | d0109bf | 2008-01-28 11:20:10 -0600 | [diff] [blame] | 4 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __LOPS_DOT_H__ |
| 8 | #define __LOPS_DOT_H__ |
| 9 | |
Steven Whitehouse | f2f7ba5 | 2006-09-05 10:39:21 -0400 | [diff] [blame] | 10 | #include <linux/list.h> |
| 11 | #include "incore.h" |
| 12 | |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 13 | extern const struct gfs2_log_operations *gfs2_log_ops[]; |
Andreas Gruenbacher | 19ebc05 | 2019-08-28 22:21:34 +0200 | [diff] [blame] | 14 | extern void gfs2_log_incr_head(struct gfs2_sbd *sdp); |
| 15 | extern u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lbn); |
Bob Peterson | 8221894 | 2021-01-21 10:10:26 -0500 | [diff] [blame] | 16 | extern void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, |
| 17 | struct page *page, unsigned size, unsigned offset, |
| 18 | u64 blkno); |
Abhi Das | f4686c2 | 2019-05-02 14:17:40 -0500 | [diff] [blame] | 19 | extern void gfs2_log_submit_bio(struct bio **biop, int opf); |
Steven Whitehouse | 767f433 | 2012-12-14 12:52:14 +0000 | [diff] [blame] | 20 | extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); |
Abhi Das | f4686c2 | 2019-05-02 14:17:40 -0500 | [diff] [blame] | 21 | extern int gfs2_find_jhead(struct gfs2_jdesc *jd, |
| 22 | struct gfs2_log_header_host *head, bool keep_cache); |
Bob Peterson | f5456b5 | 2021-05-19 14:54:02 -0400 | [diff] [blame] | 23 | extern void gfs2_drain_revokes(struct gfs2_sbd *sdp); |
Robert Peterson | 2332c44 | 2007-06-18 14:50:20 -0500 | [diff] [blame] | 24 | static inline unsigned int buf_limit(struct gfs2_sbd *sdp) |
| 25 | { |
Andreas Gruenbacher | 458094c | 2020-12-05 13:21:50 +0100 | [diff] [blame] | 26 | return sdp->sd_ldptrs; |
Robert Peterson | 2332c44 | 2007-06-18 14:50:20 -0500 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | static inline unsigned int databuf_limit(struct gfs2_sbd *sdp) |
| 30 | { |
Andreas Gruenbacher | 458094c | 2020-12-05 13:21:50 +0100 | [diff] [blame] | 31 | return sdp->sd_ldptrs / 2; |
Robert Peterson | 2332c44 | 2007-06-18 14:50:20 -0500 | [diff] [blame] | 32 | } |
| 33 | |
Steven Whitehouse | d69a3c6 | 2014-02-21 15:22:35 +0000 | [diff] [blame] | 34 | static inline void lops_before_commit(struct gfs2_sbd *sdp, |
| 35 | struct gfs2_trans *tr) |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 36 | { |
| 37 | int x; |
| 38 | for (x = 0; gfs2_log_ops[x]; x++) |
| 39 | if (gfs2_log_ops[x]->lo_before_commit) |
Steven Whitehouse | d69a3c6 | 2014-02-21 15:22:35 +0000 | [diff] [blame] | 40 | gfs2_log_ops[x]->lo_before_commit(sdp, tr); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Benjamin Marzinski | 16ca941 | 2013-04-05 20:31:46 -0500 | [diff] [blame] | 43 | static inline void lops_after_commit(struct gfs2_sbd *sdp, |
| 44 | struct gfs2_trans *tr) |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 45 | { |
| 46 | int x; |
| 47 | for (x = 0; gfs2_log_ops[x]; x++) |
| 48 | if (gfs2_log_ops[x]->lo_after_commit) |
Benjamin Marzinski | 16ca941 | 2013-04-05 20:31:46 -0500 | [diff] [blame] | 49 | gfs2_log_ops[x]->lo_after_commit(sdp, tr); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | static inline void lops_before_scan(struct gfs2_jdesc *jd, |
Al Viro | 5516762 | 2006-10-13 21:47:13 -0400 | [diff] [blame] | 53 | struct gfs2_log_header_host *head, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 54 | unsigned int pass) |
| 55 | { |
| 56 | int x; |
| 57 | for (x = 0; gfs2_log_ops[x]; x++) |
| 58 | if (gfs2_log_ops[x]->lo_before_scan) |
| 59 | gfs2_log_ops[x]->lo_before_scan(jd, head, pass); |
| 60 | } |
| 61 | |
Bob Peterson | 7c70b89 | 2019-03-25 09:34:19 -0600 | [diff] [blame] | 62 | static inline int lops_scan_elements(struct gfs2_jdesc *jd, u32 start, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 63 | struct gfs2_log_descriptor *ld, |
| 64 | __be64 *ptr, |
| 65 | unsigned int pass) |
| 66 | { |
| 67 | int x, error; |
| 68 | for (x = 0; gfs2_log_ops[x]; x++) |
| 69 | if (gfs2_log_ops[x]->lo_scan_elements) { |
| 70 | error = gfs2_log_ops[x]->lo_scan_elements(jd, start, |
| 71 | ld, ptr, pass); |
| 72 | if (error) |
| 73 | return error; |
| 74 | } |
| 75 | |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | static inline void lops_after_scan(struct gfs2_jdesc *jd, int error, |
| 80 | unsigned int pass) |
| 81 | { |
| 82 | int x; |
| 83 | for (x = 0; gfs2_log_ops[x]; x++) |
| 84 | if (gfs2_log_ops[x]->lo_before_scan) |
| 85 | gfs2_log_ops[x]->lo_after_scan(jd, error, pass); |
| 86 | } |
| 87 | |
| 88 | #endif /* __LOPS_DOT_H__ */ |
| 89 | |