1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 5 */ 6 7 #ifndef __LOG_DOT_H__ 8 #define __LOG_DOT_H__ 9 10 #include <linux/list.h> 11 #include <linux/spinlock.h> 12 #include <linux/writeback.h> 13 #include "incore.h" 14 #include "inode.h" 15 16 /* 17 * The minimum amount of log space required for a log flush is one block for 18 * revokes and one block for the log header. Log flushes other than 19 * GFS2_LOG_HEAD_FLUSH_NORMAL may write one or two more log headers. 20 */ 21 #define GFS2_LOG_FLUSH_MIN_BLOCKS 4 22 23 static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip) 24 { 25 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 26 27 if (gfs2_is_jdata(ip) || !gfs2_is_ordered(sdp)) 28 return; 29 30 if (list_empty(&ip->i_ordered)) { 31 spin_lock(&sdp->sd_ordered_lock); 32 if (list_empty(&ip->i_ordered)) 33 list_add(&ip->i_ordered, &sdp->sd_log_ordered); 34 spin_unlock(&sdp->sd_ordered_lock); 35 } 36 } 37 38 void gfs2_ordered_del_inode(struct gfs2_inode *ip); 39 unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct); 40 bool gfs2_log_is_empty(struct gfs2_sbd *sdp); 41 void gfs2_log_release_revokes(struct gfs2_sbd *sdp, unsigned int revokes); 42 void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); 43 bool gfs2_log_try_reserve(struct gfs2_sbd *sdp, struct gfs2_trans *tr, 44 unsigned int *extra_revokes); 45 void gfs2_log_reserve(struct gfs2_sbd *sdp, struct gfs2_trans *tr, 46 unsigned int *extra_revokes); 47 void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, 48 u64 seq, u32 tail, u32 lblock, u32 flags, 49 blk_opf_t op_flags); 50 void gfs2_remove_from_journal(struct buffer_head *bh, int meta); 51 void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, 52 u32 type); 53 void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); 54 void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc); 55 void log_flush_wait(struct gfs2_sbd *sdp); 56 57 int gfs2_logd(void *data); 58 void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); 59 void gfs2_glock_remove_revoke(struct gfs2_glock *gl); 60 void gfs2_flush_revokes(struct gfs2_sbd *sdp); 61 void gfs2_ail_drain(struct gfs2_sbd *sdp); 62 63 #endif /* __LOG_DOT_H__ */ 64