aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/inode.h')
-rw-r--r--fs/gfs2/inode.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index db738686ca1d..580da454b38f 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -10,6 +10,8 @@
10#ifndef __INODE_DOT_H__ 10#ifndef __INODE_DOT_H__
11#define __INODE_DOT_H__ 11#define __INODE_DOT_H__
12 12
13#include "util.h"
14
13static inline int gfs2_is_stuffed(const struct gfs2_inode *ip) 15static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
14{ 16{
15 return !ip->i_height; 17 return !ip->i_height;
@@ -37,13 +39,25 @@ static inline int gfs2_is_dir(const struct gfs2_inode *ip)
37 return S_ISDIR(ip->i_inode.i_mode); 39 return S_ISDIR(ip->i_inode.i_mode);
38} 40}
39 41
40static inline void gfs2_set_inode_blocks(struct inode *inode) 42static inline void gfs2_set_inode_blocks(struct inode *inode, u64 blocks)
43{
44 inode->i_blocks = blocks <<
45 (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
46}
47
48static inline u64 gfs2_get_inode_blocks(const struct inode *inode)
41{ 49{
42 struct gfs2_inode *ip = GFS2_I(inode); 50 return inode->i_blocks >>
43 inode->i_blocks = ip->i_di.di_blocks <<
44 (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); 51 (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
45} 52}
46 53
54static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change)
55{
56 gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change));
57 change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK);
58 inode->i_blocks += change;
59}
60
47static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr, 61static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr,
48 u64 no_formal_ino) 62 u64 no_formal_ino)
49{ 63{