Thomas Gleixner | 7336d0e | 2019-05-31 01:09:56 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
Steven Whitehouse | 3a8a9a1 | 2006-05-18 15:09:15 -0400 | [diff] [blame] | 4 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __TRANS_DOT_H__ |
| 8 | #define __TRANS_DOT_H__ |
| 9 | |
Steven Whitehouse | f2f7ba5 | 2006-09-05 10:39:21 -0400 | [diff] [blame] | 10 | #include <linux/buffer_head.h> |
| 11 | struct gfs2_sbd; |
| 12 | struct gfs2_rgrpd; |
| 13 | struct gfs2_glock; |
| 14 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 15 | #define RES_DINODE 1 |
| 16 | #define RES_INDIRECT 1 |
| 17 | #define RES_JDATA 1 |
| 18 | #define RES_DATA 1 |
| 19 | #define RES_LEAF 1 |
Benjamin Marzinski | 3921120 | 2010-08-20 00:21:02 -0500 | [diff] [blame] | 20 | #define RES_RG_HDR 1 |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 21 | #define RES_RG_BIT 2 |
| 22 | #define RES_EATTR 1 |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 23 | #define RES_STATFS 1 |
| 24 | #define RES_QUOTA 2 |
| 25 | |
Benjamin Marzinski | bf97b67 | 2010-09-27 16:00:04 -0500 | [diff] [blame] | 26 | /* reserve either the number of blocks to be allocated plus the rg header |
| 27 | * block, or all of the blocks in the rg, whichever is smaller */ |
Steven Whitehouse | 71f890f | 2012-07-30 14:53:19 +0100 | [diff] [blame] | 28 | static inline unsigned int gfs2_rg_blocks(const struct gfs2_inode *ip, unsigned requested) |
Benjamin Marzinski | bf97b67 | 2010-09-27 16:00:04 -0500 | [diff] [blame] | 29 | { |
Andreas Gruenbacher | b7eba89 | 2018-06-21 07:42:37 -0500 | [diff] [blame] | 30 | struct gfs2_rgrpd *rgd = ip->i_res.rs_rbm.rgd; |
| 31 | |
| 32 | if (requested < rgd->rd_length) |
Steven Whitehouse | 71f890f | 2012-07-30 14:53:19 +0100 | [diff] [blame] | 33 | return requested + 1; |
Andreas Gruenbacher | b7eba89 | 2018-06-21 07:42:37 -0500 | [diff] [blame] | 34 | return rgd->rd_length; |
Benjamin Marzinski | bf97b67 | 2010-09-27 16:00:04 -0500 | [diff] [blame] | 35 | } |
| 36 | |
Bob Peterson | 7c9ca62 | 2011-08-31 09:53:19 +0100 | [diff] [blame] | 37 | extern int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, |
| 38 | unsigned int revokes); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 39 | |
Bob Peterson | 7c9ca62 | 2011-08-31 09:53:19 +0100 | [diff] [blame] | 40 | extern void gfs2_trans_end(struct gfs2_sbd *sdp); |
Steven Whitehouse | 350a9b0 | 2012-12-14 12:36:02 +0000 | [diff] [blame] | 41 | extern void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh); |
| 42 | extern void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh); |
Bob Peterson | 7c9ca62 | 2011-08-31 09:53:19 +0100 | [diff] [blame] | 43 | extern void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); |
Andreas Gruenbacher | fbb2787 | 2019-04-05 12:18:23 +0100 | [diff] [blame] | 44 | extern void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 45 | |
| 46 | #endif /* __TRANS_DOT_H__ */ |