Home | History | Annotate | Download | only in linux

Lines Matching full:inode

215 #define MS_I_VERSION	(1<<23) /* Update inode I_version field */
233 /* Inode flags - they have nothing to superblock flags now */
240 #define S_NOQUOTA 32 /* Inode is not counted to quota */
244 #define S_PRIVATE 512 /* Inode is fs-internal */
245 #define S_IMA 1024 /* Inode has an associated IMA struct */
250 * Note that nosuid etc flags are inode-specific: setting some file-system
262 #define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
264 #define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
265 #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
266 ((inode)->i_flags & S_SYNC))
267 #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
268 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
269 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
270 #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
271 #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
273 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
274 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
275 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
276 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
278 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
279 #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
280 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
281 #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
282 #define IS_IMA(inode) ((inode)->i_flags & S_IMA)
283 #define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
284 #define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
346 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
432 typedef int (get_block_t)(struct inode *inode, sector_t iblock,
461 * This is the Inode Attributes structure, used for notify_change(). It
647 struct inode *host; /* owner: inode, block_device */
674 struct inode * bd_inode; /* will die */
744 #define i_size_ordered_init(inode) seqcount_init(&inode->i_size_seqcount)
746 #define i_size_ordered_init(inode) do { } while (0)
759 * of the 'struct inode'
761 struct inode {
815 struct list_head i_lru; /* inode LRU list */
842 __u32 i_fsnotify_mask; /* all events this inode cares about */
852 static inline int inode_unhashed(struct inode *inode)
854 return hlist_unhashed(&inode->i_hash);
858 * inode->i_mutex nesting subclasses for the lock validator:
887 static inline loff_t i_size_read(const struct inode *inode)
894 seq = read_seqcount_begin(&inode->i_size_seqcount);
895 i_size = inode->i_size;
896 } while (read_seqcount_retry(&inode->i_size_seqcount, seq));
902 i_size = inode->i_size;
906 return inode->i_size;
915 static inline void i_size_write(struct inode *inode, loff_t i_size)
918 write_seqcount_begin(&inode->i_size_seqcount);
919 inode->i_size = i_size;
920 write_seqcount_end(&inode->i_size_seqcount);
923 inode->i_size = i_size;
926 inode->i_size = i_size;
930 static inline unsigned iminor(const struct inode *inode)
932 return MINOR(inode->i_rdev);
935 static inline unsigned imajor(const struct inode *inode)
937 return MAJOR(inode->i_rdev);
940 extern struct block_device *I_BDEV(struct inode *inode);
1139 struct file_lock *fl_next; /* singly linked list for this inode */
1211 extern int __break_lease(struct inode *inode, unsigned int flags);
1212 extern void lease_get_mtime(struct inode *, struct timespec *time);
1216 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1217 extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1324 static inline int __break_lease(struct inode *inode, unsigned int mode)
1329 static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1351 static inline int lock_may_read(struct inode *inode, loff_t start,
1357 static inline int lock_may_write(struct inode *inode, loff_t start,
1456 struct list_head s_inode_lru; /* unused inode lru */
1535 #define inode_userns(inode) (&init_user_ns)
1536 extern bool inode_owner_or_capable(const struct inode *inode);
1545 extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1546 extern int vfs_mkdir(struct inode
1547 extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1548 extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1549 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1550 extern int vfs_rmdir(struct inode *, struct dentry *);
1551 extern int vfs_unlink(struct inode *, struct dentry *);
1552 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1562 extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1621 int (*open) (struct inode *, struct file *);
1623 int (*release) (struct inode *, struct file *);
1640 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1642 int (*permission) (struct inode *, int);
1643 struct posix_acl * (*get_acl)(struct inode *, int);
1648 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1649 int (*link) (struct dentry *,struct inode *,struct dentry *);
1650 int (*unlink) (struct inode *,struct dentry *);
1651 int (*symlink) (struct inode *,struct dentry *,const char *);
1652 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1653 int (*rmdir) (struct inode *,struct dentry *);
1654 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1655 int (*rename) (struct inode *, struct dentry *,
1656 struct inode *, struct dentry *);
1657 void (*truncate) (struct inode *);
1664 void (*truncate_range)(struct inode *, loff_t, loff_t);
1665 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1685 struct inode *(*alloc_inode)(struct super_block *sb);
1686 void (*destroy_inode)(struct inode *);
1688 void (*dirty_inode) (struct inode *, int flags);
1689 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1690 int (*drop_inode) (struct inode *);
1691 void (*evict_inode) (struct inode *);
1715 * Inode state bits. Protected by inode->i_lock
1717 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1720 * Four bits define the lifetime of an inode. Initially, inodes are I_NEW,
1722 * various stages of removing an inode.
1726 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on
1728 * I_DIRTY_DATASYNC Data-related inode changes pending. We keep track of
1730 * don't have to write inode on fdatasync() when only
1732 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
1735 * the same inode, one of them will release its inode and
1744 * I_FREEING Set when inode is about to be freed but still has dirty
1745 * pages or buffers attached or the inode itself is still
1747 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1748 * and can be destroyed. Inode keeps I_FREEING.
1752 * the inode to be completely released, then create it
1756 * I_SYNC Synchonized write of dirty inode data. The bits is
1760 * I_REFERENCED Marks the inode as recently references on the LRU list.
1782 extern void __mark_inode_dirty(struct inode *, int);
1783 static inline void mark_inode_dirty(struct inode *inode)
1785 __mark_inode_dirty(inode, I_DIRTY);
1788 static inline void mark_inode_dirty_sync(struct inode *inode)
1790 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1793 extern void inc_nlink(struct inode *inode);
1794 extern void drop_nlink(struct inode *inode);
1795 extern void clear_nlink(struct inode *inode);
1796 extern void set_nlink(struct inode *inode, unsigned int nlink);
1798 static inline void inode_inc_link_count(struct inode *inode)
1800 inc_nlink(inode);
1801 mark_inode_dirty(inode);
1804 static inline void inode_dec_link_count(struct inode *inode)
1806 drop_nlink(inode);
1807 mark_inode_dirty(inode);
1812 * @inode: inode that need to be updated
1814 * Every time the inode is modified, the i_version field will be incremented.
1818 static inline void inode_inc_iversion(struct inode *inode)
1820 spin_lock(&inode->i_lock);
1821 inode->i_version++;
1822 spin_unlock(&inode->i_lock);
1832 int sync_inode(struct inode *inode, struct writeback_control *wbc);
1833 int sync_inode_metadata(struct inode *inode, int wait);
1922 extern int locks_mandatory_locked(struct inode *);
1923 extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1930 static inline int __mandatory_lock(struct inode *ino)
1940 static inline int mandatory_lock(struct inode *ino)
1945 static inline int locks_verify_locked(struct inode *inode)
1947 if (mandatory_lock(inode))
1948 return locks_mandatory_locked(inode);
1952 static inline int locks_verify_truncate(struct inode *inode,
1956 if (inode->i_flock && mandatory_lock(inode))
1958 FLOCK_VERIFY_WRITE, inode, filp,
1959 size < inode->i_size ? size : inode->i_size,
1960 (size < inode->i_size ? inode->i_size - size
1961 : size - inode->i_size)
1966 static inline int break_lease(struct inode *inode, unsigned int mode)
1968 if (inode->i_flock)
1969 return __break_lease(inode, mode);
1973 static inline int locks_mandatory_locked(struct inode *inode)
1978 static inline int locks_mandatory_area(int rw, struct inode *inode,
1985 static inline int __mandatory_lock(struct inode *inode)
1990 inode *inode)
1995 static inline int locks_verify_locked(struct inode *inode)
2000 static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
2006 static inline int break_lease(struct inode *inode, unsigned int mode)
2055 extern void bd_forget(struct inode *inode);
2065 static inline void bd_forget(struct inode *inode) {}
2150 extern void init_special_inode(struct inode *, umode_t, dev_t);
2152 /* Invalid inode operations -- fs/bad_inode.c */
2153 extern void make_bad_inode(struct inode *);
2154 extern int is_bad_inode(struct inode *);
2181 static inline void invalidate_remote_inode(struct inode *inode)
2183 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
2184 S_ISLNK(inode->i_mode))
2185 invalidate_mapping_pages(inode->i_mapping, 0, -1);
2190 extern int write_inode_now(struct inode *, int);
2212 extern sector_t bmap(struct inode *, sector_t);
2215 extern int inode_permission(struct inode *, int);
2216 extern int generic_permission(struct inode *, int);
2218 static inline bool execute_ok(struct inode *inode)
2220 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2228 * MAP_DENYWRITE mmappings simultaneously. The i_writecount field of an inode
2239 static inline int get_write_access(struct inode *inode)
2241 return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
2245 struct inode *inode = file->f_path.dentry->d_inode;
2246 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY;
2248 static inline void put_write_access(struct inode * inode)
2250 atomic_dec(&inode->i_writecount);
2258 static inline void i_readcount_dec(struct inode *inode)
2260 BUG_ON(!atomic_read(&inode->i_readcount));
2261 atomic_dec(&inode->i_readcount);
2263 static inline void i_readcount_inc(struct inode *inode)
2265 atomic_inc(&inode->i_readcount);
2268 static inline void i_readcount_dec(struct inode *inode)
2272 static inline void i_readcount_inc(struct inode *inode)
2297 extern int inode_init_always(struct super_block *, struct inode *);
2298 extern void inode_init_once(struct inode *);
2300 extern void ihold(struct inode * inode);
2301 extern void iput(struct inode *);
2302 extern struct inode * igrab(struct inode *);
2304 extern int inode_needs_sync(struct inode *inode);
2305 extern int generic_delete_inode(struct inode *inode);
2306 static inline int generic_drop_inode(struct inode *inode)
2308 return !inode->i_nlink || inode_unhashed(inode);
2311 extern struct inode *ilookup5_nowait(struct super_block *sb,
2312 unsigned long hashval, int (*test)(struct inode *, void *),
2314 extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
2315 int (*test)(struct inode *, void *), void *data);
2316 extern struct inode *ilookup(struct super_block *sb, unsigned long ino);
2318 extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *);
2319 extern struct inode * iget_locked(struct super_block *, unsigned long);
2320 extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *);
2321 extern int insert_inode_locked(struct inode *);
2323 extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
2325 static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
2327 extern void unlock_new_inode(struct inode *);
2330 extern void __iget(struct inode * inode);
2331 extern void iget_failed(struct inode *);
2332 extern void end_writeback(struct inode *);
2333 extern void __destroy_inode(struct inode *);
2334 extern struct inode *new_inode_pseudo(struct super_block *sb);
2335 extern struct inode *new_inode(struct super_block *sb);
2336 extern void free_inode_nonrcu(struct inode *inode);
2340 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2341 static inline void insert_inode_hash(struct inode *inode)
2343 __insert_inode_hash(inode, inode->i_ino);
2346 extern void __remove_inode_hash(struct inode *);
2347 static inline void remove_inode_hash(struct inode *inode)
2349 if (!inode_unhashed(inode))
2350 __remove_inode_hash(inode);
2353 extern void inode_sb_list_add(struct inode *inode);
2406 extern int generic_file_open(struct inode * inode, struct file * filp);
2407 extern int nonseekable_open(struct inode * inode, struct file * filp);
2424 typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2436 void inode_dio_wait(struct inode *inode);
2437 void inode_dio_done(struct inode *inode);
2439 ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2445 struct inode *inode, const struct iovec *iov, loff_t offset,
2448 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
2453 static inline void inode_dio_wait(struct inode *inode)
2467 extern int __page_symlink(struct inode *inode, const char *symname, int len,
2469 extern int page_symlink(struct inode *inode, const char *symname, int len);
2472 extern void generic_fillattr(struct inode *, struct kstat *);
2474 void __inode_add_bytes(struct inode *inode, loff_t bytes);
2475 void inode_add_bytes(struct inode *inode, loff_t bytes);
2476 void inode_sub_bytes(struct inode *inode, loff_t bytes);
2477 loff_t inode_get_bytes(struct inode *inode);
2478 void inode_set_bytes(struct inode *inode, loff_t bytes);
2489 extern int __generic_block_fiemap(struct inode *inode,
2493 extern int generic_block_fiemap(struct inode *inode,
2508 extern int dcache_dir_open(struct inode *, struct file *);
2509 extern int dcache_dir_close(struct inode *, struct file *);
2515 extern int simple_open(struct inode *inode, struct file *file);
2516 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2517 extern int simple_unlink(struct inode *, struct dentry *);
2518 extern int simple_rmdir(struct inode *, struct dentry *);
2519 extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2530 extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
2557 extern int inode_change_ok(const struct inode *, struct iattr *);
2558 extern int inode_newsize_ok(const struct inode *, loff_t offset);
2559 extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2598 int simple_transaction_release(struct inode *inode, struct file *file);
2619 static int __fops ## _open(struct inode *inode, struct file *file) \
2622 return simple_attr_open(inode, file, __get, __set, __fmt); \
2639 int simple_attr_open(struct inode *inode, struct file *file,
2642 int simple_attr_release(struct inode *inode, struct file *file);
2669 static inline void inode_has_no_xattr(struct inode *inode)
2671 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
2672 inode->i_flags |= S_NOSEC;