blob: 2ff163a8dce1f0ae90bce33977ec381b6f1d9b44 [file] [log] [blame]
Thomas Gleixner7336d0e2019-05-31 01:09:56 -07001/* SPDX-License-Identifier: GPL-2.0-only */
David Teiglandb3b94fa2006-01-16 16:50:04 +00002/*
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
Steven Whitehouse3a8a9a12006-05-18 15:09:15 -04004 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
David Teiglandb3b94fa2006-01-16 16:50:04 +00005 */
6
7#ifndef __LOG_DOT_H__
8#define __LOG_DOT_H__
9
Steven Whitehousef2f7ba52006-09-05 10:39:21 -040010#include <linux/list.h>
11#include <linux/spinlock.h>
Steven Whitehouse4667a0e2011-04-18 14:18:09 +010012#include <linux/writeback.h>
Steven Whitehousef2f7ba52006-09-05 10:39:21 -040013#include "incore.h"
Andreas Gruenbacher845802b2018-06-04 07:50:16 -050014#include "inode.h"
Steven Whitehousef2f7ba52006-09-05 10:39:21 -040015
David Teiglandb3b94fa2006-01-16 16:50:04 +000016/**
17 * gfs2_log_lock - acquire the right to mess with the log manager
18 * @sdp: the filesystem
19 *
20 */
21
22static inline void gfs2_log_lock(struct gfs2_sbd *sdp)
Harvey Harrison2d81afb2008-05-29 18:27:51 -070023__acquires(&sdp->sd_log_lock)
David Teiglandb3b94fa2006-01-16 16:50:04 +000024{
25 spin_lock(&sdp->sd_log_lock);
26}
27
28/**
29 * gfs2_log_unlock - release the right to mess with the log manager
30 * @sdp: the filesystem
31 *
32 */
33
34static inline void gfs2_log_unlock(struct gfs2_sbd *sdp)
Harvey Harrison2d81afb2008-05-29 18:27:51 -070035__releases(&sdp->sd_log_lock)
David Teiglandb3b94fa2006-01-16 16:50:04 +000036{
37 spin_unlock(&sdp->sd_log_lock);
38}
39
40static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
41 unsigned int value)
42{
43 if (++value == sdp->sd_jdesc->jd_blocks) {
44 value = 0;
David Teiglandb3b94fa2006-01-16 16:50:04 +000045 }
46 sdp->sd_log_head = sdp->sd_log_tail = value;
47}
48
Steven Whitehouse45138992013-01-28 09:30:07 +000049static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip)
50{
Andreas Gruenbacher977767a2018-10-12 20:07:27 +020051 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
Steven Whitehouse45138992013-01-28 09:30:07 +000052
Andreas Gruenbacher977767a2018-10-12 20:07:27 +020053 if (gfs2_is_jdata(ip) || !gfs2_is_ordered(sdp))
Andreas Gruenbacher845802b2018-06-04 07:50:16 -050054 return;
55
Steven Whitehouse45138992013-01-28 09:30:07 +000056 if (!test_bit(GIF_ORDERED, &ip->i_flags)) {
57 spin_lock(&sdp->sd_ordered_lock);
58 if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags))
Andreas Gruenbachera5b1d3f2019-04-05 12:16:14 +010059 list_add(&ip->i_ordered, &sdp->sd_log_ordered);
Steven Whitehouse45138992013-01-28 09:30:07 +000060 spin_unlock(&sdp->sd_ordered_lock);
61 }
62}
63extern void gfs2_ordered_del_inode(struct gfs2_inode *ip);
Bob Petersoned4878e2010-05-20 23:30:11 -040064extern unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
David Teiglandb3b94fa2006-01-16 16:50:04 +000065 unsigned int ssize);
66
Benjamin Marzinski24972552014-05-01 22:26:55 -050067extern void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
Bob Petersoned4878e2010-05-20 23:30:11 -040068extern int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks);
Bob Petersonc1696fb2018-01-17 00:01:33 +010069extern void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
Bob Peterson7c70b892019-03-25 09:34:19 -060070 u64 seq, u32 tail, u32 lblock, u32 flags,
71 int op_flags);
Benjamin Marzinski24972552014-05-01 22:26:55 -050072extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
Bob Petersonc1696fb2018-01-17 00:01:33 +010073 u32 type);
Bob Petersoned4878e2010-05-20 23:30:11 -040074extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
Steven Whitehouse4667a0e2011-04-18 14:18:09 +010075extern void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc);
Steven Whitehouse2bcd6102007-11-08 14:25:12 +000076
Bob Petersoned4878e2010-05-20 23:30:11 -040077extern int gfs2_logd(void *data);
Benjamin Marzinski5d054962013-06-14 11:38:29 -050078extern void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
Bob Petersonfe5e7ba2019-11-14 09:49:11 -050079extern void gfs2_glock_remove_revoke(struct gfs2_glock *gl);
Benjamin Marzinski5d054962013-06-14 11:38:29 -050080extern void gfs2_write_revokes(struct gfs2_sbd *sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +000081
82#endif /* __LOG_DOT_H__ */