diff options
Diffstat (limited to 'include/linux/fs.h')
| -rw-r--r-- | include/linux/fs.h | 156 |
1 files changed, 102 insertions, 54 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 9a96b4d83fc1..334d68a17108 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/limits.h> | 9 | #include <linux/limits.h> |
| 10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
| 11 | #include <linux/blk_types.h> | 11 | #include <linux/blk_types.h> |
| 12 | #include <linux/types.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 15 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change |
| @@ -32,11 +33,17 @@ | |||
| 32 | #define SEEK_END 2 /* seek relative to end of file */ | 33 | #define SEEK_END 2 /* seek relative to end of file */ |
| 33 | #define SEEK_MAX SEEK_END | 34 | #define SEEK_MAX SEEK_END |
| 34 | 35 | ||
| 36 | struct fstrim_range { | ||
| 37 | uint64_t start; | ||
| 38 | uint64_t len; | ||
| 39 | uint64_t minlen; | ||
| 40 | }; | ||
| 41 | |||
| 35 | /* And dynamically-tunable limits and defaults: */ | 42 | /* And dynamically-tunable limits and defaults: */ |
| 36 | struct files_stat_struct { | 43 | struct files_stat_struct { |
| 37 | int nr_files; /* read only */ | 44 | unsigned long nr_files; /* read only */ |
| 38 | int nr_free_files; /* read only */ | 45 | unsigned long nr_free_files; /* read only */ |
| 39 | int max_files; /* tunable */ | 46 | unsigned long max_files; /* tunable */ |
| 40 | }; | 47 | }; |
| 41 | 48 | ||
| 42 | struct inodes_stat_t { | 49 | struct inodes_stat_t { |
| @@ -92,6 +99,9 @@ struct inodes_stat_t { | |||
| 92 | /* Expect random access pattern */ | 99 | /* Expect random access pattern */ |
| 93 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | 100 | #define FMODE_RANDOM ((__force fmode_t)0x1000) |
| 94 | 101 | ||
| 102 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | ||
| 103 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | ||
| 104 | |||
| 95 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 105 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
| 96 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 106 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
| 97 | 107 | ||
| @@ -125,9 +135,6 @@ struct inodes_stat_t { | |||
| 125 | * block layer could (in theory) choose to ignore this | 135 | * block layer could (in theory) choose to ignore this |
| 126 | * request if it runs into resource problems. | 136 | * request if it runs into resource problems. |
| 127 | * WRITE A normal async write. Device will be plugged. | 137 | * WRITE A normal async write. Device will be plugged. |
| 128 | * SWRITE Like WRITE, but a special case for ll_rw_block() that | ||
| 129 | * tells it to lock the buffer first. Normally a buffer | ||
| 130 | * must be locked before doing IO. | ||
| 131 | * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down | 138 | * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down |
| 132 | * the hint that someone will be waiting on this IO | 139 | * the hint that someone will be waiting on this IO |
| 133 | * shortly. The device must still be unplugged explicitly, | 140 | * shortly. The device must still be unplugged explicitly, |
| @@ -138,15 +145,12 @@ struct inodes_stat_t { | |||
| 138 | * immediately after submission. The write equivalent | 145 | * immediately after submission. The write equivalent |
| 139 | * of READ_SYNC. | 146 | * of READ_SYNC. |
| 140 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. | 147 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. |
| 141 | * SWRITE_SYNC | 148 | * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. |
| 142 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 149 | * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on |
| 143 | * See SWRITE. | 150 | * non-volatile media on completion. |
| 144 | * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all | 151 | * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded |
| 145 | * previously submitted writes must be safely on storage | 152 | * by a cache flush and data is guaranteed to be on |
| 146 | * before this one is started. Also guarantees that when | 153 | * non-volatile media on completion. |
| 147 | * this write is complete, it itself is also safely on | ||
| 148 | * storage. Prevents reordering of writes on both sides | ||
| 149 | * of this IO. | ||
| 150 | * | 154 | * |
| 151 | */ | 155 | */ |
| 152 | #define RW_MASK REQ_WRITE | 156 | #define RW_MASK REQ_WRITE |
| @@ -155,7 +159,6 @@ struct inodes_stat_t { | |||
| 155 | #define READ 0 | 159 | #define READ 0 |
| 156 | #define WRITE RW_MASK | 160 | #define WRITE RW_MASK |
| 157 | #define READA RWA_MASK | 161 | #define READA RWA_MASK |
| 158 | #define SWRITE (WRITE | READA) | ||
| 159 | 162 | ||
| 160 | #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) | 163 | #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) |
| 161 | #define READ_META (READ | REQ_META) | 164 | #define READ_META (READ | REQ_META) |
| @@ -163,18 +166,12 @@ struct inodes_stat_t { | |||
| 163 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) | 166 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) |
| 164 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) | 167 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) |
| 165 | #define WRITE_META (WRITE | REQ_META) | 168 | #define WRITE_META (WRITE | REQ_META) |
| 166 | #define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ | 169 | #define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ |
| 167 | REQ_HARDBARRIER) | 170 | REQ_FLUSH) |
| 168 | #define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE) | 171 | #define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ |
| 169 | #define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) | 172 | REQ_FUA) |
| 170 | 173 | #define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ | |
| 171 | /* | 174 | REQ_FLUSH | REQ_FUA) |
| 172 | * These aren't really reads or writes, they pass down information about | ||
| 173 | * parts of device that are now unused by the file system. | ||
| 174 | */ | ||
| 175 | #define DISCARD_NOBARRIER (WRITE | REQ_DISCARD) | ||
| 176 | #define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER) | ||
| 177 | #define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE) | ||
| 178 | 175 | ||
| 179 | #define SEL_IN 1 | 176 | #define SEL_IN 1 |
| 180 | #define SEL_OUT 2 | 177 | #define SEL_OUT 2 |
| @@ -244,6 +241,7 @@ struct inodes_stat_t { | |||
| 244 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ | 241 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ |
| 245 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ | 242 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
| 246 | #define S_PRIVATE 512 /* Inode is fs-internal */ | 243 | #define S_PRIVATE 512 /* Inode is fs-internal */ |
| 244 | #define S_IMA 1024 /* Inode has an associated IMA struct */ | ||
| 247 | 245 | ||
| 248 | /* | 246 | /* |
| 249 | * Note that nosuid etc flags are inode-specific: setting some file-system | 247 | * Note that nosuid etc flags are inode-specific: setting some file-system |
| @@ -278,6 +276,7 @@ struct inodes_stat_t { | |||
| 278 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) | 276 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
| 279 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) | 277 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) |
| 280 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) | 278 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) |
| 279 | #define IS_IMA(inode) ((inode)->i_flags & S_IMA) | ||
| 281 | 280 | ||
| 282 | /* the read-only stuff doesn't really belong here, but any other place is | 281 | /* the read-only stuff doesn't really belong here, but any other place is |
| 283 | probably as bad and I don't want to create yet another include file. */ | 282 | probably as bad and I don't want to create yet another include file. */ |
| @@ -325,6 +324,7 @@ struct inodes_stat_t { | |||
| 325 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ | 324 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ |
| 326 | #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ | 325 | #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ |
| 327 | #define FITHAW _IOWR('X', 120, int) /* Thaw */ | 326 | #define FITHAW _IOWR('X', 120, int) /* Thaw */ |
| 327 | #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ | ||
| 328 | 328 | ||
| 329 | #define FS_IOC_GETFLAGS _IOR('f', 1, long) | 329 | #define FS_IOC_GETFLAGS _IOR('f', 1, long) |
| 330 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) | 330 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
| @@ -413,7 +413,7 @@ extern void __init inode_init_early(void); | |||
| 413 | extern void __init files_init(unsigned long); | 413 | extern void __init files_init(unsigned long); |
| 414 | 414 | ||
| 415 | extern struct files_stat_struct files_stat; | 415 | extern struct files_stat_struct files_stat; |
| 416 | extern int get_max_files(void); | 416 | extern unsigned long get_max_files(void); |
| 417 | extern int sysctl_nr_open; | 417 | extern int sysctl_nr_open; |
| 418 | extern struct inodes_stat_t inodes_stat; | 418 | extern struct inodes_stat_t inodes_stat; |
| 419 | extern int leases_enable, lease_break_time; | 419 | extern int leases_enable, lease_break_time; |
| @@ -733,7 +733,8 @@ struct posix_acl; | |||
| 733 | 733 | ||
| 734 | struct inode { | 734 | struct inode { |
| 735 | struct hlist_node i_hash; | 735 | struct hlist_node i_hash; |
| 736 | struct list_head i_list; /* backing dev IO list */ | 736 | struct list_head i_wb_list; /* backing dev IO list */ |
| 737 | struct list_head i_lru; /* inode LRU list */ | ||
| 737 | struct list_head i_sb_list; | 738 | struct list_head i_sb_list; |
| 738 | struct list_head i_dentry; | 739 | struct list_head i_dentry; |
| 739 | unsigned long i_ino; | 740 | unsigned long i_ino; |
| @@ -785,6 +786,10 @@ struct inode { | |||
| 785 | 786 | ||
| 786 | unsigned int i_flags; | 787 | unsigned int i_flags; |
| 787 | 788 | ||
| 789 | #ifdef CONFIG_IMA | ||
| 790 | /* protected by i_lock */ | ||
| 791 | unsigned int i_readcount; /* struct files open RO */ | ||
| 792 | #endif | ||
| 788 | atomic_t i_writecount; | 793 | atomic_t i_writecount; |
| 789 | #ifdef CONFIG_SECURITY | 794 | #ifdef CONFIG_SECURITY |
| 790 | void *i_security; | 795 | void *i_security; |
| @@ -796,6 +801,11 @@ struct inode { | |||
| 796 | void *i_private; /* fs or device private pointer */ | 801 | void *i_private; /* fs or device private pointer */ |
| 797 | }; | 802 | }; |
| 798 | 803 | ||
| 804 | static inline int inode_unhashed(struct inode *inode) | ||
| 805 | { | ||
| 806 | return hlist_unhashed(&inode->i_hash); | ||
| 807 | } | ||
| 808 | |||
| 799 | /* | 809 | /* |
| 800 | * inode->i_mutex nesting subclasses for the lock validator: | 810 | * inode->i_mutex nesting subclasses for the lock validator: |
| 801 | * | 811 | * |
| @@ -929,6 +939,9 @@ struct file { | |||
| 929 | #define f_vfsmnt f_path.mnt | 939 | #define f_vfsmnt f_path.mnt |
| 930 | const struct file_operations *f_op; | 940 | const struct file_operations *f_op; |
| 931 | spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ | 941 | spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ |
| 942 | #ifdef CONFIG_SMP | ||
| 943 | int f_sb_list_cpu; | ||
| 944 | #endif | ||
| 932 | atomic_long_t f_count; | 945 | atomic_long_t f_count; |
| 933 | unsigned int f_flags; | 946 | unsigned int f_flags; |
| 934 | fmode_t f_mode; | 947 | fmode_t f_mode; |
| @@ -953,9 +966,6 @@ struct file { | |||
| 953 | unsigned long f_mnt_write_state; | 966 | unsigned long f_mnt_write_state; |
| 954 | #endif | 967 | #endif |
| 955 | }; | 968 | }; |
| 956 | extern spinlock_t files_lock; | ||
| 957 | #define file_list_lock() spin_lock(&files_lock); | ||
| 958 | #define file_list_unlock() spin_unlock(&files_lock); | ||
| 959 | 969 | ||
| 960 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 970 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
| 961 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 971 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
| @@ -1046,7 +1056,6 @@ struct lock_manager_operations { | |||
| 1046 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); | 1056 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); |
| 1047 | void (*fl_notify)(struct file_lock *); /* unblock callback */ | 1057 | void (*fl_notify)(struct file_lock *); /* unblock callback */ |
| 1048 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); | 1058 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); |
| 1049 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); | ||
| 1050 | void (*fl_release_private)(struct file_lock *); | 1059 | void (*fl_release_private)(struct file_lock *); |
| 1051 | void (*fl_break)(struct file_lock *); | 1060 | void (*fl_break)(struct file_lock *); |
| 1052 | int (*fl_mylease)(struct file_lock *, struct file_lock *); | 1061 | int (*fl_mylease)(struct file_lock *, struct file_lock *); |
| @@ -1119,7 +1128,9 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | |||
| 1119 | extern int fcntl_getlease(struct file *filp); | 1128 | extern int fcntl_getlease(struct file *filp); |
| 1120 | 1129 | ||
| 1121 | /* fs/locks.c */ | 1130 | /* fs/locks.c */ |
| 1131 | void locks_free_lock(struct file_lock *fl); | ||
| 1122 | extern void locks_init_lock(struct file_lock *); | 1132 | extern void locks_init_lock(struct file_lock *); |
| 1133 | extern struct file_lock * locks_alloc_lock(void); | ||
| 1123 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1134 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
| 1124 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); | 1135 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); |
| 1125 | extern void locks_remove_posix(struct file *, fl_owner_t); | 1136 | extern void locks_remove_posix(struct file *, fl_owner_t); |
| @@ -1140,6 +1151,8 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
| 1140 | extern int lease_modify(struct file_lock **, int); | 1151 | extern int lease_modify(struct file_lock **, int); |
| 1141 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1152 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
| 1142 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1153 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
| 1154 | extern void lock_flocks(void); | ||
| 1155 | extern void unlock_flocks(void); | ||
| 1143 | #else /* !CONFIG_FILE_LOCKING */ | 1156 | #else /* !CONFIG_FILE_LOCKING */ |
| 1144 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) | 1157 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
| 1145 | { | 1158 | { |
| @@ -1282,6 +1295,14 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
| 1282 | return 1; | 1295 | return 1; |
| 1283 | } | 1296 | } |
| 1284 | 1297 | ||
| 1298 | static inline void lock_flocks(void) | ||
| 1299 | { | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | static inline void unlock_flocks(void) | ||
| 1303 | { | ||
| 1304 | } | ||
| 1305 | |||
| 1285 | #endif /* !CONFIG_FILE_LOCKING */ | 1306 | #endif /* !CONFIG_FILE_LOCKING */ |
| 1286 | 1307 | ||
| 1287 | 1308 | ||
| @@ -1298,6 +1319,11 @@ struct fasync_struct { | |||
| 1298 | 1319 | ||
| 1299 | /* SMP safe fasync helpers: */ | 1320 | /* SMP safe fasync helpers: */ |
| 1300 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); | 1321 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); |
| 1322 | extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *); | ||
| 1323 | extern int fasync_remove_entry(struct file *, struct fasync_struct **); | ||
| 1324 | extern struct fasync_struct *fasync_alloc(void); | ||
| 1325 | extern void fasync_free(struct fasync_struct *); | ||
| 1326 | |||
| 1301 | /* can be called from interrupts */ | 1327 | /* can be called from interrupts */ |
| 1302 | extern void kill_fasync(struct fasync_struct **, int, int); | 1328 | extern void kill_fasync(struct fasync_struct **, int, int); |
| 1303 | 1329 | ||
| @@ -1346,7 +1372,11 @@ struct super_block { | |||
| 1346 | 1372 | ||
| 1347 | struct list_head s_inodes; /* all inodes */ | 1373 | struct list_head s_inodes; /* all inodes */ |
| 1348 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1374 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ |
| 1375 | #ifdef CONFIG_SMP | ||
| 1376 | struct list_head __percpu *s_files; | ||
| 1377 | #else | ||
| 1349 | struct list_head s_files; | 1378 | struct list_head s_files; |
| 1379 | #endif | ||
| 1350 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ | 1380 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ |
| 1351 | struct list_head s_dentry_lru; /* unused dentry lru */ | 1381 | struct list_head s_dentry_lru; /* unused dentry lru */ |
| 1352 | int s_nr_dentry_unused; /* # of dentry on lru */ | 1382 | int s_nr_dentry_unused; /* # of dentry on lru */ |
| @@ -1385,7 +1415,7 @@ struct super_block { | |||
| 1385 | * Saved mount options for lazy filesystems using | 1415 | * Saved mount options for lazy filesystems using |
| 1386 | * generic_show_options() | 1416 | * generic_show_options() |
| 1387 | */ | 1417 | */ |
| 1388 | char *s_options; | 1418 | char __rcu *s_options; |
| 1389 | }; | 1419 | }; |
| 1390 | 1420 | ||
| 1391 | extern struct timespec current_fs_time(struct super_block *sb); | 1421 | extern struct timespec current_fs_time(struct super_block *sb); |
| @@ -1582,6 +1612,7 @@ struct super_operations { | |||
| 1582 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); | 1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
| 1583 | #endif | 1613 | #endif |
| 1584 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); | 1614 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); |
| 1615 | int (*trim_fs) (struct super_block *, struct fstrim_range *); | ||
| 1585 | }; | 1616 | }; |
| 1586 | 1617 | ||
| 1587 | /* | 1618 | /* |
| @@ -1632,16 +1663,17 @@ struct super_operations { | |||
| 1632 | * | 1663 | * |
| 1633 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1664 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
| 1634 | */ | 1665 | */ |
| 1635 | #define I_DIRTY_SYNC 1 | 1666 | #define I_DIRTY_SYNC (1 << 0) |
| 1636 | #define I_DIRTY_DATASYNC 2 | 1667 | #define I_DIRTY_DATASYNC (1 << 1) |
| 1637 | #define I_DIRTY_PAGES 4 | 1668 | #define I_DIRTY_PAGES (1 << 2) |
| 1638 | #define __I_NEW 3 | 1669 | #define __I_NEW 3 |
| 1639 | #define I_NEW (1 << __I_NEW) | 1670 | #define I_NEW (1 << __I_NEW) |
| 1640 | #define I_WILL_FREE 16 | 1671 | #define I_WILL_FREE (1 << 4) |
| 1641 | #define I_FREEING 32 | 1672 | #define I_FREEING (1 << 5) |
| 1642 | #define I_CLEAR 64 | 1673 | #define I_CLEAR (1 << 6) |
| 1643 | #define __I_SYNC 7 | 1674 | #define __I_SYNC 7 |
| 1644 | #define I_SYNC (1 << __I_SYNC) | 1675 | #define I_SYNC (1 << __I_SYNC) |
| 1676 | #define I_REFERENCED (1 << 8) | ||
| 1645 | 1677 | ||
| 1646 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1678 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
| 1647 | 1679 | ||
| @@ -1733,12 +1765,15 @@ static inline void file_accessed(struct file *file) | |||
| 1733 | } | 1765 | } |
| 1734 | 1766 | ||
| 1735 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 1767 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
| 1768 | int sync_inode_metadata(struct inode *inode, int wait); | ||
| 1736 | 1769 | ||
| 1737 | struct file_system_type { | 1770 | struct file_system_type { |
| 1738 | const char *name; | 1771 | const char *name; |
| 1739 | int fs_flags; | 1772 | int fs_flags; |
| 1740 | int (*get_sb) (struct file_system_type *, int, | 1773 | int (*get_sb) (struct file_system_type *, int, |
| 1741 | const char *, void *, struct vfsmount *); | 1774 | const char *, void *, struct vfsmount *); |
| 1775 | struct dentry *(*mount) (struct file_system_type *, int, | ||
| 1776 | const char *, void *); | ||
| 1742 | void (*kill_sb) (struct super_block *); | 1777 | void (*kill_sb) (struct super_block *); |
| 1743 | struct module *owner; | 1778 | struct module *owner; |
| 1744 | struct file_system_type * next; | 1779 | struct file_system_type * next; |
| @@ -1754,17 +1789,25 @@ struct file_system_type { | |||
| 1754 | struct lock_class_key i_alloc_sem_key; | 1789 | struct lock_class_key i_alloc_sem_key; |
| 1755 | }; | 1790 | }; |
| 1756 | 1791 | ||
| 1757 | extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, | 1792 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, |
| 1758 | int (*fill_super)(struct super_block *, void *, int), | 1793 | void *data, int (*fill_super)(struct super_block *, void *, int)); |
| 1759 | struct vfsmount *mnt); | 1794 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, |
| 1795 | int flags, const char *dev_name, void *data, | ||
| 1796 | int (*fill_super)(struct super_block *, void *, int)); | ||
| 1760 | extern int get_sb_bdev(struct file_system_type *fs_type, | 1797 | extern int get_sb_bdev(struct file_system_type *fs_type, |
| 1761 | int flags, const char *dev_name, void *data, | 1798 | int flags, const char *dev_name, void *data, |
| 1762 | int (*fill_super)(struct super_block *, void *, int), | 1799 | int (*fill_super)(struct super_block *, void *, int), |
| 1763 | struct vfsmount *mnt); | 1800 | struct vfsmount *mnt); |
| 1801 | extern struct dentry *mount_single(struct file_system_type *fs_type, | ||
| 1802 | int flags, void *data, | ||
| 1803 | int (*fill_super)(struct super_block *, void *, int)); | ||
| 1764 | extern int get_sb_single(struct file_system_type *fs_type, | 1804 | extern int get_sb_single(struct file_system_type *fs_type, |
| 1765 | int flags, void *data, | 1805 | int flags, void *data, |
| 1766 | int (*fill_super)(struct super_block *, void *, int), | 1806 | int (*fill_super)(struct super_block *, void *, int), |
| 1767 | struct vfsmount *mnt); | 1807 | struct vfsmount *mnt); |
| 1808 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, | ||
| 1809 | int flags, void *data, | ||
| 1810 | int (*fill_super)(struct super_block *, void *, int)); | ||
| 1768 | extern int get_sb_nodev(struct file_system_type *fs_type, | 1811 | extern int get_sb_nodev(struct file_system_type *fs_type, |
| 1769 | int flags, void *data, | 1812 | int flags, void *data, |
| 1770 | int (*fill_super)(struct super_block *, void *, int), | 1813 | int (*fill_super)(struct super_block *, void *, int), |
| @@ -1780,9 +1823,8 @@ struct super_block *sget(struct file_system_type *type, | |||
| 1780 | int (*test)(struct super_block *,void *), | 1823 | int (*test)(struct super_block *,void *), |
| 1781 | int (*set)(struct super_block *,void *), | 1824 | int (*set)(struct super_block *,void *), |
| 1782 | void *data); | 1825 | void *data); |
| 1783 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1826 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, |
| 1784 | const struct super_operations *ops, unsigned long, | 1827 | const struct super_operations *ops, unsigned long); |
| 1785 | struct vfsmount *mnt); | ||
| 1786 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1828 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
| 1787 | 1829 | ||
| 1788 | static inline void sb_mark_dirty(struct super_block *sb) | 1830 | static inline void sb_mark_dirty(struct super_block *sb) |
| @@ -1825,6 +1867,7 @@ extern int current_umask(void); | |||
| 1825 | /* /sys/fs */ | 1867 | /* /sys/fs */ |
| 1826 | extern struct kobject *fs_kobj; | 1868 | extern struct kobject *fs_kobj; |
| 1827 | 1869 | ||
| 1870 | #define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) | ||
| 1828 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | 1871 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); |
| 1829 | 1872 | ||
| 1830 | #define FLOCK_VERIFY_READ 1 | 1873 | #define FLOCK_VERIFY_READ 1 |
| @@ -2077,7 +2120,6 @@ extern int check_disk_change(struct block_device *); | |||
| 2077 | extern int __invalidate_device(struct block_device *); | 2120 | extern int __invalidate_device(struct block_device *); |
| 2078 | extern int invalidate_partition(struct gendisk *, int); | 2121 | extern int invalidate_partition(struct gendisk *, int); |
| 2079 | #endif | 2122 | #endif |
| 2080 | extern int invalidate_inodes(struct super_block *); | ||
| 2081 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2123 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
| 2082 | pgoff_t start, pgoff_t end); | 2124 | pgoff_t start, pgoff_t end); |
| 2083 | 2125 | ||
| @@ -2161,7 +2203,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
| 2161 | 2203 | ||
| 2162 | extern int inode_init_always(struct super_block *, struct inode *); | 2204 | extern int inode_init_always(struct super_block *, struct inode *); |
| 2163 | extern void inode_init_once(struct inode *); | 2205 | extern void inode_init_once(struct inode *); |
| 2164 | extern void inode_add_to_lists(struct super_block *, struct inode *); | 2206 | extern void ihold(struct inode * inode); |
| 2165 | extern void iput(struct inode *); | 2207 | extern void iput(struct inode *); |
| 2166 | extern struct inode * igrab(struct inode *); | 2208 | extern struct inode * igrab(struct inode *); |
| 2167 | extern ino_t iunique(struct super_block *, ino_t); | 2209 | extern ino_t iunique(struct super_block *, ino_t); |
| @@ -2181,11 +2223,11 @@ extern struct inode * iget_locked(struct super_block *, unsigned long); | |||
| 2181 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); | 2223 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); |
| 2182 | extern int insert_inode_locked(struct inode *); | 2224 | extern int insert_inode_locked(struct inode *); |
| 2183 | extern void unlock_new_inode(struct inode *); | 2225 | extern void unlock_new_inode(struct inode *); |
| 2226 | extern unsigned int get_next_ino(void); | ||
| 2184 | 2227 | ||
| 2185 | extern void __iget(struct inode * inode); | 2228 | extern void __iget(struct inode * inode); |
| 2186 | extern void iget_failed(struct inode *); | 2229 | extern void iget_failed(struct inode *); |
| 2187 | extern void end_writeback(struct inode *); | 2230 | extern void end_writeback(struct inode *); |
| 2188 | extern void destroy_inode(struct inode *); | ||
| 2189 | extern void __destroy_inode(struct inode *); | 2231 | extern void __destroy_inode(struct inode *); |
| 2190 | extern struct inode *new_inode(struct super_block *); | 2232 | extern struct inode *new_inode(struct super_block *); |
| 2191 | extern int should_remove_suid(struct dentry *); | 2233 | extern int should_remove_suid(struct dentry *); |
| @@ -2193,12 +2235,12 @@ extern int file_remove_suid(struct file *); | |||
| 2193 | 2235 | ||
| 2194 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 2236 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
| 2195 | extern void remove_inode_hash(struct inode *); | 2237 | extern void remove_inode_hash(struct inode *); |
| 2196 | static inline void insert_inode_hash(struct inode *inode) { | 2238 | static inline void insert_inode_hash(struct inode *inode) |
| 2239 | { | ||
| 2197 | __insert_inode_hash(inode, inode->i_ino); | 2240 | __insert_inode_hash(inode, inode->i_ino); |
| 2198 | } | 2241 | } |
| 2242 | extern void inode_sb_list_add(struct inode *inode); | ||
| 2199 | 2243 | ||
| 2200 | extern void file_move(struct file *f, struct list_head *list); | ||
| 2201 | extern void file_kill(struct file *f); | ||
| 2202 | #ifdef CONFIG_BLOCK | 2244 | #ifdef CONFIG_BLOCK |
| 2203 | extern void submit_bio(int, struct bio *); | 2245 | extern void submit_bio(int, struct bio *); |
| 2204 | extern int bdev_read_only(struct block_device *); | 2246 | extern int bdev_read_only(struct block_device *); |
| @@ -2381,6 +2423,8 @@ extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, | |||
| 2381 | 2423 | ||
| 2382 | extern int generic_file_fsync(struct file *, int); | 2424 | extern int generic_file_fsync(struct file *, int); |
| 2383 | 2425 | ||
| 2426 | extern int generic_check_addressable(unsigned, u64); | ||
| 2427 | |||
| 2384 | #ifdef CONFIG_MIGRATION | 2428 | #ifdef CONFIG_MIGRATION |
| 2385 | extern int buffer_migrate_page(struct address_space *, | 2429 | extern int buffer_migrate_page(struct address_space *, |
| 2386 | struct page *, struct page *); | 2430 | struct page *, struct page *); |
| @@ -2457,6 +2501,7 @@ static const struct file_operations __fops = { \ | |||
| 2457 | .release = simple_attr_release, \ | 2501 | .release = simple_attr_release, \ |
| 2458 | .read = simple_attr_read, \ | 2502 | .read = simple_attr_read, \ |
| 2459 | .write = simple_attr_write, \ | 2503 | .write = simple_attr_write, \ |
| 2504 | .llseek = generic_file_llseek, \ | ||
| 2460 | }; | 2505 | }; |
| 2461 | 2506 | ||
| 2462 | static inline void __attribute__((format(printf, 1, 2))) | 2507 | static inline void __attribute__((format(printf, 1, 2))) |
| @@ -2477,7 +2522,10 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, | |||
| 2477 | struct ctl_table; | 2522 | struct ctl_table; |
| 2478 | int proc_nr_files(struct ctl_table *table, int write, | 2523 | int proc_nr_files(struct ctl_table *table, int write, |
| 2479 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2524 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 2480 | 2525 | int proc_nr_dentry(struct ctl_table *table, int write, | |
| 2526 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 2527 | int proc_nr_inodes(struct ctl_table *table, int write, | ||
| 2528 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 2481 | int __init get_filesystem_list(char *buf); | 2529 | int __init get_filesystem_list(char *buf); |
| 2482 | 2530 | ||
| 2483 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | 2531 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) |
