xref: /linux/fs/gfs2/inode.h (revision bb9bcf061660661c57ddcf31337529f82414b937)
1b3b94faaSDavid Teigland /*
2b3b94faaSDavid Teigland  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
33a8a9a10SSteven Whitehouse  * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
4b3b94faaSDavid Teigland  *
5b3b94faaSDavid Teigland  * This copyrighted material is made available to anyone wishing to use,
6b3b94faaSDavid Teigland  * modify, copy, or redistribute it subject to the terms and conditions
7e9fc2aa0SSteven Whitehouse  * of the GNU General Public License version 2.
8b3b94faaSDavid Teigland  */
9b3b94faaSDavid Teigland 
10b3b94faaSDavid Teigland #ifndef __INODE_DOT_H__
11b3b94faaSDavid Teigland #define __INODE_DOT_H__
12b3b94faaSDavid Teigland 
13dbb7cae2SSteven Whitehouse static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
14b3b94faaSDavid Teigland {
15b3b94faaSDavid Teigland 	return !ip->i_di.di_height;
16b3b94faaSDavid Teigland }
17b3b94faaSDavid Teigland 
18dbb7cae2SSteven Whitehouse static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
19b3b94faaSDavid Teigland {
20b3b94faaSDavid Teigland 	return ip->i_di.di_flags & GFS2_DIF_JDATA;
21b3b94faaSDavid Teigland }
22b3b94faaSDavid Teigland 
23dbb7cae2SSteven Whitehouse static inline int gfs2_is_dir(const struct gfs2_inode *ip)
2418ec7d5cSSteven Whitehouse {
25b60623c2SSteven Whitehouse 	return S_ISDIR(ip->i_inode.i_mode);
2618ec7d5cSSteven Whitehouse }
2718ec7d5cSSteven Whitehouse 
289e2dbdacSSteven Whitehouse static inline void gfs2_set_inode_blocks(struct inode *inode)
299e2dbdacSSteven Whitehouse {
309e2dbdacSSteven Whitehouse 	struct gfs2_inode *ip = GFS2_I(inode);
319e2dbdacSSteven Whitehouse 	inode->i_blocks = ip->i_di.di_blocks <<
329e2dbdacSSteven Whitehouse 		(GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
339e2dbdacSSteven Whitehouse }
349e2dbdacSSteven Whitehouse 
35dbb7cae2SSteven Whitehouse static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr,
36dbb7cae2SSteven Whitehouse 				  u64 no_formal_ino)
37dbb7cae2SSteven Whitehouse {
38dbb7cae2SSteven Whitehouse 	return ip->i_no_addr == no_addr && ip->i_no_formal_ino == no_formal_ino;
39dbb7cae2SSteven Whitehouse }
40dbb7cae2SSteven Whitehouse 
41bb8d8a6fSSteven Whitehouse static inline void gfs2_inum_out(const struct gfs2_inode *ip,
42bb8d8a6fSSteven Whitehouse 				 struct gfs2_dirent *dent)
43bb8d8a6fSSteven Whitehouse {
44bb8d8a6fSSteven Whitehouse 	dent->de_inum.no_formal_ino = cpu_to_be64(ip->i_no_formal_ino);
45bb8d8a6fSSteven Whitehouse 	dent->de_inum.no_addr = cpu_to_be64(ip->i_no_addr);
46bb8d8a6fSSteven Whitehouse }
47bb8d8a6fSSteven Whitehouse 
48bb8d8a6fSSteven Whitehouse 
49b3b94faaSDavid Teigland void gfs2_inode_attr_in(struct gfs2_inode *ip);
50*bb9bcf06SWendy Cheng struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
51*bb9bcf06SWendy Cheng 				u64 no_addr, u64 no_formal_ino);
52dbb7cae2SSteven Whitehouse struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr);
53b3b94faaSDavid Teigland 
54b3b94faaSDavid Teigland int gfs2_inode_refresh(struct gfs2_inode *ip);
55b3b94faaSDavid Teigland 
56feaa7bbaSSteven Whitehouse int gfs2_dinode_dealloc(struct gfs2_inode *inode);
57b3b94faaSDavid Teigland int gfs2_change_nlink(struct gfs2_inode *ip, int diff);
58feaa7bbaSSteven Whitehouse struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
59feaa7bbaSSteven Whitehouse 			   int is_root, struct nameidata *nd);
60feaa7bbaSSteven Whitehouse struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
61e7f14f4dSSteven Whitehouse 			   unsigned int mode, dev_t dev);
62feaa7bbaSSteven Whitehouse int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
63feaa7bbaSSteven Whitehouse 		struct gfs2_inode *ip);
64feaa7bbaSSteven Whitehouse int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
65dbb7cae2SSteven Whitehouse 		   const struct gfs2_inode *ip);
66b3b94faaSDavid Teigland int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to);
67b3b94faaSDavid Teigland int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len);
68b3b94faaSDavid Teigland int gfs2_glock_nq_atime(struct gfs2_holder *gh);
69b3b94faaSDavid Teigland int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
70c752666cSSteven Whitehouse struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
71bb8d8a6fSSteven Whitehouse void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
72bb8d8a6fSSteven Whitehouse void gfs2_dinode_print(const struct gfs2_inode *ip);
73b3b94faaSDavid Teigland 
74b3b94faaSDavid Teigland #endif /* __INODE_DOT_H__ */
75b3b94faaSDavid Teigland 
76