^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef __TRANS_DOT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define __TRANS_DOT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct gfs2_sbd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct gfs2_rgrpd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct gfs2_glock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define RES_DINODE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define RES_INDIRECT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define RES_JDATA 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define RES_DATA 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define RES_LEAF 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define RES_RG_HDR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define RES_RG_BIT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define RES_EATTR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define RES_STATFS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define RES_QUOTA 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* reserve either the number of blocks to be allocated plus the rg header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * block, or all of the blocks in the rg, whichever is smaller */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static inline unsigned int gfs2_rg_blocks(const struct gfs2_inode *ip, unsigned requested)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct gfs2_rgrpd *rgd = ip->i_res.rs_rbm.rgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) if (requested < rgd->rd_length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) return requested + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) return rgd->rd_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned int revokes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern void gfs2_trans_end(struct gfs2_sbd *sdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) extern void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern void gfs2_trans_free(struct gfs2_sbd *sdp, struct gfs2_trans *tr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #endif /* __TRANS_DOT_H__ */