Blame view

fs/gfs2/rgrp.h 3.51 KB
b3b94faa5   David Teigland   [GFS2] The core o...
1
2
  /*
   * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
fe6c991c5   Bob Peterson   [GFS2] Get rid of...
3
   * Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
b3b94faa5   David Teigland   [GFS2] The core o...
4
5
6
   *
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
e9fc2aa09   Steven Whitehouse   [GFS2] Update cop...
7
   * of the GNU General Public License version 2.
b3b94faa5   David Teigland   [GFS2] The core o...
8
9
10
11
   */
  
  #ifndef __RGRP_DOT_H__
  #define __RGRP_DOT_H__
5a0e3ad6a   Tejun Heo   include cleanup: ...
12
  #include <linux/slab.h>
66fc061bd   Steven Whitehouse   GFS2: FITRIM ioct...
13
  #include <linux/uaccess.h>
5a0e3ad6a   Tejun Heo   include cleanup: ...
14

8e2e00473   Bob Peterson   GFS2: Reduce file...
15
16
17
18
19
20
21
  /* Since each block in the file system is represented by two bits in the
   * bitmap, one 64-bit word in the bitmap will represent 32 blocks.
   * By reserving 32 blocks at a time, we can optimize / shortcut how we search
   * through the bitmaps by looking a word at a time.
   */
  #define RGRP_RSRV_MINBYTES 8
  #define RGRP_RSRV_MINBLKS ((u32)(RGRP_RSRV_MINBYTES * GFS2_NBBY))
1a8550332   Bob Peterson   GFS2: If we use u...
22
  #define RGRP_RSRV_ADDBLKS 64
8e2e00473   Bob Peterson   GFS2: Reduce file...
23

f2f7ba523   Steven Whitehouse   [GFS2] Make heade...
24
25
26
  struct gfs2_rgrpd;
  struct gfs2_sbd;
  struct gfs2_holder;
090109783   Steven Whitehouse   GFS2: Improve res...
27
  extern void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd);
b3b94faa5   David Teigland   [GFS2] The core o...
28

66fc061bd   Steven Whitehouse   GFS2: FITRIM ioct...
29
  extern struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact);
8339ee543   Steven Whitehouse   GFS2: Make resour...
30
31
  extern struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp);
  extern struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd);
b3b94faa5   David Teigland   [GFS2] The core o...
32

090109783   Steven Whitehouse   GFS2: Improve res...
33
  extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp);
8339ee543   Steven Whitehouse   GFS2: Make resour...
34
35
  extern int gfs2_rindex_update(struct gfs2_sbd *sdp);
  extern void gfs2_free_clones(struct gfs2_rgrpd *rgd);
7c9ca6211   Bob Peterson   GFS2: Use rbtree ...
36
  extern int gfs2_rgrp_go_lock(struct gfs2_holder *gh);
39b0f1e92   Bob Peterson   GFS2: Don't brels...
37
  extern void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd);
7c9ca6211   Bob Peterson   GFS2: Use rbtree ...
38
  extern void gfs2_rgrp_go_unlock(struct gfs2_holder *gh);
b3b94faa5   David Teigland   [GFS2] The core o...
39

8e2e00473   Bob Peterson   GFS2: Reduce file...
40
  extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip);
9dbe9610b   Steven Whitehouse   GFS2: Add Orlov a...
41
  #define GFS2_AF_ORLOV 1
25435e5ed   Abhi Das   gfs2: allow quota...
42
43
  extern int gfs2_inplace_reserve(struct gfs2_inode *ip,
  				struct gfs2_alloc_parms *ap);
090109783   Steven Whitehouse   GFS2: Improve res...
44
  extern void gfs2_inplace_release(struct gfs2_inode *ip);
b3b94faa5   David Teigland   [GFS2] The core o...
45

6e87ed0fc   Bob Peterson   GFS2: move toward...
46
47
  extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
  			     bool dinode, u64 *generation);
b3b94faa5   David Teigland   [GFS2] The core o...
48

b54e9a0b9   Bob Peterson   GFS2: Extract quo...
49
  extern int gfs2_rsqa_alloc(struct gfs2_inode *ip);
20095218f   Bob Peterson   GFS2: Remove vest...
50
  extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
b54e9a0b9   Bob Peterson   GFS2: Extract quo...
51
  extern void gfs2_rsqa_delete(struct gfs2_inode *ip, atomic_t *wcount);
46fcb2ed2   Eric Sandeen   GFS2: combine dup...
52
  extern void __gfs2_free_blocks(struct gfs2_inode *ip, u64 bstart, u32 blen, int meta);
090109783   Steven Whitehouse   GFS2: Improve res...
53
54
55
  extern void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen);
  extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip);
  extern void gfs2_unlink_di(struct inode *inode);
acf7e2444   Steven Whitehouse   GFS2: Be extra ca...
56
57
  extern int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr,
  			       unsigned int type);
b3b94faa5   David Teigland   [GFS2] The core o...
58
59
60
61
62
63
64
  
  struct gfs2_rgrp_list {
  	unsigned int rl_rgrps;
  	unsigned int rl_space;
  	struct gfs2_rgrpd **rl_rgd;
  	struct gfs2_holder *rl_ghs;
  };
70b0c3656   Steven Whitehouse   GFS2: Use cached ...
65
  extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
090109783   Steven Whitehouse   GFS2: Improve res...
66
67
68
69
  			   u64 block);
  extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state);
  extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
  extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
ac3beb6a5   Steven Whitehouse   GFS2: Don't use E...
70
  extern void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl);
66fc061bd   Steven Whitehouse   GFS2: FITRIM ioct...
71
72
73
74
  extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
  				   struct buffer_head *bh,
  				   const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed);
  extern int gfs2_fitrim(struct file *filp, void __user *argp);
b3b94faa5   David Teigland   [GFS2] The core o...
75

4a993fb15   Steven Whitehouse   GFS2: Add structu...
76
  /* This is how to tell if a reservation is in the rgrp tree: */
a097dc7e2   Bob Peterson   GFS2: Make rgrp r...
77
  static inline bool gfs2_rs_active(const struct gfs2_blkreserv *rs)
8e2e00473   Bob Peterson   GFS2: Reduce file...
78
  {
4a993fb15   Steven Whitehouse   GFS2: Add structu...
79
  	return rs && !RB_EMPTY_NODE(&rs->rs_node);
8e2e00473   Bob Peterson   GFS2: Reduce file...
80
  }
d552a2b9b   Bob Peterson   GFS2: Non-recursi...
81
82
83
84
85
86
  static inline int rgrp_contains_block(struct gfs2_rgrpd *rgd, u64 block)
  {
  	u64 first = rgd->rd_data0;
  	u64 last = first + rgd->rd_data;
  	return first <= block && block < last;
  }
00a158be8   Abhi Das   GFS2: fix bad ino...
87
  extern void check_and_update_goal(struct gfs2_inode *ip);
b3b94faa5   David Teigland   [GFS2] The core o...
88
  #endif /* __RGRP_DOT_H__ */