Blame view

fs/gfs2/inode.h 4.38 KB
b3b94faa5   David Teigland   [GFS2] The core o...
1
2
  /*
   * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
3a8a9a103   Steven Whitehouse   [GFS2] Update cop...
3
   * Copyright (C) 2004-2006 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 __INODE_DOT_H__
  #define __INODE_DOT_H__
b27605837   Steven Whitehouse   GFS2: Rationalise...
12
  #include <linux/fs.h>
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
13
14
  #include <linux/buffer_head.h>
  #include <linux/mm.h>
77658aad2   Steven Whitehouse   [GFS2] Eliminate ...
15
  #include "util.h"
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
16
17
18
19
  extern int gfs2_releasepage(struct page *page, gfp_t gfp_mask);
  extern int gfs2_internal_read(struct gfs2_inode *ip,
  			      struct file_ra_state *ra_state,
  			      char *buf, loff_t *pos, unsigned size);
3921120e7   Benjamin Marzinski   GFS2: fallocate s...
20
21
  extern void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
  				   unsigned int from, unsigned int to);
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
22
  extern void gfs2_set_aops(struct inode *inode);
dbb7cae2a   Steven Whitehouse   [GFS2] Clean up i...
23
  static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
b3b94faa5   David Teigland   [GFS2] The core o...
24
  {
ecc30c791   Steven Whitehouse   [GFS2] Streamline...
25
  	return !ip->i_height;
b3b94faa5   David Teigland   [GFS2] The core o...
26
  }
dbb7cae2a   Steven Whitehouse   [GFS2] Clean up i...
27
  static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
b3b94faa5   David Teigland   [GFS2] The core o...
28
  {
383f01fbf   Steven Whitehouse   GFS2: Banish stru...
29
  	return ip->i_diskflags & GFS2_DIF_JDATA;
b3b94faa5   David Teigland   [GFS2] The core o...
30
  }
bf36a7131   Steven Whitehouse   [GFS2] Add gfs2_i...
31
32
33
34
35
  static inline int gfs2_is_writeback(const struct gfs2_inode *ip)
  {
  	const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
  	return (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK) && !gfs2_is_jdata(ip);
  }
5561093e2   Steven Whitehouse   [GFS2] Introduce ...
36
37
38
39
40
  static inline int gfs2_is_ordered(const struct gfs2_inode *ip)
  {
  	const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
  	return (sdp->sd_args.ar_data == GFS2_DATA_ORDERED) && !gfs2_is_jdata(ip);
  }
dbb7cae2a   Steven Whitehouse   [GFS2] Clean up i...
41
  static inline int gfs2_is_dir(const struct gfs2_inode *ip)
18ec7d5c3   Steven Whitehouse   [GFS2] Make journ...
42
  {
b60623c23   Steven Whitehouse   [GFS2] Shrink gfs...
43
  	return S_ISDIR(ip->i_inode.i_mode);
18ec7d5c3   Steven Whitehouse   [GFS2] Make journ...
44
  }
77658aad2   Steven Whitehouse   [GFS2] Eliminate ...
45
46
47
48
49
50
51
  static inline void gfs2_set_inode_blocks(struct inode *inode, u64 blocks)
  {
  	inode->i_blocks = blocks <<
  		(GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
  }
  
  static inline u64 gfs2_get_inode_blocks(const struct inode *inode)
9e2dbdac3   Steven Whitehouse   [GFS2] Remove gfs...
52
  {
77658aad2   Steven Whitehouse   [GFS2] Eliminate ...
53
  	return inode->i_blocks >>
9e2dbdac3   Steven Whitehouse   [GFS2] Remove gfs...
54
55
  		(GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
  }
77658aad2   Steven Whitehouse   [GFS2] Eliminate ...
56
57
58
59
60
61
  static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change)
  {
  	gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change));
  	change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK);
  	inode->i_blocks += change;
  }
dbb7cae2a   Steven Whitehouse   [GFS2] Clean up i...
62
63
64
65
66
  static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr,
  				  u64 no_formal_ino)
  {
  	return ip->i_no_addr == no_addr && ip->i_no_formal_ino == no_formal_ino;
  }
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
67
68
69
70
71
72
  static inline void gfs2_inum_out(const struct gfs2_inode *ip,
  				 struct gfs2_dirent *dent)
  {
  	dent->de_inum.no_formal_ino = cpu_to_be64(ip->i_no_formal_ino);
  	dent->de_inum.no_addr = cpu_to_be64(ip->i_no_addr);
  }
a2e0f7993   Steven Whitehouse   GFS2: Remove i_di...
73
74
75
76
77
78
79
80
81
82
83
84
85
  static inline int gfs2_check_internal_file_size(struct inode *inode,
  						u64 minsize, u64 maxsize)
  {
  	u64 size = i_size_read(inode);
  	if (size < minsize || size > maxsize)
  		goto err;
  	if (size & ((1 << inode->i_blkbits) - 1))
  		goto err;
  	return 0;
  err:
  	gfs2_consist_inode(GFS2_I(inode));
  	return -EIO;
  }
bb8d8a6f5   Steven Whitehouse   [GFS2] Fix sign p...
86

b1e71b062   Steven Whitehouse   GFS2: Clean up so...
87
  extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, 
44ad37d69   Bob Peterson   GFS2: filesystem ...
88
89
  				       u64 no_addr, u64 no_formal_ino,
  				       int non_block);
044b9414c   Steven Whitehouse   GFS2: Fix inode d...
90
91
92
  extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
  					 u64 *no_formal_ino,
  					 unsigned int blktype);
4667a0ec3   Steven Whitehouse   GFS2: Make writeb...
93
  extern struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr, int nonblock);
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
94
95
  
  extern int gfs2_inode_refresh(struct gfs2_inode *ip);
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
96
97
  extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
  				  int is_root);
10556cb21   Al Viro   ->permission() sa...
98
  extern int gfs2_permission(struct inode *inode, int mask);
ab9bbda02   Steven Whitehouse   GFS2: Use ->dirty...
99
  extern int gfs2_setattr_simple(struct inode *inode, struct iattr *attr);
b1e71b062   Steven Whitehouse   GFS2: Clean up so...
100
101
  extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
  extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
b3b94faa5   David Teigland   [GFS2] The core o...
102

b27605837   Steven Whitehouse   GFS2: Rationalise...
103
104
105
  extern const struct inode_operations gfs2_file_iops;
  extern const struct inode_operations gfs2_dir_iops;
  extern const struct inode_operations gfs2_symlink_iops;
10d219880   Christoph Hellwig   GFS2: cleanup fil...
106
107
  extern const struct file_operations gfs2_file_fops_nolock;
  extern const struct file_operations gfs2_dir_fops_nolock;
b27605837   Steven Whitehouse   GFS2: Rationalise...
108
109
  
  extern void gfs2_set_inode_flags(struct inode *inode);
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
110
111
   
  #ifdef CONFIG_GFS2_FS_LOCKING_DLM
10d219880   Christoph Hellwig   GFS2: cleanup fil...
112
113
  extern const struct file_operations gfs2_file_fops;
  extern const struct file_operations gfs2_dir_fops;
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
114
115
116
117
118
  static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
  {
  	return sdp->sd_args.ar_localflocks;
  }
  #else /* Single node only */
10d219880   Christoph Hellwig   GFS2: cleanup fil...
119
120
  #define gfs2_file_fops gfs2_file_fops_nolock
  #define gfs2_dir_fops gfs2_dir_fops_nolock
f057f6cdf   Steven Whitehouse   GFS2: Merge lock_...
121
122
123
124
125
  static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
  {
  	return 1;
  }
  #endif /* CONFIG_GFS2_FS_LOCKING_DLM */
b27605837   Steven Whitehouse   GFS2: Rationalise...
126

b3b94faa5   David Teigland   [GFS2] The core o...
127
  #endif /* __INODE_DOT_H__ */