diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 102 |
1 files changed, 66 insertions, 36 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7d6f18fddfdb..b2a6009cba10 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -34,9 +34,9 @@ | |||
34 | 34 | ||
35 | /* And dynamically-tunable limits and defaults: */ | 35 | /* And dynamically-tunable limits and defaults: */ |
36 | struct files_stat_struct { | 36 | struct files_stat_struct { |
37 | int nr_files; /* read only */ | 37 | unsigned long nr_files; /* read only */ |
38 | int nr_free_files; /* read only */ | 38 | unsigned long nr_free_files; /* read only */ |
39 | int max_files; /* tunable */ | 39 | unsigned long max_files; /* tunable */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct inodes_stat_t { | 42 | struct inodes_stat_t { |
@@ -92,6 +92,9 @@ struct inodes_stat_t { | |||
92 | /* Expect random access pattern */ | 92 | /* Expect random access pattern */ |
93 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | 93 | #define FMODE_RANDOM ((__force fmode_t)0x1000) |
94 | 94 | ||
95 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | ||
96 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | ||
97 | |||
95 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 98 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
96 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 99 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
97 | 100 | ||
@@ -135,12 +138,12 @@ struct inodes_stat_t { | |||
135 | * immediately after submission. The write equivalent | 138 | * immediately after submission. The write equivalent |
136 | * of READ_SYNC. | 139 | * of READ_SYNC. |
137 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. | 140 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. |
138 | * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all | 141 | * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. |
139 | * previously submitted writes must be safely on storage | 142 | * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on |
140 | * before this one is started. Also guarantees that when | 143 | * non-volatile media on completion. |
141 | * this write is complete, it itself is also safely on | 144 | * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded |
142 | * storage. Prevents reordering of writes on both sides | 145 | * by a cache flush and data is guaranteed to be on |
143 | * of this IO. | 146 | * non-volatile media on completion. |
144 | * | 147 | * |
145 | */ | 148 | */ |
146 | #define RW_MASK REQ_WRITE | 149 | #define RW_MASK REQ_WRITE |
@@ -156,16 +159,12 @@ struct inodes_stat_t { | |||
156 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) | 159 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) |
157 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) | 160 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) |
158 | #define WRITE_META (WRITE | REQ_META) | 161 | #define WRITE_META (WRITE | REQ_META) |
159 | #define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ | 162 | #define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ |
160 | REQ_HARDBARRIER) | 163 | REQ_FLUSH) |
161 | 164 | #define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ | |
162 | /* | 165 | REQ_FUA) |
163 | * These aren't really reads or writes, they pass down information about | 166 | #define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ |
164 | * parts of device that are now unused by the file system. | 167 | REQ_FLUSH | REQ_FUA) |
165 | */ | ||
166 | #define DISCARD_NOBARRIER (WRITE | REQ_DISCARD) | ||
167 | #define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER) | ||
168 | #define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE) | ||
169 | 168 | ||
170 | #define SEL_IN 1 | 169 | #define SEL_IN 1 |
171 | #define SEL_OUT 2 | 170 | #define SEL_OUT 2 |
@@ -235,6 +234,7 @@ struct inodes_stat_t { | |||
235 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ | 234 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ |
236 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ | 235 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
237 | #define S_PRIVATE 512 /* Inode is fs-internal */ | 236 | #define S_PRIVATE 512 /* Inode is fs-internal */ |
237 | #define S_IMA 1024 /* Inode has an associated IMA struct */ | ||
238 | 238 | ||
239 | /* | 239 | /* |
240 | * Note that nosuid etc flags are inode-specific: setting some file-system | 240 | * Note that nosuid etc flags are inode-specific: setting some file-system |
@@ -269,6 +269,7 @@ struct inodes_stat_t { | |||
269 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) | 269 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
270 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) | 270 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) |
271 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) | 271 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) |
272 | #define IS_IMA(inode) ((inode)->i_flags & S_IMA) | ||
272 | 273 | ||
273 | /* the read-only stuff doesn't really belong here, but any other place is | 274 | /* the read-only stuff doesn't really belong here, but any other place is |
274 | probably as bad and I don't want to create yet another include file. */ | 275 | probably as bad and I don't want to create yet another include file. */ |
@@ -404,7 +405,7 @@ extern void __init inode_init_early(void); | |||
404 | extern void __init files_init(unsigned long); | 405 | extern void __init files_init(unsigned long); |
405 | 406 | ||
406 | extern struct files_stat_struct files_stat; | 407 | extern struct files_stat_struct files_stat; |
407 | extern int get_max_files(void); | 408 | extern unsigned long get_max_files(void); |
408 | extern int sysctl_nr_open; | 409 | extern int sysctl_nr_open; |
409 | extern struct inodes_stat_t inodes_stat; | 410 | extern struct inodes_stat_t inodes_stat; |
410 | extern int leases_enable, lease_break_time; | 411 | extern int leases_enable, lease_break_time; |
@@ -724,7 +725,8 @@ struct posix_acl; | |||
724 | 725 | ||
725 | struct inode { | 726 | struct inode { |
726 | struct hlist_node i_hash; | 727 | struct hlist_node i_hash; |
727 | struct list_head i_list; /* backing dev IO list */ | 728 | struct list_head i_wb_list; /* backing dev IO list */ |
729 | struct list_head i_lru; /* inode LRU list */ | ||
728 | struct list_head i_sb_list; | 730 | struct list_head i_sb_list; |
729 | struct list_head i_dentry; | 731 | struct list_head i_dentry; |
730 | unsigned long i_ino; | 732 | unsigned long i_ino; |
@@ -776,6 +778,10 @@ struct inode { | |||
776 | 778 | ||
777 | unsigned int i_flags; | 779 | unsigned int i_flags; |
778 | 780 | ||
781 | #ifdef CONFIG_IMA | ||
782 | /* protected by i_lock */ | ||
783 | unsigned int i_readcount; /* struct files open RO */ | ||
784 | #endif | ||
779 | atomic_t i_writecount; | 785 | atomic_t i_writecount; |
780 | #ifdef CONFIG_SECURITY | 786 | #ifdef CONFIG_SECURITY |
781 | void *i_security; | 787 | void *i_security; |
@@ -787,6 +793,11 @@ struct inode { | |||
787 | void *i_private; /* fs or device private pointer */ | 793 | void *i_private; /* fs or device private pointer */ |
788 | }; | 794 | }; |
789 | 795 | ||
796 | static inline int inode_unhashed(struct inode *inode) | ||
797 | { | ||
798 | return hlist_unhashed(&inode->i_hash); | ||
799 | } | ||
800 | |||
790 | /* | 801 | /* |
791 | * inode->i_mutex nesting subclasses for the lock validator: | 802 | * inode->i_mutex nesting subclasses for the lock validator: |
792 | * | 803 | * |
@@ -1093,10 +1104,6 @@ struct file_lock { | |||
1093 | 1104 | ||
1094 | #include <linux/fcntl.h> | 1105 | #include <linux/fcntl.h> |
1095 | 1106 | ||
1096 | /* temporary stubs for BKL removal */ | ||
1097 | #define lock_flocks() lock_kernel() | ||
1098 | #define unlock_flocks() unlock_kernel() | ||
1099 | |||
1100 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1107 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1101 | 1108 | ||
1102 | #ifdef CONFIG_FILE_LOCKING | 1109 | #ifdef CONFIG_FILE_LOCKING |
@@ -1115,6 +1122,7 @@ extern int fcntl_getlease(struct file *filp); | |||
1115 | 1122 | ||
1116 | /* fs/locks.c */ | 1123 | /* fs/locks.c */ |
1117 | extern void locks_init_lock(struct file_lock *); | 1124 | extern void locks_init_lock(struct file_lock *); |
1125 | extern struct file_lock * locks_alloc_lock(void); | ||
1118 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1126 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
1119 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); | 1127 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); |
1120 | extern void locks_remove_posix(struct file *, fl_owner_t); | 1128 | extern void locks_remove_posix(struct file *, fl_owner_t); |
@@ -1135,6 +1143,8 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1135 | extern int lease_modify(struct file_lock **, int); | 1143 | extern int lease_modify(struct file_lock **, int); |
1136 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1144 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1137 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1145 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1146 | extern void lock_flocks(void); | ||
1147 | extern void unlock_flocks(void); | ||
1138 | #else /* !CONFIG_FILE_LOCKING */ | 1148 | #else /* !CONFIG_FILE_LOCKING */ |
1139 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) | 1149 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
1140 | { | 1150 | { |
@@ -1277,6 +1287,14 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1277 | return 1; | 1287 | return 1; |
1278 | } | 1288 | } |
1279 | 1289 | ||
1290 | static inline void lock_flocks(void) | ||
1291 | { | ||
1292 | } | ||
1293 | |||
1294 | static inline void unlock_flocks(void) | ||
1295 | { | ||
1296 | } | ||
1297 | |||
1280 | #endif /* !CONFIG_FILE_LOCKING */ | 1298 | #endif /* !CONFIG_FILE_LOCKING */ |
1281 | 1299 | ||
1282 | 1300 | ||
@@ -1293,6 +1311,11 @@ struct fasync_struct { | |||
1293 | 1311 | ||
1294 | /* SMP safe fasync helpers: */ | 1312 | /* SMP safe fasync helpers: */ |
1295 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); | 1313 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); |
1314 | extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *); | ||
1315 | extern int fasync_remove_entry(struct file *, struct fasync_struct **); | ||
1316 | extern struct fasync_struct *fasync_alloc(void); | ||
1317 | extern void fasync_free(struct fasync_struct *); | ||
1318 | |||
1296 | /* can be called from interrupts */ | 1319 | /* can be called from interrupts */ |
1297 | extern void kill_fasync(struct fasync_struct **, int, int); | 1320 | extern void kill_fasync(struct fasync_struct **, int, int); |
1298 | 1321 | ||
@@ -1631,16 +1654,17 @@ struct super_operations { | |||
1631 | * | 1654 | * |
1632 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1655 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1633 | */ | 1656 | */ |
1634 | #define I_DIRTY_SYNC 1 | 1657 | #define I_DIRTY_SYNC (1 << 0) |
1635 | #define I_DIRTY_DATASYNC 2 | 1658 | #define I_DIRTY_DATASYNC (1 << 1) |
1636 | #define I_DIRTY_PAGES 4 | 1659 | #define I_DIRTY_PAGES (1 << 2) |
1637 | #define __I_NEW 3 | 1660 | #define __I_NEW 3 |
1638 | #define I_NEW (1 << __I_NEW) | 1661 | #define I_NEW (1 << __I_NEW) |
1639 | #define I_WILL_FREE 16 | 1662 | #define I_WILL_FREE (1 << 4) |
1640 | #define I_FREEING 32 | 1663 | #define I_FREEING (1 << 5) |
1641 | #define I_CLEAR 64 | 1664 | #define I_CLEAR (1 << 6) |
1642 | #define __I_SYNC 7 | 1665 | #define __I_SYNC 7 |
1643 | #define I_SYNC (1 << __I_SYNC) | 1666 | #define I_SYNC (1 << __I_SYNC) |
1667 | #define I_REFERENCED (1 << 8) | ||
1644 | 1668 | ||
1645 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1669 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
1646 | 1670 | ||
@@ -1732,6 +1756,7 @@ static inline void file_accessed(struct file *file) | |||
1732 | } | 1756 | } |
1733 | 1757 | ||
1734 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 1758 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
1759 | int sync_inode_metadata(struct inode *inode, int wait); | ||
1735 | 1760 | ||
1736 | struct file_system_type { | 1761 | struct file_system_type { |
1737 | const char *name; | 1762 | const char *name; |
@@ -2076,7 +2101,6 @@ extern int check_disk_change(struct block_device *); | |||
2076 | extern int __invalidate_device(struct block_device *); | 2101 | extern int __invalidate_device(struct block_device *); |
2077 | extern int invalidate_partition(struct gendisk *, int); | 2102 | extern int invalidate_partition(struct gendisk *, int); |
2078 | #endif | 2103 | #endif |
2079 | extern int invalidate_inodes(struct super_block *); | ||
2080 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2104 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
2081 | pgoff_t start, pgoff_t end); | 2105 | pgoff_t start, pgoff_t end); |
2082 | 2106 | ||
@@ -2160,7 +2184,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
2160 | 2184 | ||
2161 | extern int inode_init_always(struct super_block *, struct inode *); | 2185 | extern int inode_init_always(struct super_block *, struct inode *); |
2162 | extern void inode_init_once(struct inode *); | 2186 | extern void inode_init_once(struct inode *); |
2163 | extern void inode_add_to_lists(struct super_block *, struct inode *); | 2187 | extern void ihold(struct inode * inode); |
2164 | extern void iput(struct inode *); | 2188 | extern void iput(struct inode *); |
2165 | extern struct inode * igrab(struct inode *); | 2189 | extern struct inode * igrab(struct inode *); |
2166 | extern ino_t iunique(struct super_block *, ino_t); | 2190 | extern ino_t iunique(struct super_block *, ino_t); |
@@ -2180,11 +2204,11 @@ extern struct inode * iget_locked(struct super_block *, unsigned long); | |||
2180 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); | 2204 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); |
2181 | extern int insert_inode_locked(struct inode *); | 2205 | extern int insert_inode_locked(struct inode *); |
2182 | extern void unlock_new_inode(struct inode *); | 2206 | extern void unlock_new_inode(struct inode *); |
2207 | extern unsigned int get_next_ino(void); | ||
2183 | 2208 | ||
2184 | extern void __iget(struct inode * inode); | 2209 | extern void __iget(struct inode * inode); |
2185 | extern void iget_failed(struct inode *); | 2210 | extern void iget_failed(struct inode *); |
2186 | extern void end_writeback(struct inode *); | 2211 | extern void end_writeback(struct inode *); |
2187 | extern void destroy_inode(struct inode *); | ||
2188 | extern void __destroy_inode(struct inode *); | 2212 | extern void __destroy_inode(struct inode *); |
2189 | extern struct inode *new_inode(struct super_block *); | 2213 | extern struct inode *new_inode(struct super_block *); |
2190 | extern int should_remove_suid(struct dentry *); | 2214 | extern int should_remove_suid(struct dentry *); |
@@ -2192,9 +2216,11 @@ extern int file_remove_suid(struct file *); | |||
2192 | 2216 | ||
2193 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 2217 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
2194 | extern void remove_inode_hash(struct inode *); | 2218 | extern void remove_inode_hash(struct inode *); |
2195 | static inline void insert_inode_hash(struct inode *inode) { | 2219 | static inline void insert_inode_hash(struct inode *inode) |
2220 | { | ||
2196 | __insert_inode_hash(inode, inode->i_ino); | 2221 | __insert_inode_hash(inode, inode->i_ino); |
2197 | } | 2222 | } |
2223 | extern void inode_sb_list_add(struct inode *inode); | ||
2198 | 2224 | ||
2199 | #ifdef CONFIG_BLOCK | 2225 | #ifdef CONFIG_BLOCK |
2200 | extern void submit_bio(int, struct bio *); | 2226 | extern void submit_bio(int, struct bio *); |
@@ -2456,6 +2482,7 @@ static const struct file_operations __fops = { \ | |||
2456 | .release = simple_attr_release, \ | 2482 | .release = simple_attr_release, \ |
2457 | .read = simple_attr_read, \ | 2483 | .read = simple_attr_read, \ |
2458 | .write = simple_attr_write, \ | 2484 | .write = simple_attr_write, \ |
2485 | .llseek = generic_file_llseek, \ | ||
2459 | }; | 2486 | }; |
2460 | 2487 | ||
2461 | static inline void __attribute__((format(printf, 1, 2))) | 2488 | static inline void __attribute__((format(printf, 1, 2))) |
@@ -2476,7 +2503,10 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, | |||
2476 | struct ctl_table; | 2503 | struct ctl_table; |
2477 | int proc_nr_files(struct ctl_table *table, int write, | 2504 | int proc_nr_files(struct ctl_table *table, int write, |
2478 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2505 | void __user *buffer, size_t *lenp, loff_t *ppos); |
2479 | 2506 | int proc_nr_dentry(struct ctl_table *table, int write, | |
2507 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
2508 | int proc_nr_inodes(struct ctl_table *table, int write, | ||
2509 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
2480 | int __init get_filesystem_list(char *buf); | 2510 | int __init get_filesystem_list(char *buf); |
2481 | 2511 | ||
2482 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | 2512 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) |