aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log_priv.h')
-rw-r--r--fs/xfs/xfs_log_priv.h141
1 files changed, 70 insertions, 71 deletions
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index a884cea82fca..bec421a735f3 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -35,6 +35,7 @@
35struct xfs_buf; 35struct xfs_buf;
36struct ktrace; 36struct ktrace;
37struct log; 37struct log;
38struct xlog_ticket;
38struct xfs_buf_cancel; 39struct xfs_buf_cancel;
39struct xfs_mount; 40struct xfs_mount;
40 41
@@ -120,77 +121,6 @@ struct xfs_mount;
120 ((i) >> 24) 121 ((i) >> 24)
121#endif 122#endif
122 123
123#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_SUB_SPACE)
124void xlog_grant_sub_space(struct log *log, int bytes, int type);
125#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
126 xlog_grant_sub_space(log,bytes,type)
127#else
128#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
129 { \
130 if (type == 'w') { \
131 (log)->l_grant_write_bytes -= (bytes); \
132 if ((log)->l_grant_write_bytes < 0) { \
133 (log)->l_grant_write_bytes += (log)->l_logsize; \
134 (log)->l_grant_write_cycle--; \
135 } \
136 } else { \
137 (log)->l_grant_reserve_bytes -= (bytes); \
138 if ((log)->l_grant_reserve_bytes < 0) { \
139 (log)->l_grant_reserve_bytes += (log)->l_logsize;\
140 (log)->l_grant_reserve_cycle--; \
141 } \
142 } \
143 }
144#endif
145#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_ADD_SPACE)
146void xlog_grant_add_space(struct log *log, int bytes, int type);
147#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
148 xlog_grant_add_space(log,bytes,type)
149#else
150#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
151 { \
152 if (type == 'w') { \
153 (log)->l_grant_write_bytes += (bytes); \
154 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
155 (log)->l_grant_write_bytes -= (log)->l_logsize; \
156 (log)->l_grant_write_cycle++; \
157 } \
158 } else { \
159 (log)->l_grant_reserve_bytes += (bytes); \
160 if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
161 (log)->l_grant_reserve_bytes -= (log)->l_logsize;\
162 (log)->l_grant_reserve_cycle++; \
163 } \
164 } \
165 }
166#endif
167#define XLOG_INS_TICKETQ(q,tic) \
168 { \
169 if (q) { \
170 (tic)->t_next = (q); \
171 (tic)->t_prev = (q)->t_prev; \
172 (q)->t_prev->t_next = (tic); \
173 (q)->t_prev = (tic); \
174 } else { \
175 (tic)->t_prev = (tic)->t_next = (tic); \
176 (q) = (tic); \
177 } \
178 (tic)->t_flags |= XLOG_TIC_IN_Q; \
179 }
180#define XLOG_DEL_TICKETQ(q,tic) \
181 { \
182 if ((tic) == (tic)->t_next) { \
183 (q) = NULL; \
184 } else { \
185 (q) = (tic)->t_next; \
186 (tic)->t_next->t_prev = (tic)->t_prev; \
187 (tic)->t_prev->t_next = (tic)->t_next; \
188 } \
189 (tic)->t_next = (tic)->t_prev = NULL; \
190 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \
191 }
192
193
194#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock) 124#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock)
195#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s) 125#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s)
196#define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock) 126#define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock)
@@ -576,6 +506,75 @@ typedef struct log {
576 * alignment mask */ 506 * alignment mask */
577} xlog_t; 507} xlog_t;
578 508
509#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
510 xlog_grant_sub_space(log,bytes,type)
511static inline void xlog_grant_sub_space(struct log *log, int bytes, int type)
512{
513 if (type == 'w') { \
514 (log)->l_grant_write_bytes -= (bytes); \
515 if ((log)->l_grant_write_bytes < 0) { \
516 (log)->l_grant_write_bytes += (log)->l_logsize; \
517 (log)->l_grant_write_cycle--; \
518 } \
519 } else { \
520 (log)->l_grant_reserve_bytes -= (bytes); \
521 if ((log)->l_grant_reserve_bytes < 0) { \
522 (log)->l_grant_reserve_bytes += (log)->l_logsize;\
523 (log)->l_grant_reserve_cycle--; \
524 } \
525 } \
526}
527
528#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
529 xlog_grant_add_space(log,bytes,type)
530static inline void
531xlog_grant_add_space(struct log *log, int bytes, int type)
532{
533 if (type == 'w') { \
534 (log)->l_grant_write_bytes += (bytes); \
535 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
536 (log)->l_grant_write_bytes -= (log)->l_logsize; \
537 (log)->l_grant_write_cycle++; \
538 } \
539 } else { \
540 (log)->l_grant_reserve_bytes += (bytes); \
541 if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
542 (log)->l_grant_reserve_bytes -= (log)->l_logsize;\
543 (log)->l_grant_reserve_cycle++; \
544 } \
545 } \
546}
547
548#define XLOG_INS_TICKETQ(q, tic) xlog_ins_ticketq(q, tic)
549static inline void
550xlog_ins_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
551{ \
552 if (q) { \
553 (tic)->t_next = (q); \
554 (tic)->t_prev = (q)->t_prev; \
555 (q)->t_prev->t_next = (tic); \
556 (q)->t_prev = (tic); \
557 } else { \
558 (tic)->t_prev = (tic)->t_next = (tic); \
559 (q) = (tic); \
560 } \
561 (tic)->t_flags |= XLOG_TIC_IN_Q; \
562}
563
564#define XLOG_DEL_TICKETQ(q, tic) xlog_del_ticketq(q, tic)
565static inline void
566xlog_del_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
567{ \
568 if ((tic) == (tic)->t_next) { \
569 (q) = NULL; \
570 } else { \
571 (q) = (tic)->t_next; \
572 (tic)->t_next->t_prev = (tic)->t_prev; \
573 (tic)->t_prev->t_next = (tic)->t_next; \
574 } \
575 (tic)->t_next = (tic)->t_prev = NULL; \
576 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \
577}
579 578
580/* common routines */ 579/* common routines */
581extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); 580extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);