1b3b94faaSDavid Teigland /* 2b3b94faaSDavid Teigland * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3b3b94faaSDavid Teigland * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4b3b94faaSDavid Teigland * 5b3b94faaSDavid Teigland * This copyrighted material is made available to anyone wishing to use, 6b3b94faaSDavid Teigland * modify, copy, or redistribute it subject to the terms and conditions 7b3b94faaSDavid Teigland * of the GNU General Public License v.2. 8b3b94faaSDavid Teigland */ 9b3b94faaSDavid Teigland 10b3b94faaSDavid Teigland #ifndef __LOG_DOT_H__ 11b3b94faaSDavid Teigland #define __LOG_DOT_H__ 12b3b94faaSDavid Teigland 13b3b94faaSDavid Teigland /** 14b3b94faaSDavid Teigland * gfs2_log_lock - acquire the right to mess with the log manager 15b3b94faaSDavid Teigland * @sdp: the filesystem 16b3b94faaSDavid Teigland * 17b3b94faaSDavid Teigland */ 18b3b94faaSDavid Teigland 19b3b94faaSDavid Teigland static inline void gfs2_log_lock(struct gfs2_sbd *sdp) 20b3b94faaSDavid Teigland { 21b3b94faaSDavid Teigland spin_lock(&sdp->sd_log_lock); 22b3b94faaSDavid Teigland } 23b3b94faaSDavid Teigland 24b3b94faaSDavid Teigland /** 25b3b94faaSDavid Teigland * gfs2_log_unlock - release the right to mess with the log manager 26b3b94faaSDavid Teigland * @sdp: the filesystem 27b3b94faaSDavid Teigland * 28b3b94faaSDavid Teigland */ 29b3b94faaSDavid Teigland 30b3b94faaSDavid Teigland static inline void gfs2_log_unlock(struct gfs2_sbd *sdp) 31b3b94faaSDavid Teigland { 32b3b94faaSDavid Teigland spin_unlock(&sdp->sd_log_lock); 33b3b94faaSDavid Teigland } 34b3b94faaSDavid Teigland 35b3b94faaSDavid Teigland static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp, 36b3b94faaSDavid Teigland unsigned int value) 37b3b94faaSDavid Teigland { 38b3b94faaSDavid Teigland if (++value == sdp->sd_jdesc->jd_blocks) { 39b3b94faaSDavid Teigland value = 0; 40b3b94faaSDavid Teigland } 41b3b94faaSDavid Teigland sdp->sd_log_head = sdp->sd_log_tail = value; 42b3b94faaSDavid Teigland } 43b3b94faaSDavid Teigland 44b3b94faaSDavid Teigland unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, 45b3b94faaSDavid Teigland unsigned int ssize); 46b3b94faaSDavid Teigland 47b3b94faaSDavid Teigland void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags); 48b3b94faaSDavid Teigland int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags); 49b3b94faaSDavid Teigland 50b3b94faaSDavid Teigland int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); 51b3b94faaSDavid Teigland void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); 52b3b94faaSDavid Teigland 53b3b94faaSDavid Teigland struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp); 54b3b94faaSDavid Teigland struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp, 55b3b94faaSDavid Teigland struct buffer_head *real); 56b09e593dSSteven Whitehouse void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); 57b3b94faaSDavid Teigland void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); 58b3b94faaSDavid Teigland 59b3b94faaSDavid Teigland void gfs2_log_shutdown(struct gfs2_sbd *sdp); 60b3b94faaSDavid Teigland 61b3b94faaSDavid Teigland #endif /* __LOG_DOT_H__ */ 62