.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
---|
3 | 4 | * 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. |
---|
8 | 5 | */ |
---|
9 | 6 | |
---|
10 | 7 | #ifndef __UTIL_DOT_H__ |
---|
.. | .. |
---|
39 | 36 | } while (0) |
---|
40 | 37 | |
---|
41 | 38 | |
---|
42 | | -int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, |
---|
43 | | - const char *function, char *file, unsigned int line); |
---|
| 39 | +void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, |
---|
| 40 | + const char *function, char *file, unsigned int line, |
---|
| 41 | + bool delayed); |
---|
44 | 42 | |
---|
45 | 43 | #define gfs2_assert_withdraw(sdp, assertion) \ |
---|
46 | | -((likely(assertion)) ? 0 : gfs2_assert_withdraw_i((sdp), #assertion, \ |
---|
47 | | - __func__, __FILE__, __LINE__)) |
---|
| 44 | + ({ \ |
---|
| 45 | + bool _bool = (assertion); \ |
---|
| 46 | + if (unlikely(!_bool)) \ |
---|
| 47 | + gfs2_assert_withdraw_i((sdp), #assertion, \ |
---|
| 48 | + __func__, __FILE__, __LINE__, false); \ |
---|
| 49 | + !_bool; \ |
---|
| 50 | + }) |
---|
48 | 51 | |
---|
| 52 | +#define gfs2_assert_withdraw_delayed(sdp, assertion) \ |
---|
| 53 | + ({ \ |
---|
| 54 | + bool _bool = (assertion); \ |
---|
| 55 | + if (unlikely(!_bool)) \ |
---|
| 56 | + gfs2_assert_withdraw_i((sdp), #assertion, \ |
---|
| 57 | + __func__, __FILE__, __LINE__, true); \ |
---|
| 58 | + !_bool; \ |
---|
| 59 | + }) |
---|
49 | 60 | |
---|
50 | | -int gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion, |
---|
51 | | - const char *function, char *file, unsigned int line); |
---|
| 61 | +void gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion, |
---|
| 62 | + const char *function, char *file, unsigned int line); |
---|
52 | 63 | |
---|
53 | 64 | #define gfs2_assert_warn(sdp, assertion) \ |
---|
54 | | -((likely(assertion)) ? 0 : gfs2_assert_warn_i((sdp), #assertion, \ |
---|
55 | | - __func__, __FILE__, __LINE__)) |
---|
| 65 | + ({ \ |
---|
| 66 | + bool _bool = (assertion); \ |
---|
| 67 | + if (unlikely(!_bool)) \ |
---|
| 68 | + gfs2_assert_warn_i((sdp), #assertion, \ |
---|
| 69 | + __func__, __FILE__, __LINE__); \ |
---|
| 70 | + !_bool; \ |
---|
| 71 | + }) |
---|
56 | 72 | |
---|
57 | | - |
---|
58 | | -int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, |
---|
59 | | - const char *function, char *file, unsigned int line); |
---|
| 73 | +void gfs2_consist_i(struct gfs2_sbd *sdp, |
---|
| 74 | + const char *function, char *file, unsigned int line); |
---|
60 | 75 | |
---|
61 | 76 | #define gfs2_consist(sdp) \ |
---|
62 | | -gfs2_consist_i((sdp), 0, __func__, __FILE__, __LINE__) |
---|
| 77 | +gfs2_consist_i((sdp), __func__, __FILE__, __LINE__) |
---|
63 | 78 | |
---|
64 | 79 | |
---|
65 | | -int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide, |
---|
66 | | - const char *function, char *file, unsigned int line); |
---|
| 80 | +void gfs2_consist_inode_i(struct gfs2_inode *ip, |
---|
| 81 | + const char *function, char *file, unsigned int line); |
---|
67 | 82 | |
---|
68 | 83 | #define gfs2_consist_inode(ip) \ |
---|
69 | | -gfs2_consist_inode_i((ip), 0, __func__, __FILE__, __LINE__) |
---|
| 84 | +gfs2_consist_inode_i((ip), __func__, __FILE__, __LINE__) |
---|
70 | 85 | |
---|
71 | 86 | |
---|
72 | | -int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide, |
---|
73 | | - const char *function, char *file, unsigned int line); |
---|
| 87 | +void gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, |
---|
| 88 | + const char *function, char *file, unsigned int line); |
---|
74 | 89 | |
---|
75 | 90 | #define gfs2_consist_rgrpd(rgd) \ |
---|
76 | | -gfs2_consist_rgrpd_i((rgd), 0, __func__, __FILE__, __LINE__) |
---|
| 91 | +gfs2_consist_rgrpd_i((rgd), __func__, __FILE__, __LINE__) |
---|
77 | 92 | |
---|
78 | 93 | |
---|
79 | 94 | int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, |
---|
.. | .. |
---|
86 | 101 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; |
---|
87 | 102 | u32 magic = be32_to_cpu(mh->mh_magic); |
---|
88 | 103 | if (unlikely(magic != GFS2_MAGIC)) { |
---|
89 | | - pr_err("Magic number missing at %llu\n", |
---|
| 104 | + fs_err(sdp, "Magic number missing at %llu\n", |
---|
90 | 105 | (unsigned long long)bh->b_blocknr); |
---|
91 | 106 | return -EIO; |
---|
92 | 107 | } |
---|
.. | .. |
---|
132 | 147 | int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, |
---|
133 | 148 | char *file, unsigned int line); |
---|
134 | 149 | |
---|
| 150 | +extern int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, |
---|
| 151 | + bool verbose); |
---|
| 152 | +extern int gfs2_freeze_lock(struct gfs2_sbd *sdp, |
---|
| 153 | + struct gfs2_holder *freeze_gh, int caller_flags); |
---|
| 154 | +extern void gfs2_freeze_unlock(struct gfs2_holder *freeze_gh); |
---|
| 155 | + |
---|
135 | 156 | #define gfs2_io_error(sdp) \ |
---|
136 | 157 | gfs2_io_error_i((sdp), __func__, __FILE__, __LINE__); |
---|
137 | 158 | |
---|
.. | .. |
---|
154 | 175 | extern struct kmem_cache *gfs2_rgrpd_cachep; |
---|
155 | 176 | extern struct kmem_cache *gfs2_quotad_cachep; |
---|
156 | 177 | extern struct kmem_cache *gfs2_qadata_cachep; |
---|
| 178 | +extern struct kmem_cache *gfs2_trans_cachep; |
---|
157 | 179 | extern mempool_t *gfs2_page_pool; |
---|
158 | 180 | extern struct workqueue_struct *gfs2_control_wq; |
---|
159 | 181 | |
---|
.. | .. |
---|
167 | 189 | return x; |
---|
168 | 190 | } |
---|
169 | 191 | |
---|
| 192 | +/** |
---|
| 193 | + * gfs2_withdraw_delayed - withdraw as soon as possible without deadlocks |
---|
| 194 | + * @sdp: the superblock |
---|
| 195 | + */ |
---|
| 196 | +static inline void gfs2_withdraw_delayed(struct gfs2_sbd *sdp) |
---|
| 197 | +{ |
---|
| 198 | + set_bit(SDF_WITHDRAWING, &sdp->sd_flags); |
---|
| 199 | +} |
---|
| 200 | + |
---|
| 201 | +/** |
---|
| 202 | + * gfs2_withdrawn - test whether the file system is withdrawing or withdrawn |
---|
| 203 | + * @sdp: the superblock |
---|
| 204 | + */ |
---|
| 205 | +static inline bool gfs2_withdrawn(struct gfs2_sbd *sdp) |
---|
| 206 | +{ |
---|
| 207 | + return test_bit(SDF_WITHDRAWN, &sdp->sd_flags) || |
---|
| 208 | + test_bit(SDF_WITHDRAWING, &sdp->sd_flags); |
---|
| 209 | +} |
---|
| 210 | + |
---|
| 211 | +/** |
---|
| 212 | + * gfs2_withdrawing - check if a withdraw is pending |
---|
| 213 | + * @sdp: the superblock |
---|
| 214 | + */ |
---|
| 215 | +static inline bool gfs2_withdrawing(struct gfs2_sbd *sdp) |
---|
| 216 | +{ |
---|
| 217 | + return test_bit(SDF_WITHDRAWING, &sdp->sd_flags) && |
---|
| 218 | + !test_bit(SDF_WITHDRAWN, &sdp->sd_flags); |
---|
| 219 | +} |
---|
| 220 | + |
---|
170 | 221 | #define gfs2_tune_get(sdp, field) \ |
---|
171 | 222 | gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field) |
---|
172 | 223 | |
---|
173 | 224 | __printf(2, 3) |
---|
174 | | -int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...); |
---|
| 225 | +void gfs2_lm(struct gfs2_sbd *sdp, const char *fmt, ...); |
---|
| 226 | +int gfs2_withdraw(struct gfs2_sbd *sdp); |
---|
175 | 227 | |
---|
176 | 228 | #endif /* __UTIL_DOT_H__ */ |
---|