rgrp.h (4c7b3f7fb7c8c66d669d107e717f9de41ef81e92) rgrp.h (0b2355fe91ac3756a9e29c8b833ba33f9affb520)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
5 */
6
7#ifndef __RGRP_DOT_H__
8#define __RGRP_DOT_H__

--- 8 unchanged lines hidden (view full) ---

17 */
18#define RGRP_RSRV_MINBLKS 32
19#define RGRP_RSRV_ADDBLKS 64
20
21struct gfs2_rgrpd;
22struct gfs2_sbd;
23struct gfs2_holder;
24
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
5 */
6
7#ifndef __RGRP_DOT_H__
8#define __RGRP_DOT_H__

--- 8 unchanged lines hidden (view full) ---

17 */
18#define RGRP_RSRV_MINBLKS 32
19#define RGRP_RSRV_ADDBLKS 64
20
21struct gfs2_rgrpd;
22struct gfs2_sbd;
23struct gfs2_holder;
24
25extern void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd);
25void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd);
26
26
27extern struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact);
28extern struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp);
29extern struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd);
27struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact);
28struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp);
29struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd);
30
30
31extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp);
32extern int gfs2_rindex_update(struct gfs2_sbd *sdp);
33extern void gfs2_free_clones(struct gfs2_rgrpd *rgd);
34extern int gfs2_rgrp_go_instantiate(struct gfs2_glock *gl);
35extern void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd);
31void gfs2_clear_rgrpd(struct gfs2_sbd *sdp);
32int gfs2_rindex_update(struct gfs2_sbd *sdp);
33void gfs2_free_clones(struct gfs2_rgrpd *rgd);
34int gfs2_rgrp_go_instantiate(struct gfs2_glock *gl);
35void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd);
36
36
37extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip);
37struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip);
38
39#define GFS2_AF_ORLOV 1
38
39#define GFS2_AF_ORLOV 1
40extern int gfs2_inplace_reserve(struct gfs2_inode *ip,
41 struct gfs2_alloc_parms *ap);
42extern void gfs2_inplace_release(struct gfs2_inode *ip);
40int gfs2_inplace_reserve(struct gfs2_inode *ip,
41 struct gfs2_alloc_parms *ap);
42void gfs2_inplace_release(struct gfs2_inode *ip);
43
43
44extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
45 bool dinode);
44int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
45 bool dinode);
46
46
47extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
48extern void gfs2_rs_delete(struct gfs2_inode *ip);
49extern void __gfs2_free_blocks(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
50 u64 bstart, u32 blen, int meta);
51extern void gfs2_free_meta(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
52 u64 bstart, u32 blen);
53extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip);
54extern void gfs2_unlink_di(struct inode *inode);
55extern int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr,
56 unsigned int type);
47void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
48void gfs2_rs_delete(struct gfs2_inode *ip);
49void __gfs2_free_blocks(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
50 u64 bstart, u32 blen, int meta);
51void gfs2_free_meta(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
52 u64 bstart, u32 blen);
53void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip);
54void gfs2_unlink_di(struct inode *inode);
55int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr,
56 unsigned int type);
57
58struct gfs2_rgrp_list {
59 unsigned int rl_rgrps;
60 unsigned int rl_space;
61 struct gfs2_rgrpd **rl_rgd;
62 struct gfs2_holder *rl_ghs;
63};
64
57
58struct gfs2_rgrp_list {
59 unsigned int rl_rgrps;
60 unsigned int rl_space;
61 struct gfs2_rgrpd **rl_rgd;
62 struct gfs2_holder *rl_ghs;
63};
64
65extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
66 u64 block);
67extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
68 unsigned int state, u16 flags);
69extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
70extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
71extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,
72 const char *fs_id_buf);
73extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
74 struct buffer_head *bh,
75 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed);
76extern int gfs2_fitrim(struct file *filp, void __user *argp);
65void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
66 u64 block);
67void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
68 unsigned int state, u16 flags);
69void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
70u64 gfs2_ri_total(struct gfs2_sbd *sdp);
71void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,
72 const char *fs_id_buf);
73int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
74 struct buffer_head *bh,
75 const struct gfs2_bitmap *bi, unsigned minlen,
76 u64 *ptrimmed);
77int gfs2_fitrim(struct file *filp, void __user *argp);
77
78/* This is how to tell if a reservation is in the rgrp tree: */
79static inline bool gfs2_rs_active(const struct gfs2_blkreserv *rs)
80{
81 return !RB_EMPTY_NODE(&rs->rs_node);
82}
83
84static inline int rgrp_contains_block(struct gfs2_rgrpd *rgd, u64 block)
85{
86 u64 first = rgd->rd_data0;
87 u64 last = first + rgd->rd_data;
88 return first <= block && block < last;
89}
90
78
79/* This is how to tell if a reservation is in the rgrp tree: */
80static inline bool gfs2_rs_active(const struct gfs2_blkreserv *rs)
81{
82 return !RB_EMPTY_NODE(&rs->rs_node);
83}
84
85static inline int rgrp_contains_block(struct gfs2_rgrpd *rgd, u64 block)
86{
87 u64 first = rgd->rd_data0;
88 u64 last = first + rgd->rd_data;
89 return first <= block && block < last;
90}
91
91extern void check_and_update_goal(struct gfs2_inode *ip);
92void check_and_update_goal(struct gfs2_inode *ip);
92
93
93extern void rgrp_lock_local(struct gfs2_rgrpd *rgd);
94extern void rgrp_unlock_local(struct gfs2_rgrpd *rgd);
94void rgrp_lock_local(struct gfs2_rgrpd *rgd);
95void rgrp_unlock_local(struct gfs2_rgrpd *rgd);
95
96#endif /* __RGRP_DOT_H__ */
96
97#endif /* __RGRP_DOT_H__ */