diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 189 |
1 files changed, 127 insertions, 62 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index b5b979247863..178cdb4f1d4a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -32,7 +32,9 @@ | |||
32 | #define SEEK_SET 0 /* seek relative to beginning of file */ | 32 | #define SEEK_SET 0 /* seek relative to beginning of file */ |
33 | #define SEEK_CUR 1 /* seek relative to current file position */ | 33 | #define SEEK_CUR 1 /* seek relative to current file position */ |
34 | #define SEEK_END 2 /* seek relative to end of file */ | 34 | #define SEEK_END 2 /* seek relative to end of file */ |
35 | #define SEEK_MAX SEEK_END | 35 | #define SEEK_DATA 3 /* seek to the next data */ |
36 | #define SEEK_HOLE 4 /* seek to the next hole */ | ||
37 | #define SEEK_MAX SEEK_HOLE | ||
36 | 38 | ||
37 | struct fstrim_range { | 39 | struct fstrim_range { |
38 | __u64 start; | 40 | __u64 start; |
@@ -63,6 +65,7 @@ struct inodes_stat_t { | |||
63 | #define MAY_ACCESS 16 | 65 | #define MAY_ACCESS 16 |
64 | #define MAY_OPEN 32 | 66 | #define MAY_OPEN 32 |
65 | #define MAY_CHDIR 64 | 67 | #define MAY_CHDIR 64 |
68 | #define MAY_NOT_BLOCK 128 /* called from RCU mode, don't block */ | ||
66 | 69 | ||
67 | /* | 70 | /* |
68 | * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond | 71 | * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond |
@@ -376,7 +379,6 @@ struct inodes_stat_t { | |||
376 | 379 | ||
377 | #include <linux/linkage.h> | 380 | #include <linux/linkage.h> |
378 | #include <linux/wait.h> | 381 | #include <linux/wait.h> |
379 | #include <linux/types.h> | ||
380 | #include <linux/kdev_t.h> | 382 | #include <linux/kdev_t.h> |
381 | #include <linux/dcache.h> | 383 | #include <linux/dcache.h> |
382 | #include <linux/path.h> | 384 | #include <linux/path.h> |
@@ -392,8 +394,9 @@ struct inodes_stat_t { | |||
392 | #include <linux/semaphore.h> | 394 | #include <linux/semaphore.h> |
393 | #include <linux/fiemap.h> | 395 | #include <linux/fiemap.h> |
394 | #include <linux/rculist_bl.h> | 396 | #include <linux/rculist_bl.h> |
397 | #include <linux/shrinker.h> | ||
398 | #include <linux/atomic.h> | ||
395 | 399 | ||
396 | #include <asm/atomic.h> | ||
397 | #include <asm/byteorder.h> | 400 | #include <asm/byteorder.h> |
398 | 401 | ||
399 | struct export_operations; | 402 | struct export_operations; |
@@ -735,22 +738,54 @@ static inline int mapping_writably_mapped(struct address_space *mapping) | |||
735 | struct posix_acl; | 738 | struct posix_acl; |
736 | #define ACL_NOT_CACHED ((void *)(-1)) | 739 | #define ACL_NOT_CACHED ((void *)(-1)) |
737 | 740 | ||
741 | #define IOP_FASTPERM 0x0001 | ||
742 | #define IOP_LOOKUP 0x0002 | ||
743 | #define IOP_NOFOLLOW 0x0004 | ||
744 | |||
745 | /* | ||
746 | * Keep mostly read-only and often accessed (especially for | ||
747 | * the RCU path lookup and 'stat' data) fields at the beginning | ||
748 | * of the 'struct inode' | ||
749 | */ | ||
738 | struct inode { | 750 | struct inode { |
739 | /* RCU path lookup touches following: */ | ||
740 | umode_t i_mode; | 751 | umode_t i_mode; |
752 | unsigned short i_opflags; | ||
741 | uid_t i_uid; | 753 | uid_t i_uid; |
742 | gid_t i_gid; | 754 | gid_t i_gid; |
755 | unsigned int i_flags; | ||
756 | |||
757 | #ifdef CONFIG_FS_POSIX_ACL | ||
758 | struct posix_acl *i_acl; | ||
759 | struct posix_acl *i_default_acl; | ||
760 | #endif | ||
761 | |||
743 | const struct inode_operations *i_op; | 762 | const struct inode_operations *i_op; |
744 | struct super_block *i_sb; | 763 | struct super_block *i_sb; |
764 | struct address_space *i_mapping; | ||
745 | 765 | ||
746 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | ||
747 | unsigned int i_flags; | ||
748 | unsigned long i_state; | ||
749 | #ifdef CONFIG_SECURITY | 766 | #ifdef CONFIG_SECURITY |
750 | void *i_security; | 767 | void *i_security; |
751 | #endif | 768 | #endif |
752 | struct mutex i_mutex; | ||
753 | 769 | ||
770 | /* Stat data, not accessed from path walking */ | ||
771 | unsigned long i_ino; | ||
772 | unsigned int i_nlink; | ||
773 | dev_t i_rdev; | ||
774 | loff_t i_size; | ||
775 | struct timespec i_atime; | ||
776 | struct timespec i_mtime; | ||
777 | struct timespec i_ctime; | ||
778 | unsigned int i_blkbits; | ||
779 | blkcnt_t i_blocks; | ||
780 | |||
781 | #ifdef __NEED_I_SIZE_ORDERED | ||
782 | seqcount_t i_size_seqcount; | ||
783 | #endif | ||
784 | |||
785 | /* Misc */ | ||
786 | unsigned long i_state; | ||
787 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | ||
788 | struct mutex i_mutex; | ||
754 | 789 | ||
755 | unsigned long dirtied_when; /* jiffies of first dirtying */ | 790 | unsigned long dirtied_when; /* jiffies of first dirtying */ |
756 | 791 | ||
@@ -762,25 +797,12 @@ struct inode { | |||
762 | struct list_head i_dentry; | 797 | struct list_head i_dentry; |
763 | struct rcu_head i_rcu; | 798 | struct rcu_head i_rcu; |
764 | }; | 799 | }; |
765 | unsigned long i_ino; | ||
766 | atomic_t i_count; | 800 | atomic_t i_count; |
767 | unsigned int i_nlink; | ||
768 | dev_t i_rdev; | ||
769 | unsigned int i_blkbits; | ||
770 | u64 i_version; | 801 | u64 i_version; |
771 | loff_t i_size; | ||
772 | #ifdef __NEED_I_SIZE_ORDERED | ||
773 | seqcount_t i_size_seqcount; | ||
774 | #endif | ||
775 | struct timespec i_atime; | ||
776 | struct timespec i_mtime; | ||
777 | struct timespec i_ctime; | ||
778 | blkcnt_t i_blocks; | ||
779 | unsigned short i_bytes; | 802 | unsigned short i_bytes; |
780 | struct rw_semaphore i_alloc_sem; | 803 | atomic_t i_dio_count; |
781 | const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 804 | const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ |
782 | struct file_lock *i_flock; | 805 | struct file_lock *i_flock; |
783 | struct address_space *i_mapping; | ||
784 | struct address_space i_data; | 806 | struct address_space i_data; |
785 | #ifdef CONFIG_QUOTA | 807 | #ifdef CONFIG_QUOTA |
786 | struct dquot *i_dquot[MAXQUOTAS]; | 808 | struct dquot *i_dquot[MAXQUOTAS]; |
@@ -803,10 +825,6 @@ struct inode { | |||
803 | atomic_t i_readcount; /* struct files open RO */ | 825 | atomic_t i_readcount; /* struct files open RO */ |
804 | #endif | 826 | #endif |
805 | atomic_t i_writecount; | 827 | atomic_t i_writecount; |
806 | #ifdef CONFIG_FS_POSIX_ACL | ||
807 | struct posix_acl *i_acl; | ||
808 | struct posix_acl *i_default_acl; | ||
809 | #endif | ||
810 | void *i_private; /* fs or device private pointer */ | 828 | void *i_private; /* fs or device private pointer */ |
811 | }; | 829 | }; |
812 | 830 | ||
@@ -1069,12 +1087,12 @@ struct file_lock_operations { | |||
1069 | }; | 1087 | }; |
1070 | 1088 | ||
1071 | struct lock_manager_operations { | 1089 | struct lock_manager_operations { |
1072 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); | 1090 | int (*lm_compare_owner)(struct file_lock *, struct file_lock *); |
1073 | void (*fl_notify)(struct file_lock *); /* unblock callback */ | 1091 | void (*lm_notify)(struct file_lock *); /* unblock callback */ |
1074 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); | 1092 | int (*lm_grant)(struct file_lock *, struct file_lock *, int); |
1075 | void (*fl_release_private)(struct file_lock *); | 1093 | void (*lm_release_private)(struct file_lock *); |
1076 | void (*fl_break)(struct file_lock *); | 1094 | void (*lm_break)(struct file_lock *); |
1077 | int (*fl_change)(struct file_lock **, int); | 1095 | int (*lm_change)(struct file_lock **, int); |
1078 | }; | 1096 | }; |
1079 | 1097 | ||
1080 | struct lock_manager { | 1098 | struct lock_manager { |
@@ -1396,6 +1414,11 @@ struct super_block { | |||
1396 | struct list_head s_dentry_lru; /* unused dentry lru */ | 1414 | struct list_head s_dentry_lru; /* unused dentry lru */ |
1397 | int s_nr_dentry_unused; /* # of dentry on lru */ | 1415 | int s_nr_dentry_unused; /* # of dentry on lru */ |
1398 | 1416 | ||
1417 | /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */ | ||
1418 | spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp; | ||
1419 | struct list_head s_inode_lru; /* unused inode lru */ | ||
1420 | int s_nr_inodes_unused; /* # of inodes on lru */ | ||
1421 | |||
1399 | struct block_device *s_bdev; | 1422 | struct block_device *s_bdev; |
1400 | struct backing_dev_info *s_bdi; | 1423 | struct backing_dev_info *s_bdi; |
1401 | struct mtd_info *s_mtd; | 1424 | struct mtd_info *s_mtd; |
@@ -1438,8 +1461,14 @@ struct super_block { | |||
1438 | * Saved pool identifier for cleancache (-1 means none) | 1461 | * Saved pool identifier for cleancache (-1 means none) |
1439 | */ | 1462 | */ |
1440 | int cleancache_poolid; | 1463 | int cleancache_poolid; |
1464 | |||
1465 | struct shrinker s_shrink; /* per-sb shrinker handle */ | ||
1441 | }; | 1466 | }; |
1442 | 1467 | ||
1468 | /* superblock cache pruning functions */ | ||
1469 | extern void prune_icache_sb(struct super_block *sb, int nr_to_scan); | ||
1470 | extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan); | ||
1471 | |||
1443 | extern struct timespec current_fs_time(struct super_block *sb); | 1472 | extern struct timespec current_fs_time(struct super_block *sb); |
1444 | 1473 | ||
1445 | /* | 1474 | /* |
@@ -1454,10 +1483,6 @@ enum { | |||
1454 | #define vfs_check_frozen(sb, level) \ | 1483 | #define vfs_check_frozen(sb, level) \ |
1455 | wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) | 1484 | wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) |
1456 | 1485 | ||
1457 | #define get_fs_excl() atomic_inc(¤t->fs_excl) | ||
1458 | #define put_fs_excl() atomic_dec(¤t->fs_excl) | ||
1459 | #define has_fs_excl() atomic_read(¤t->fs_excl) | ||
1460 | |||
1461 | /* | 1486 | /* |
1462 | * until VFS tracks user namespaces for inodes, just make all files | 1487 | * until VFS tracks user namespaces for inodes, just make all files |
1463 | * belong to init_user_ns | 1488 | * belong to init_user_ns |
@@ -1490,7 +1515,6 @@ extern void dentry_unhash(struct dentry *dentry); | |||
1490 | /* | 1515 | /* |
1491 | * VFS file helper functions. | 1516 | * VFS file helper functions. |
1492 | */ | 1517 | */ |
1493 | extern int file_permission(struct file *, int); | ||
1494 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, | 1518 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, |
1495 | mode_t mode); | 1519 | mode_t mode); |
1496 | /* | 1520 | /* |
@@ -1538,11 +1562,6 @@ struct block_device_operations; | |||
1538 | #define HAVE_COMPAT_IOCTL 1 | 1562 | #define HAVE_COMPAT_IOCTL 1 |
1539 | #define HAVE_UNLOCKED_IOCTL 1 | 1563 | #define HAVE_UNLOCKED_IOCTL 1 |
1540 | 1564 | ||
1541 | /* | ||
1542 | * NOTE: | ||
1543 | * all file operations except setlease can be called without | ||
1544 | * the big kernel lock held in all filesystems. | ||
1545 | */ | ||
1546 | struct file_operations { | 1565 | struct file_operations { |
1547 | struct module *owner; | 1566 | struct module *owner; |
1548 | loff_t (*llseek) (struct file *, loff_t, int); | 1567 | loff_t (*llseek) (struct file *, loff_t, int); |
@@ -1558,7 +1577,7 @@ struct file_operations { | |||
1558 | int (*open) (struct inode *, struct file *); | 1577 | int (*open) (struct inode *, struct file *); |
1559 | int (*flush) (struct file *, fl_owner_t id); | 1578 | int (*flush) (struct file *, fl_owner_t id); |
1560 | int (*release) (struct inode *, struct file *); | 1579 | int (*release) (struct inode *, struct file *); |
1561 | int (*fsync) (struct file *, int datasync); | 1580 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); |
1562 | int (*aio_fsync) (struct kiocb *, int datasync); | 1581 | int (*aio_fsync) (struct kiocb *, int datasync); |
1563 | int (*fasync) (int, struct file *, int); | 1582 | int (*fasync) (int, struct file *, int); |
1564 | int (*lock) (struct file *, int, struct file_lock *); | 1583 | int (*lock) (struct file *, int, struct file_lock *); |
@@ -1573,13 +1592,11 @@ struct file_operations { | |||
1573 | loff_t len); | 1592 | loff_t len); |
1574 | }; | 1593 | }; |
1575 | 1594 | ||
1576 | #define IPERM_FLAG_RCU 0x0001 | ||
1577 | |||
1578 | struct inode_operations { | 1595 | struct inode_operations { |
1579 | struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); | 1596 | struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); |
1580 | void * (*follow_link) (struct dentry *, struct nameidata *); | 1597 | void * (*follow_link) (struct dentry *, struct nameidata *); |
1581 | int (*permission) (struct inode *, int, unsigned int); | 1598 | int (*permission) (struct inode *, int); |
1582 | int (*check_acl)(struct inode *, int, unsigned int); | 1599 | struct posix_acl * (*get_acl)(struct inode *, int); |
1583 | 1600 | ||
1584 | int (*readlink) (struct dentry *, char __user *,int); | 1601 | int (*readlink) (struct dentry *, char __user *,int); |
1585 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1602 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
@@ -1645,6 +1662,8 @@ struct super_operations { | |||
1645 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); | 1662 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
1646 | #endif | 1663 | #endif |
1647 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); | 1664 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); |
1665 | int (*nr_cached_objects)(struct super_block *); | ||
1666 | void (*free_cached_objects)(struct super_block *, int); | ||
1648 | }; | 1667 | }; |
1649 | 1668 | ||
1650 | /* | 1669 | /* |
@@ -1693,6 +1712,10 @@ struct super_operations { | |||
1693 | * set during data writeback, and cleared with a wakeup | 1712 | * set during data writeback, and cleared with a wakeup |
1694 | * on the bit address once it is done. | 1713 | * on the bit address once it is done. |
1695 | * | 1714 | * |
1715 | * I_REFERENCED Marks the inode as recently references on the LRU list. | ||
1716 | * | ||
1717 | * I_DIO_WAKEUP Never set. Only used as a key for wait_on_bit(). | ||
1718 | * | ||
1696 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1719 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1697 | */ | 1720 | */ |
1698 | #define I_DIRTY_SYNC (1 << 0) | 1721 | #define I_DIRTY_SYNC (1 << 0) |
@@ -1706,6 +1729,8 @@ struct super_operations { | |||
1706 | #define __I_SYNC 7 | 1729 | #define __I_SYNC 7 |
1707 | #define I_SYNC (1 << __I_SYNC) | 1730 | #define I_SYNC (1 << __I_SYNC) |
1708 | #define I_REFERENCED (1 << 8) | 1731 | #define I_REFERENCED (1 << 8) |
1732 | #define __I_DIO_WAKEUP 9 | ||
1733 | #define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) | ||
1709 | 1734 | ||
1710 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1735 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
1711 | 1736 | ||
@@ -1816,7 +1841,6 @@ struct file_system_type { | |||
1816 | struct lock_class_key i_lock_key; | 1841 | struct lock_class_key i_lock_key; |
1817 | struct lock_class_key i_mutex_key; | 1842 | struct lock_class_key i_mutex_key; |
1818 | struct lock_class_key i_mutex_dir_key; | 1843 | struct lock_class_key i_mutex_dir_key; |
1819 | struct lock_class_key i_alloc_sem_key; | ||
1820 | }; | 1844 | }; |
1821 | 1845 | ||
1822 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, | 1846 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, |
@@ -1837,6 +1861,8 @@ void kill_litter_super(struct super_block *sb); | |||
1837 | void deactivate_super(struct super_block *sb); | 1861 | void deactivate_super(struct super_block *sb); |
1838 | void deactivate_locked_super(struct super_block *sb); | 1862 | void deactivate_locked_super(struct super_block *sb); |
1839 | int set_anon_super(struct super_block *s, void *data); | 1863 | int set_anon_super(struct super_block *s, void *data); |
1864 | int get_anon_bdev(dev_t *); | ||
1865 | void free_anon_bdev(dev_t); | ||
1840 | struct super_block *sget(struct file_system_type *type, | 1866 | struct super_block *sget(struct file_system_type *type, |
1841 | int (*test)(struct super_block *,void *), | 1867 | int (*test)(struct super_block *,void *), |
1842 | int (*set)(struct super_block *,void *), | 1868 | int (*set)(struct super_block *,void *), |
@@ -1869,6 +1895,7 @@ extern int register_filesystem(struct file_system_type *); | |||
1869 | extern int unregister_filesystem(struct file_system_type *); | 1895 | extern int unregister_filesystem(struct file_system_type *); |
1870 | extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); | 1896 | extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); |
1871 | #define kern_mount(type) kern_mount_data(type, NULL) | 1897 | #define kern_mount(type) kern_mount_data(type, NULL) |
1898 | extern void kern_unmount(struct vfsmount *mnt); | ||
1872 | extern int may_umount_tree(struct vfsmount *); | 1899 | extern int may_umount_tree(struct vfsmount *); |
1873 | extern int may_umount(struct vfsmount *); | 1900 | extern int may_umount(struct vfsmount *); |
1874 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1901 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
@@ -2188,16 +2215,38 @@ extern sector_t bmap(struct inode *, sector_t); | |||
2188 | #endif | 2215 | #endif |
2189 | extern int notify_change(struct dentry *, struct iattr *); | 2216 | extern int notify_change(struct dentry *, struct iattr *); |
2190 | extern int inode_permission(struct inode *, int); | 2217 | extern int inode_permission(struct inode *, int); |
2191 | extern int generic_permission(struct inode *, int, unsigned int, | 2218 | extern int generic_permission(struct inode *, int); |
2192 | int (*check_acl)(struct inode *, int, unsigned int)); | ||
2193 | 2219 | ||
2194 | static inline bool execute_ok(struct inode *inode) | 2220 | static inline bool execute_ok(struct inode *inode) |
2195 | { | 2221 | { |
2196 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | 2222 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
2197 | } | 2223 | } |
2198 | 2224 | ||
2199 | extern int get_write_access(struct inode *); | 2225 | /* |
2200 | extern int deny_write_access(struct file *); | 2226 | * get_write_access() gets write permission for a file. |
2227 | * put_write_access() releases this write permission. | ||
2228 | * This is used for regular files. | ||
2229 | * We cannot support write (and maybe mmap read-write shared) accesses and | ||
2230 | * MAP_DENYWRITE mmappings simultaneously. The i_writecount field of an inode | ||
2231 | * can have the following values: | ||
2232 | * 0: no writers, no VM_DENYWRITE mappings | ||
2233 | * < 0: (-i_writecount) vm_area_structs with VM_DENYWRITE set exist | ||
2234 | * > 0: (i_writecount) users are writing to the file. | ||
2235 | * | ||
2236 | * Normally we operate on that counter with atomic_{inc,dec} and it's safe | ||
2237 | * except for the cases where we don't hold i_writecount yet. Then we need to | ||
2238 | * use {get,deny}_write_access() - these functions check the sign and refuse | ||
2239 | * to do the change if sign is wrong. | ||
2240 | */ | ||
2241 | static inline int get_write_access(struct inode *inode) | ||
2242 | { | ||
2243 | return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY; | ||
2244 | } | ||
2245 | static inline int deny_write_access(struct file *file) | ||
2246 | { | ||
2247 | struct inode *inode = file->f_path.dentry->d_inode; | ||
2248 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; | ||
2249 | } | ||
2201 | static inline void put_write_access(struct inode * inode) | 2250 | static inline void put_write_access(struct inode * inode) |
2202 | { | 2251 | { |
2203 | atomic_dec(&inode->i_writecount); | 2252 | atomic_dec(&inode->i_writecount); |
@@ -2276,17 +2325,25 @@ extern void __iget(struct inode * inode); | |||
2276 | extern void iget_failed(struct inode *); | 2325 | extern void iget_failed(struct inode *); |
2277 | extern void end_writeback(struct inode *); | 2326 | extern void end_writeback(struct inode *); |
2278 | extern void __destroy_inode(struct inode *); | 2327 | extern void __destroy_inode(struct inode *); |
2279 | extern struct inode *new_inode(struct super_block *); | 2328 | extern struct inode *new_inode_pseudo(struct super_block *sb); |
2329 | extern struct inode *new_inode(struct super_block *sb); | ||
2280 | extern void free_inode_nonrcu(struct inode *inode); | 2330 | extern void free_inode_nonrcu(struct inode *inode); |
2281 | extern int should_remove_suid(struct dentry *); | 2331 | extern int should_remove_suid(struct dentry *); |
2282 | extern int file_remove_suid(struct file *); | 2332 | extern int file_remove_suid(struct file *); |
2283 | 2333 | ||
2284 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 2334 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
2285 | extern void remove_inode_hash(struct inode *); | ||
2286 | static inline void insert_inode_hash(struct inode *inode) | 2335 | static inline void insert_inode_hash(struct inode *inode) |
2287 | { | 2336 | { |
2288 | __insert_inode_hash(inode, inode->i_ino); | 2337 | __insert_inode_hash(inode, inode->i_ino); |
2289 | } | 2338 | } |
2339 | |||
2340 | extern void __remove_inode_hash(struct inode *); | ||
2341 | static inline void remove_inode_hash(struct inode *inode) | ||
2342 | { | ||
2343 | if (!inode_unhashed(inode)) | ||
2344 | __remove_inode_hash(inode); | ||
2345 | } | ||
2346 | |||
2290 | extern void inode_sb_list_add(struct inode *inode); | 2347 | extern void inode_sb_list_add(struct inode *inode); |
2291 | 2348 | ||
2292 | #ifdef CONFIG_BLOCK | 2349 | #ifdef CONFIG_BLOCK |
@@ -2317,7 +2374,8 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
2317 | /* fs/block_dev.c */ | 2374 | /* fs/block_dev.c */ |
2318 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2375 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, |
2319 | unsigned long nr_segs, loff_t pos); | 2376 | unsigned long nr_segs, loff_t pos); |
2320 | extern int blkdev_fsync(struct file *filp, int datasync); | 2377 | extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, |
2378 | int datasync); | ||
2321 | 2379 | ||
2322 | /* fs/splice.c */ | 2380 | /* fs/splice.c */ |
2323 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2381 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
@@ -2368,6 +2426,8 @@ enum { | |||
2368 | }; | 2426 | }; |
2369 | 2427 | ||
2370 | void dio_end_io(struct bio *bio, int error); | 2428 | void dio_end_io(struct bio *bio, int error); |
2429 | void inode_dio_wait(struct inode *inode); | ||
2430 | void inode_dio_done(struct inode *inode); | ||
2371 | 2431 | ||
2372 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 2432 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, |
2373 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | 2433 | struct block_device *bdev, const struct iovec *iov, loff_t offset, |
@@ -2375,14 +2435,17 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
2375 | dio_submit_t submit_io, int flags); | 2435 | dio_submit_t submit_io, int flags); |
2376 | 2436 | ||
2377 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2437 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
2378 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | 2438 | struct inode *inode, const struct iovec *iov, loff_t offset, |
2379 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | 2439 | unsigned long nr_segs, get_block_t get_block) |
2380 | dio_iodone_t end_io) | ||
2381 | { | 2440 | { |
2382 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2441 | return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
2383 | nr_segs, get_block, end_io, NULL, | 2442 | offset, nr_segs, get_block, NULL, NULL, |
2384 | DIO_LOCKING | DIO_SKIP_HOLES); | 2443 | DIO_LOCKING | DIO_SKIP_HOLES); |
2385 | } | 2444 | } |
2445 | #else | ||
2446 | static inline void inode_dio_wait(struct inode *inode) | ||
2447 | { | ||
2448 | } | ||
2386 | #endif | 2449 | #endif |
2387 | 2450 | ||
2388 | extern const struct file_operations generic_ro_fops; | 2451 | extern const struct file_operations generic_ro_fops; |
@@ -2432,6 +2495,8 @@ extern struct super_block *get_active_super(struct block_device *bdev); | |||
2432 | extern struct super_block *user_get_super(dev_t); | 2495 | extern struct super_block *user_get_super(dev_t); |
2433 | extern void drop_super(struct super_block *sb); | 2496 | extern void drop_super(struct super_block *sb); |
2434 | extern void iterate_supers(void (*)(struct super_block *, void *), void *); | 2497 | extern void iterate_supers(void (*)(struct super_block *, void *), void *); |
2498 | extern void iterate_supers_type(struct file_system_type *, | ||
2499 | void (*)(struct super_block *, void *), void *); | ||
2435 | 2500 | ||
2436 | extern int dcache_dir_open(struct inode *, struct file *); | 2501 | extern int dcache_dir_open(struct inode *, struct file *); |
2437 | extern int dcache_dir_close(struct inode *, struct file *); | 2502 | extern int dcache_dir_close(struct inode *, struct file *); |
@@ -2444,7 +2509,7 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *); | |||
2444 | extern int simple_unlink(struct inode *, struct dentry *); | 2509 | extern int simple_unlink(struct inode *, struct dentry *); |
2445 | extern int simple_rmdir(struct inode *, struct dentry *); | 2510 | extern int simple_rmdir(struct inode *, struct dentry *); |
2446 | extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | 2511 | extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); |
2447 | extern int noop_fsync(struct file *, int); | 2512 | extern int noop_fsync(struct file *, loff_t, loff_t, int); |
2448 | extern int simple_empty(struct dentry *); | 2513 | extern int simple_empty(struct dentry *); |
2449 | extern int simple_readpage(struct file *file, struct page *page); | 2514 | extern int simple_readpage(struct file *file, struct page *page); |
2450 | extern int simple_write_begin(struct file *file, struct address_space *mapping, | 2515 | extern int simple_write_begin(struct file *file, struct address_space *mapping, |
@@ -2469,7 +2534,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count, | |||
2469 | extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, | 2534 | extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, |
2470 | const void __user *from, size_t count); | 2535 | const void __user *from, size_t count); |
2471 | 2536 | ||
2472 | extern int generic_file_fsync(struct file *, int); | 2537 | extern int generic_file_fsync(struct file *, loff_t, loff_t, int); |
2473 | 2538 | ||
2474 | extern int generic_check_addressable(unsigned, u64); | 2539 | extern int generic_check_addressable(unsigned, u64); |
2475 | 2540 | ||