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 { 15*ecc30c79SSteven Whitehouse return !ip->i_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 23bf36a713SSteven Whitehouse static inline int gfs2_is_writeback(const struct gfs2_inode *ip) 24bf36a713SSteven Whitehouse { 25bf36a713SSteven Whitehouse const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 26bf36a713SSteven Whitehouse return (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK) && !gfs2_is_jdata(ip); 27bf36a713SSteven Whitehouse } 28bf36a713SSteven Whitehouse 295561093eSSteven Whitehouse static inline int gfs2_is_ordered(const struct gfs2_inode *ip) 305561093eSSteven Whitehouse { 315561093eSSteven Whitehouse const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 325561093eSSteven Whitehouse return (sdp->sd_args.ar_data == GFS2_DATA_ORDERED) && !gfs2_is_jdata(ip); 335561093eSSteven Whitehouse } 345561093eSSteven Whitehouse 35dbb7cae2SSteven Whitehouse static inline int gfs2_is_dir(const struct gfs2_inode *ip) 3618ec7d5cSSteven Whitehouse { 37b60623c2SSteven Whitehouse return S_ISDIR(ip->i_inode.i_mode); 3818ec7d5cSSteven Whitehouse } 3918ec7d5cSSteven Whitehouse 409e2dbdacSSteven Whitehouse static inline void gfs2_set_inode_blocks(struct inode *inode) 419e2dbdacSSteven Whitehouse { 429e2dbdacSSteven Whitehouse struct gfs2_inode *ip = GFS2_I(inode); 439e2dbdacSSteven Whitehouse inode->i_blocks = ip->i_di.di_blocks << 449e2dbdacSSteven Whitehouse (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); 459e2dbdacSSteven Whitehouse } 469e2dbdacSSteven Whitehouse 47dbb7cae2SSteven Whitehouse static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr, 48dbb7cae2SSteven Whitehouse u64 no_formal_ino) 49dbb7cae2SSteven Whitehouse { 50dbb7cae2SSteven Whitehouse return ip->i_no_addr == no_addr && ip->i_no_formal_ino == no_formal_ino; 51dbb7cae2SSteven Whitehouse } 52dbb7cae2SSteven Whitehouse 53bb8d8a6fSSteven Whitehouse static inline void gfs2_inum_out(const struct gfs2_inode *ip, 54bb8d8a6fSSteven Whitehouse struct gfs2_dirent *dent) 55bb8d8a6fSSteven Whitehouse { 56bb8d8a6fSSteven Whitehouse dent->de_inum.no_formal_ino = cpu_to_be64(ip->i_no_formal_ino); 57bb8d8a6fSSteven Whitehouse dent->de_inum.no_addr = cpu_to_be64(ip->i_no_addr); 58bb8d8a6fSSteven Whitehouse } 59bb8d8a6fSSteven Whitehouse 60bb8d8a6fSSteven Whitehouse 61b3b94faaSDavid Teigland void gfs2_inode_attr_in(struct gfs2_inode *ip); 6235dcc52eSWendy Cheng void gfs2_set_iop(struct inode *inode); 63bb9bcf06SWendy Cheng struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, 647a9f53b3SBenjamin Marzinski u64 no_addr, u64 no_formal_ino, 657a9f53b3SBenjamin Marzinski int skip_freeing); 66dbb7cae2SSteven Whitehouse struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); 67b3b94faaSDavid Teigland 68b3b94faaSDavid Teigland int gfs2_inode_refresh(struct gfs2_inode *ip); 69b3b94faaSDavid Teigland 70feaa7bbaSSteven Whitehouse int gfs2_dinode_dealloc(struct gfs2_inode *inode); 71b3b94faaSDavid Teigland int gfs2_change_nlink(struct gfs2_inode *ip, int diff); 72feaa7bbaSSteven Whitehouse struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, 73feaa7bbaSSteven Whitehouse int is_root, struct nameidata *nd); 74feaa7bbaSSteven Whitehouse struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, 75e7f14f4dSSteven Whitehouse unsigned int mode, dev_t dev); 76feaa7bbaSSteven Whitehouse int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, 77feaa7bbaSSteven Whitehouse struct gfs2_inode *ip); 78feaa7bbaSSteven Whitehouse int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, 79dbb7cae2SSteven Whitehouse const struct gfs2_inode *ip); 80b3b94faaSDavid Teigland int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to); 81b3b94faaSDavid Teigland int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len); 82b3b94faaSDavid Teigland int gfs2_glock_nq_atime(struct gfs2_holder *gh); 83b3b94faaSDavid Teigland int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr); 84c752666cSSteven Whitehouse struct inode *gfs2_lookup_simple(struct inode *dip, const char *name); 85bb8d8a6fSSteven Whitehouse void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); 86bb8d8a6fSSteven Whitehouse void gfs2_dinode_print(const struct gfs2_inode *ip); 87b3b94faaSDavid Teigland 88b3b94faaSDavid Teigland #endif /* __INODE_DOT_H__ */ 89b3b94faaSDavid Teigland 90