aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h199
1 files changed, 133 insertions, 66 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8d5834bcb89..78987e9a384 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
37struct fstrim_range { 39struct 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
@@ -159,10 +162,8 @@ struct inodes_stat_t {
159#define READA RWA_MASK 162#define READA RWA_MASK
160 163
161#define READ_SYNC (READ | REQ_SYNC) 164#define READ_SYNC (READ | REQ_SYNC)
162#define READ_META (READ | REQ_META)
163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) 165#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
164#define WRITE_ODIRECT (WRITE | REQ_SYNC) 166#define WRITE_ODIRECT (WRITE | REQ_SYNC)
165#define WRITE_META (WRITE | REQ_META)
166#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) 167#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
167#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) 168#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
168#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 169#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
@@ -376,7 +377,6 @@ struct inodes_stat_t {
376 377
377#include <linux/linkage.h> 378#include <linux/linkage.h>
378#include <linux/wait.h> 379#include <linux/wait.h>
379#include <linux/types.h>
380#include <linux/kdev_t.h> 380#include <linux/kdev_t.h>
381#include <linux/dcache.h> 381#include <linux/dcache.h>
382#include <linux/path.h> 382#include <linux/path.h>
@@ -392,8 +392,9 @@ struct inodes_stat_t {
392#include <linux/semaphore.h> 392#include <linux/semaphore.h>
393#include <linux/fiemap.h> 393#include <linux/fiemap.h>
394#include <linux/rculist_bl.h> 394#include <linux/rculist_bl.h>
395#include <linux/shrinker.h>
396#include <linux/atomic.h>
395 397
396#include <asm/atomic.h>
397#include <asm/byteorder.h> 398#include <asm/byteorder.h>
398 399
399struct export_operations; 400struct export_operations;
@@ -736,22 +737,54 @@ struct posix_acl;
736#define ACL_NOT_CACHED ((void *)(-1)) 737#define ACL_NOT_CACHED ((void *)(-1))
737struct inode_obj_id_table; 738struct inode_obj_id_table;
738 739
740#define IOP_FASTPERM 0x0001
741#define IOP_LOOKUP 0x0002
742#define IOP_NOFOLLOW 0x0004
743
744/*
745 * Keep mostly read-only and often accessed (especially for
746 * the RCU path lookup and 'stat' data) fields at the beginning
747 * of the 'struct inode'
748 */
739struct inode { 749struct inode {
740 /* RCU path lookup touches following: */
741 umode_t i_mode; 750 umode_t i_mode;
751 unsigned short i_opflags;
742 uid_t i_uid; 752 uid_t i_uid;
743 gid_t i_gid; 753 gid_t i_gid;
754 unsigned int i_flags;
755
756#ifdef CONFIG_FS_POSIX_ACL
757 struct posix_acl *i_acl;
758 struct posix_acl *i_default_acl;
759#endif
760
744 const struct inode_operations *i_op; 761 const struct inode_operations *i_op;
745 struct super_block *i_sb; 762 struct super_block *i_sb;
763 struct address_space *i_mapping;
746 764
747 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
748 unsigned int i_flags;
749 unsigned long i_state;
750#ifdef CONFIG_SECURITY 765#ifdef CONFIG_SECURITY
751 void *i_security; 766 void *i_security;
752#endif 767#endif
753 struct mutex i_mutex;
754 768
769 /* Stat data, not accessed from path walking */
770 unsigned long i_ino;
771 unsigned int i_nlink;
772 dev_t i_rdev;
773 loff_t i_size;
774 struct timespec i_atime;
775 struct timespec i_mtime;
776 struct timespec i_ctime;
777 unsigned int i_blkbits;
778 blkcnt_t i_blocks;
779
780#ifdef __NEED_I_SIZE_ORDERED
781 seqcount_t i_size_seqcount;
782#endif
783
784 /* Misc */
785 unsigned long i_state;
786 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
787 struct mutex i_mutex;
755 788
756 unsigned long dirtied_when; /* jiffies of first dirtying */ 789 unsigned long dirtied_when; /* jiffies of first dirtying */
757 790
@@ -763,25 +796,12 @@ struct inode {
763 struct list_head i_dentry; 796 struct list_head i_dentry;
764 struct rcu_head i_rcu; 797 struct rcu_head i_rcu;
765 }; 798 };
766 unsigned long i_ino;
767 atomic_t i_count; 799 atomic_t i_count;
768 unsigned int i_nlink;
769 dev_t i_rdev;
770 unsigned int i_blkbits;
771 u64 i_version; 800 u64 i_version;
772 loff_t i_size;
773#ifdef __NEED_I_SIZE_ORDERED
774 seqcount_t i_size_seqcount;
775#endif
776 struct timespec i_atime;
777 struct timespec i_mtime;
778 struct timespec i_ctime;
779 blkcnt_t i_blocks;
780 unsigned short i_bytes; 801 unsigned short i_bytes;
781 struct rw_semaphore i_alloc_sem; 802 atomic_t i_dio_count;
782 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 803 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
783 struct file_lock *i_flock; 804 struct file_lock *i_flock;
784 struct address_space *i_mapping;
785 struct address_space i_data; 805 struct address_space i_data;
786#ifdef CONFIG_QUOTA 806#ifdef CONFIG_QUOTA
787 struct dquot *i_dquot[MAXQUOTAS]; 807 struct dquot *i_dquot[MAXQUOTAS];
@@ -804,12 +824,6 @@ struct inode {
804 atomic_t i_readcount; /* struct files open RO */ 824 atomic_t i_readcount; /* struct files open RO */
805#endif 825#endif
806 atomic_t i_writecount; 826 atomic_t i_writecount;
807#ifdef CONFIG_FS_POSIX_ACL
808 struct posix_acl *i_acl;
809 struct posix_acl *i_default_acl;
810#endif
811 struct list_head i_obj_list;
812 struct mutex i_obj_mutex;
813 void *i_private; /* fs or device private pointer */ 827 void *i_private; /* fs or device private pointer */
814}; 828};
815 829
@@ -1072,12 +1086,12 @@ struct file_lock_operations {
1072}; 1086};
1073 1087
1074struct lock_manager_operations { 1088struct lock_manager_operations {
1075 int (*fl_compare_owner)(struct file_lock *, struct file_lock *); 1089 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
1076 void (*fl_notify)(struct file_lock *); /* unblock callback */ 1090 void (*lm_notify)(struct file_lock *); /* unblock callback */
1077 int (*fl_grant)(struct file_lock *, struct file_lock *, int); 1091 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
1078 void (*fl_release_private)(struct file_lock *); 1092 void (*lm_release_private)(struct file_lock *);
1079 void (*fl_break)(struct file_lock *); 1093 void (*lm_break)(struct file_lock *);
1080 int (*fl_change)(struct file_lock **, int); 1094 int (*lm_change)(struct file_lock **, int);
1081}; 1095};
1082 1096
1083struct lock_manager { 1097struct lock_manager {
@@ -1399,6 +1413,11 @@ struct super_block {
1399 struct list_head s_dentry_lru; /* unused dentry lru */ 1413 struct list_head s_dentry_lru; /* unused dentry lru */
1400 int s_nr_dentry_unused; /* # of dentry on lru */ 1414 int s_nr_dentry_unused; /* # of dentry on lru */
1401 1415
1416 /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */
1417 spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp;
1418 struct list_head s_inode_lru; /* unused inode lru */
1419 int s_nr_inodes_unused; /* # of inodes on lru */
1420
1402 struct block_device *s_bdev; 1421 struct block_device *s_bdev;
1403 struct backing_dev_info *s_bdi; 1422 struct backing_dev_info *s_bdi;
1404 struct mtd_info *s_mtd; 1423 struct mtd_info *s_mtd;
@@ -1441,8 +1460,14 @@ struct super_block {
1441 * Saved pool identifier for cleancache (-1 means none) 1460 * Saved pool identifier for cleancache (-1 means none)
1442 */ 1461 */
1443 int cleancache_poolid; 1462 int cleancache_poolid;
1463
1464 struct shrinker s_shrink; /* per-sb shrinker handle */
1444}; 1465};
1445 1466
1467/* superblock cache pruning functions */
1468extern void prune_icache_sb(struct super_block *sb, int nr_to_scan);
1469extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan);
1470
1446extern struct timespec current_fs_time(struct super_block *sb); 1471extern struct timespec current_fs_time(struct super_block *sb);
1447 1472
1448/* 1473/*
@@ -1457,10 +1482,6 @@ enum {
1457#define vfs_check_frozen(sb, level) \ 1482#define vfs_check_frozen(sb, level) \
1458 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 1483 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
1459 1484
1460#define get_fs_excl() atomic_inc(&current->fs_excl)
1461#define put_fs_excl() atomic_dec(&current->fs_excl)
1462#define has_fs_excl() atomic_read(&current->fs_excl)
1463
1464/* 1485/*
1465 * until VFS tracks user namespaces for inodes, just make all files 1486 * until VFS tracks user namespaces for inodes, just make all files
1466 * belong to init_user_ns 1487 * belong to init_user_ns
@@ -1493,7 +1514,6 @@ extern void dentry_unhash(struct dentry *dentry);
1493/* 1514/*
1494 * VFS file helper functions. 1515 * VFS file helper functions.
1495 */ 1516 */
1496extern int file_permission(struct file *, int);
1497extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1517extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1498 mode_t mode); 1518 mode_t mode);
1499/* 1519/*
@@ -1541,11 +1561,6 @@ struct block_device_operations;
1541#define HAVE_COMPAT_IOCTL 1 1561#define HAVE_COMPAT_IOCTL 1
1542#define HAVE_UNLOCKED_IOCTL 1 1562#define HAVE_UNLOCKED_IOCTL 1
1543 1563
1544/*
1545 * NOTE:
1546 * all file operations except setlease can be called without
1547 * the big kernel lock held in all filesystems.
1548 */
1549struct file_operations { 1564struct file_operations {
1550 struct module *owner; 1565 struct module *owner;
1551 loff_t (*llseek) (struct file *, loff_t, int); 1566 loff_t (*llseek) (struct file *, loff_t, int);
@@ -1561,7 +1576,7 @@ struct file_operations {
1561 int (*open) (struct inode *, struct file *); 1576 int (*open) (struct inode *, struct file *);
1562 int (*flush) (struct file *, fl_owner_t id); 1577 int (*flush) (struct file *, fl_owner_t id);
1563 int (*release) (struct inode *, struct file *); 1578 int (*release) (struct inode *, struct file *);
1564 int (*fsync) (struct file *, int datasync); 1579 int (*fsync) (struct file *, loff_t, loff_t, int datasync);
1565 int (*aio_fsync) (struct kiocb *, int datasync); 1580 int (*aio_fsync) (struct kiocb *, int datasync);
1566 int (*fasync) (int, struct file *, int); 1581 int (*fasync) (int, struct file *, int);
1567 int (*lock) (struct file *, int, struct file_lock *); 1582 int (*lock) (struct file *, int, struct file_lock *);
@@ -1576,13 +1591,11 @@ struct file_operations {
1576 loff_t len); 1591 loff_t len);
1577}; 1592};
1578 1593
1579#define IPERM_FLAG_RCU 0x0001
1580
1581struct inode_operations { 1594struct inode_operations {
1582 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1595 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1583 void * (*follow_link) (struct dentry *, struct nameidata *); 1596 void * (*follow_link) (struct dentry *, struct nameidata *);
1584 int (*permission) (struct inode *, int, unsigned int); 1597 int (*permission) (struct inode *, int);
1585 int (*check_acl)(struct inode *, int, unsigned int); 1598 struct posix_acl * (*get_acl)(struct inode *, int);
1586 1599
1587 int (*readlink) (struct dentry *, char __user *,int); 1600 int (*readlink) (struct dentry *, char __user *,int);
1588 void (*put_link) (struct dentry *, struct nameidata *, void *); 1601 void (*put_link) (struct dentry *, struct nameidata *, void *);
@@ -1648,6 +1661,8 @@ struct super_operations {
1648 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1661 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1649#endif 1662#endif
1650 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1663 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1664 int (*nr_cached_objects)(struct super_block *);
1665 void (*free_cached_objects)(struct super_block *, int);
1651}; 1666};
1652 1667
1653/* 1668/*
@@ -1696,6 +1711,10 @@ struct super_operations {
1696 * set during data writeback, and cleared with a wakeup 1711 * set during data writeback, and cleared with a wakeup
1697 * on the bit address once it is done. 1712 * on the bit address once it is done.
1698 * 1713 *
1714 * I_REFERENCED Marks the inode as recently references on the LRU list.
1715 *
1716 * I_DIO_WAKEUP Never set. Only used as a key for wait_on_bit().
1717 *
1699 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1718 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1700 */ 1719 */
1701#define I_DIRTY_SYNC (1 << 0) 1720#define I_DIRTY_SYNC (1 << 0)
@@ -1709,6 +1728,8 @@ struct super_operations {
1709#define __I_SYNC 7 1728#define __I_SYNC 7
1710#define I_SYNC (1 << __I_SYNC) 1729#define I_SYNC (1 << __I_SYNC)
1711#define I_REFERENCED (1 << 8) 1730#define I_REFERENCED (1 << 8)
1731#define __I_DIO_WAKEUP 9
1732#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP)
1712 1733
1713#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1734#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1714 1735
@@ -1819,7 +1840,6 @@ struct file_system_type {
1819 struct lock_class_key i_lock_key; 1840 struct lock_class_key i_lock_key;
1820 struct lock_class_key i_mutex_key; 1841 struct lock_class_key i_mutex_key;
1821 struct lock_class_key i_mutex_dir_key; 1842 struct lock_class_key i_mutex_dir_key;
1822 struct lock_class_key i_alloc_sem_key;
1823}; 1843};
1824 1844
1825extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, 1845extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
@@ -1840,6 +1860,8 @@ void kill_litter_super(struct super_block *sb);
1840void deactivate_super(struct super_block *sb); 1860void deactivate_super(struct super_block *sb);
1841void deactivate_locked_super(struct super_block *sb); 1861void deactivate_locked_super(struct super_block *sb);
1842int set_anon_super(struct super_block *s, void *data); 1862int set_anon_super(struct super_block *s, void *data);
1863int get_anon_bdev(dev_t *);
1864void free_anon_bdev(dev_t);
1843struct super_block *sget(struct file_system_type *type, 1865struct super_block *sget(struct file_system_type *type,
1844 int (*test)(struct super_block *,void *), 1866 int (*test)(struct super_block *,void *),
1845 int (*set)(struct super_block *,void *), 1867 int (*set)(struct super_block *,void *),
@@ -1872,6 +1894,7 @@ extern int register_filesystem(struct file_system_type *);
1872extern int unregister_filesystem(struct file_system_type *); 1894extern int unregister_filesystem(struct file_system_type *);
1873extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); 1895extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1874#define kern_mount(type) kern_mount_data(type, NULL) 1896#define kern_mount(type) kern_mount_data(type, NULL)
1897extern void kern_unmount(struct vfsmount *mnt);
1875extern int may_umount_tree(struct vfsmount *); 1898extern int may_umount_tree(struct vfsmount *);
1876extern int may_umount(struct vfsmount *); 1899extern int may_umount(struct vfsmount *);
1877extern long do_mount(char *, char *, char *, unsigned long, void *); 1900extern long do_mount(char *, char *, char *, unsigned long, void *);
@@ -1885,6 +1908,7 @@ extern int fd_statfs(int, struct kstatfs *);
1885extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1908extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1886extern int freeze_super(struct super_block *super); 1909extern int freeze_super(struct super_block *super);
1887extern int thaw_super(struct super_block *super); 1910extern int thaw_super(struct super_block *super);
1911extern bool our_mnt(struct vfsmount *mnt);
1888 1912
1889extern int current_umask(void); 1913extern int current_umask(void);
1890 1914
@@ -2191,16 +2215,38 @@ extern sector_t bmap(struct inode *, sector_t);
2191#endif 2215#endif
2192extern int notify_change(struct dentry *, struct iattr *); 2216extern int notify_change(struct dentry *, struct iattr *);
2193extern int inode_permission(struct inode *, int); 2217extern int inode_permission(struct inode *, int);
2194extern int generic_permission(struct inode *, int, unsigned int, 2218extern int generic_permission(struct inode *, int);
2195 int (*check_acl)(struct inode *, int, unsigned int));
2196 2219
2197static inline bool execute_ok(struct inode *inode) 2220static inline bool execute_ok(struct inode *inode)
2198{ 2221{
2199 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2222 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2200} 2223}
2201 2224
2202extern int get_write_access(struct inode *); 2225/*
2203extern 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 */
2241static inline int get_write_access(struct inode *inode)
2242{
2243 return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
2244}
2245static 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}
2204static inline void put_write_access(struct inode * inode) 2250static inline void put_write_access(struct inode * inode)
2205{ 2251{
2206 atomic_dec(&inode->i_writecount); 2252 atomic_dec(&inode->i_writecount);
@@ -2272,6 +2318,11 @@ extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*te
2272extern struct inode * iget_locked(struct super_block *, unsigned long); 2318extern struct inode * iget_locked(struct super_block *, unsigned long);
2273extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); 2319extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *);
2274extern int insert_inode_locked(struct inode *); 2320extern int insert_inode_locked(struct inode *);
2321#ifdef CONFIG_DEBUG_LOCK_ALLOC
2322extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
2323#else
2324static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
2325#endif
2275extern void unlock_new_inode(struct inode *); 2326extern void unlock_new_inode(struct inode *);
2276extern unsigned int get_next_ino(void); 2327extern unsigned int get_next_ino(void);
2277 2328
@@ -2279,17 +2330,25 @@ extern void __iget(struct inode * inode);
2279extern void iget_failed(struct inode *); 2330extern void iget_failed(struct inode *);
2280extern void end_writeback(struct inode *); 2331extern void end_writeback(struct inode *);
2281extern void __destroy_inode(struct inode *); 2332extern void __destroy_inode(struct inode *);
2282extern struct inode *new_inode(struct super_block *); 2333extern struct inode *new_inode_pseudo(struct super_block *sb);
2334extern struct inode *new_inode(struct super_block *sb);
2283extern void free_inode_nonrcu(struct inode *inode); 2335extern void free_inode_nonrcu(struct inode *inode);
2284extern int should_remove_suid(struct dentry *); 2336extern int should_remove_suid(struct dentry *);
2285extern int file_remove_suid(struct file *); 2337extern int file_remove_suid(struct file *);
2286 2338
2287extern void __insert_inode_hash(struct inode *, unsigned long hashval); 2339extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2288extern void remove_inode_hash(struct inode *);
2289static inline void insert_inode_hash(struct inode *inode) 2340static inline void insert_inode_hash(struct inode *inode)
2290{ 2341{
2291 __insert_inode_hash(inode, inode->i_ino); 2342 __insert_inode_hash(inode, inode->i_ino);
2292} 2343}
2344
2345extern void __remove_inode_hash(struct inode *);
2346static inline void remove_inode_hash(struct inode *inode)
2347{
2348 if (!inode_unhashed(inode))
2349 __remove_inode_hash(inode);
2350}
2351
2293extern void inode_sb_list_add(struct inode *inode); 2352extern void inode_sb_list_add(struct inode *inode);
2294 2353
2295#ifdef CONFIG_BLOCK 2354#ifdef CONFIG_BLOCK
@@ -2320,7 +2379,8 @@ extern int generic_segment_checks(const struct iovec *iov,
2320/* fs/block_dev.c */ 2379/* fs/block_dev.c */
2321extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2380extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2322 unsigned long nr_segs, loff_t pos); 2381 unsigned long nr_segs, loff_t pos);
2323extern int blkdev_fsync(struct file *filp, int datasync); 2382extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2383 int datasync);
2324 2384
2325/* fs/splice.c */ 2385/* fs/splice.c */
2326extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2386extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2371,6 +2431,8 @@ enum {
2371}; 2431};
2372 2432
2373void dio_end_io(struct bio *bio, int error); 2433void dio_end_io(struct bio *bio, int error);
2434void inode_dio_wait(struct inode *inode);
2435void inode_dio_done(struct inode *inode);
2374 2436
2375ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2437ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2376 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2438 struct block_device *bdev, const struct iovec *iov, loff_t offset,
@@ -2378,14 +2440,17 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2378 dio_submit_t submit_io, int flags); 2440 dio_submit_t submit_io, int flags);
2379 2441
2380static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2442static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2381 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2443 struct inode *inode, const struct iovec *iov, loff_t offset,
2382 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2444 unsigned long nr_segs, get_block_t get_block)
2383 dio_iodone_t end_io)
2384{ 2445{
2385 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2446 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
2386 nr_segs, get_block, end_io, NULL, 2447 offset, nr_segs, get_block, NULL, NULL,
2387 DIO_LOCKING | DIO_SKIP_HOLES); 2448 DIO_LOCKING | DIO_SKIP_HOLES);
2388} 2449}
2450#else
2451static inline void inode_dio_wait(struct inode *inode)
2452{
2453}
2389#endif 2454#endif
2390 2455
2391extern const struct file_operations generic_ro_fops; 2456extern const struct file_operations generic_ro_fops;
@@ -2435,6 +2500,8 @@ extern struct super_block *get_active_super(struct block_device *bdev);
2435extern struct super_block *user_get_super(dev_t); 2500extern struct super_block *user_get_super(dev_t);
2436extern void drop_super(struct super_block *sb); 2501extern void drop_super(struct super_block *sb);
2437extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2502extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2503extern void iterate_supers_type(struct file_system_type *,
2504 void (*)(struct super_block *, void *), void *);
2438 2505
2439extern int dcache_dir_open(struct inode *, struct file *); 2506extern int dcache_dir_open(struct inode *, struct file *);
2440extern int dcache_dir_close(struct inode *, struct file *); 2507extern int dcache_dir_close(struct inode *, struct file *);
@@ -2447,7 +2514,7 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2447extern int simple_unlink(struct inode *, struct dentry *); 2514extern int simple_unlink(struct inode *, struct dentry *);
2448extern int simple_rmdir(struct inode *, struct dentry *); 2515extern int simple_rmdir(struct inode *, struct dentry *);
2449extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2516extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2450extern int noop_fsync(struct file *, int); 2517extern int noop_fsync(struct file *, loff_t, loff_t, int);
2451extern int simple_empty(struct dentry *); 2518extern int simple_empty(struct dentry *);
2452extern int simple_readpage(struct file *file, struct page *page); 2519extern int simple_readpage(struct file *file, struct page *page);
2453extern int simple_write_begin(struct file *file, struct address_space *mapping, 2520extern int simple_write_begin(struct file *file, struct address_space *mapping,
@@ -2472,7 +2539,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2472extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, 2539extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2473 const void __user *from, size_t count); 2540 const void __user *from, size_t count);
2474 2541
2475extern int generic_file_fsync(struct file *, int); 2542extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
2476 2543
2477extern int generic_check_addressable(unsigned, u64); 2544extern int generic_check_addressable(unsigned, u64);
2478 2545