diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 09:43:54 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 10:06:11 -0400 |
commit | 7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch) | |
tree | 5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /include/linux/fs.h | |
parent | 7d754596756240fa918b94cd0c3011c77a638987 (diff) | |
parent | 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff) |
Merge 'Linux v3.0' into Litmus
Some notes:
* Litmus^RT scheduling class is the topmost scheduling class
(above stop_sched_class).
* scheduler_ipi() function (e.g., in smp_reschedule_interrupt())
may increase IPI latencies.
* Added path into schedule() to quickly re-evaluate scheduling
decision without becoming preemptive again. This used to be
a standard path before the removal of BKL.
Conflicts:
Makefile
arch/arm/kernel/calls.S
arch/arm/kernel/smp.c
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/smp.c
arch/x86/kernel/syscall_table_32.S
include/linux/hrtimer.h
kernel/printk.c
kernel/sched.c
kernel/sched_fair.c
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 379 |
1 files changed, 248 insertions, 131 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 29a672458d27..8d5834bcb891 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 |
@@ -22,7 +23,8 @@ | |||
22 | 23 | ||
23 | /* Fixed constants first: */ | 24 | /* Fixed constants first: */ |
24 | #undef NR_OPEN | 25 | #undef NR_OPEN |
25 | #define INR_OPEN 1024 /* Initial setting for nfile rlimits */ | 26 | #define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ |
27 | #define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ | ||
26 | 28 | ||
27 | #define BLOCK_SIZE_BITS 10 | 29 | #define BLOCK_SIZE_BITS 10 |
28 | #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) | 30 | #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) |
@@ -32,11 +34,17 @@ | |||
32 | #define SEEK_END 2 /* seek relative to end of file */ | 34 | #define SEEK_END 2 /* seek relative to end of file */ |
33 | #define SEEK_MAX SEEK_END | 35 | #define SEEK_MAX SEEK_END |
34 | 36 | ||
37 | struct fstrim_range { | ||
38 | __u64 start; | ||
39 | __u64 len; | ||
40 | __u64 minlen; | ||
41 | }; | ||
42 | |||
35 | /* And dynamically-tunable limits and defaults: */ | 43 | /* And dynamically-tunable limits and defaults: */ |
36 | struct files_stat_struct { | 44 | struct files_stat_struct { |
37 | int nr_files; /* read only */ | 45 | unsigned long nr_files; /* read only */ |
38 | int nr_free_files; /* read only */ | 46 | unsigned long nr_free_files; /* read only */ |
39 | int max_files; /* tunable */ | 47 | unsigned long max_files; /* tunable */ |
40 | }; | 48 | }; |
41 | 49 | ||
42 | struct inodes_stat_t { | 50 | struct inodes_stat_t { |
@@ -92,6 +100,12 @@ struct inodes_stat_t { | |||
92 | /* Expect random access pattern */ | 100 | /* Expect random access pattern */ |
93 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | 101 | #define FMODE_RANDOM ((__force fmode_t)0x1000) |
94 | 102 | ||
103 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | ||
104 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | ||
105 | |||
106 | /* File is opened with O_PATH; almost nothing can be done with it */ | ||
107 | #define FMODE_PATH ((__force fmode_t)0x4000) | ||
108 | |||
95 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 109 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
96 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 110 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
97 | 111 | ||
@@ -125,22 +139,16 @@ struct inodes_stat_t { | |||
125 | * block layer could (in theory) choose to ignore this | 139 | * block layer could (in theory) choose to ignore this |
126 | * request if it runs into resource problems. | 140 | * request if it runs into resource problems. |
127 | * WRITE A normal async write. Device will be plugged. | 141 | * WRITE A normal async write. Device will be plugged. |
128 | * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down | 142 | * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down |
129 | * the hint that someone will be waiting on this IO | 143 | * the hint that someone will be waiting on this IO |
130 | * shortly. The device must still be unplugged explicitly, | 144 | * shortly. The write equivalent of READ_SYNC. |
131 | * WRITE_SYNC_PLUG does not do this as we could be | 145 | * WRITE_ODIRECT Special case write for O_DIRECT only. |
132 | * submitting more writes before we actually wait on any | 146 | * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. |
133 | * of them. | 147 | * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on |
134 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | 148 | * non-volatile media on completion. |
135 | * immediately after submission. The write equivalent | 149 | * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded |
136 | * of READ_SYNC. | 150 | * by a cache flush and data is guaranteed to be on |
137 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. | 151 | * non-volatile media on completion. |
138 | * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all | ||
139 | * previously submitted writes must be safely on storage | ||
140 | * before this one is started. Also guarantees that when | ||
141 | * this write is complete, it itself is also safely on | ||
142 | * storage. Prevents reordering of writes on both sides | ||
143 | * of this IO. | ||
144 | * | 152 | * |
145 | */ | 153 | */ |
146 | #define RW_MASK REQ_WRITE | 154 | #define RW_MASK REQ_WRITE |
@@ -150,22 +158,14 @@ struct inodes_stat_t { | |||
150 | #define WRITE RW_MASK | 158 | #define WRITE RW_MASK |
151 | #define READA RWA_MASK | 159 | #define READA RWA_MASK |
152 | 160 | ||
153 | #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) | 161 | #define READ_SYNC (READ | REQ_SYNC) |
154 | #define READ_META (READ | REQ_META) | 162 | #define READ_META (READ | REQ_META) |
155 | #define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) | 163 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) |
156 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) | 164 | #define WRITE_ODIRECT (WRITE | REQ_SYNC) |
157 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) | ||
158 | #define WRITE_META (WRITE | REQ_META) | 165 | #define WRITE_META (WRITE | REQ_META) |
159 | #define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ | 166 | #define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) |
160 | REQ_HARDBARRIER) | 167 | #define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) |
161 | 168 | #define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) | |
162 | /* | ||
163 | * These aren't really reads or writes, they pass down information about | ||
164 | * parts of device that are now unused by the file system. | ||
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 | 169 | ||
170 | #define SEL_IN 1 | 170 | #define SEL_IN 1 |
171 | #define SEL_OUT 2 | 171 | #define SEL_OUT 2 |
@@ -208,6 +208,7 @@ struct inodes_stat_t { | |||
208 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ | 208 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ |
209 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ | 209 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ |
210 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ | 210 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ |
211 | #define MS_NOSEC (1<<28) | ||
211 | #define MS_BORN (1<<29) | 212 | #define MS_BORN (1<<29) |
212 | #define MS_ACTIVE (1<<30) | 213 | #define MS_ACTIVE (1<<30) |
213 | #define MS_NOUSER (1<<31) | 214 | #define MS_NOUSER (1<<31) |
@@ -235,6 +236,9 @@ struct inodes_stat_t { | |||
235 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ | 236 | #define S_NOCMTIME 128 /* Do not update file c/mtime */ |
236 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ | 237 | #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
237 | #define S_PRIVATE 512 /* Inode is fs-internal */ | 238 | #define S_PRIVATE 512 /* Inode is fs-internal */ |
239 | #define S_IMA 1024 /* Inode has an associated IMA struct */ | ||
240 | #define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */ | ||
241 | #define S_NOSEC 4096 /* no suid or xattr security attributes */ | ||
238 | 242 | ||
239 | /* | 243 | /* |
240 | * Note that nosuid etc flags are inode-specific: setting some file-system | 244 | * Note that nosuid etc flags are inode-specific: setting some file-system |
@@ -269,6 +273,9 @@ struct inodes_stat_t { | |||
269 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) | 273 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
270 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) | 274 | #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) |
271 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) | 275 | #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) |
276 | #define IS_IMA(inode) ((inode)->i_flags & S_IMA) | ||
277 | #define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) | ||
278 | #define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) | ||
272 | 279 | ||
273 | /* the read-only stuff doesn't really belong here, but any other place is | 280 | /* 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. */ | 281 | probably as bad and I don't want to create yet another include file. */ |
@@ -316,6 +323,7 @@ struct inodes_stat_t { | |||
316 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ | 323 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ |
317 | #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ | 324 | #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ |
318 | #define FITHAW _IOWR('X', 120, int) /* Thaw */ | 325 | #define FITHAW _IOWR('X', 120, int) /* Thaw */ |
326 | #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ | ||
319 | 327 | ||
320 | #define FS_IOC_GETFLAGS _IOR('f', 1, long) | 328 | #define FS_IOC_GETFLAGS _IOR('f', 1, long) |
321 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) | 329 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
@@ -353,6 +361,7 @@ struct inodes_stat_t { | |||
353 | #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | 361 | #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
354 | #define FS_EXTENT_FL 0x00080000 /* Extents */ | 362 | #define FS_EXTENT_FL 0x00080000 /* Extents */ |
355 | #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ | 363 | #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ |
364 | #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ | ||
356 | #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ | 365 | #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ |
357 | 366 | ||
358 | #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | 367 | #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ |
@@ -373,7 +382,6 @@ struct inodes_stat_t { | |||
373 | #include <linux/path.h> | 382 | #include <linux/path.h> |
374 | #include <linux/stat.h> | 383 | #include <linux/stat.h> |
375 | #include <linux/cache.h> | 384 | #include <linux/cache.h> |
376 | #include <linux/kobject.h> | ||
377 | #include <linux/list.h> | 385 | #include <linux/list.h> |
378 | #include <linux/radix-tree.h> | 386 | #include <linux/radix-tree.h> |
379 | #include <linux/prio_tree.h> | 387 | #include <linux/prio_tree.h> |
@@ -383,6 +391,7 @@ struct inodes_stat_t { | |||
383 | #include <linux/capability.h> | 391 | #include <linux/capability.h> |
384 | #include <linux/semaphore.h> | 392 | #include <linux/semaphore.h> |
385 | #include <linux/fiemap.h> | 393 | #include <linux/fiemap.h> |
394 | #include <linux/rculist_bl.h> | ||
386 | 395 | ||
387 | #include <asm/atomic.h> | 396 | #include <asm/atomic.h> |
388 | #include <asm/byteorder.h> | 397 | #include <asm/byteorder.h> |
@@ -392,6 +401,7 @@ struct hd_geometry; | |||
392 | struct iovec; | 401 | struct iovec; |
393 | struct nameidata; | 402 | struct nameidata; |
394 | struct kiocb; | 403 | struct kiocb; |
404 | struct kobject; | ||
395 | struct pipe_inode_info; | 405 | struct pipe_inode_info; |
396 | struct poll_table_struct; | 406 | struct poll_table_struct; |
397 | struct kstatfs; | 407 | struct kstatfs; |
@@ -404,7 +414,7 @@ extern void __init inode_init_early(void); | |||
404 | extern void __init files_init(unsigned long); | 414 | extern void __init files_init(unsigned long); |
405 | 415 | ||
406 | extern struct files_stat_struct files_stat; | 416 | extern struct files_stat_struct files_stat; |
407 | extern int get_max_files(void); | 417 | extern unsigned long get_max_files(void); |
408 | extern int sysctl_nr_open; | 418 | extern int sysctl_nr_open; |
409 | extern struct inodes_stat_t inodes_stat; | 419 | extern struct inodes_stat_t inodes_stat; |
410 | extern int leases_enable, lease_break_time; | 420 | extern int leases_enable, lease_break_time; |
@@ -458,7 +468,7 @@ struct iattr { | |||
458 | struct timespec ia_ctime; | 468 | struct timespec ia_ctime; |
459 | 469 | ||
460 | /* | 470 | /* |
461 | * Not an attribute, but an auxilary info for filesystems wanting to | 471 | * Not an attribute, but an auxiliary info for filesystems wanting to |
462 | * implement an ftruncate() like method. NOTE: filesystem should | 472 | * implement an ftruncate() like method. NOTE: filesystem should |
463 | * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL). | 473 | * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL). |
464 | */ | 474 | */ |
@@ -571,7 +581,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, | |||
571 | struct address_space_operations { | 581 | struct address_space_operations { |
572 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 582 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
573 | int (*readpage)(struct file *, struct page *); | 583 | int (*readpage)(struct file *, struct page *); |
574 | void (*sync_page)(struct page *); | ||
575 | 584 | ||
576 | /* Write back some dirty pages from this mapping. */ | 585 | /* Write back some dirty pages from this mapping. */ |
577 | int (*writepages)(struct address_space *, struct writeback_control *); | 586 | int (*writepages)(struct address_space *, struct writeback_control *); |
@@ -593,6 +602,7 @@ struct address_space_operations { | |||
593 | sector_t (*bmap)(struct address_space *, sector_t); | 602 | sector_t (*bmap)(struct address_space *, sector_t); |
594 | void (*invalidatepage) (struct page *, unsigned long); | 603 | void (*invalidatepage) (struct page *, unsigned long); |
595 | int (*releasepage) (struct page *, gfp_t); | 604 | int (*releasepage) (struct page *, gfp_t); |
605 | void (*freepage)(struct page *); | ||
596 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 606 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
597 | loff_t offset, unsigned long nr_segs); | 607 | loff_t offset, unsigned long nr_segs); |
598 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, | 608 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, |
@@ -606,6 +616,8 @@ struct address_space_operations { | |||
606 | int (*error_remove_page)(struct address_space *, struct page *); | 616 | int (*error_remove_page)(struct address_space *, struct page *); |
607 | }; | 617 | }; |
608 | 618 | ||
619 | extern const struct address_space_operations empty_aops; | ||
620 | |||
609 | /* | 621 | /* |
610 | * pagecache_write_begin/pagecache_write_end must be used by general code | 622 | * pagecache_write_begin/pagecache_write_end must be used by general code |
611 | * to write into the pagecache. | 623 | * to write into the pagecache. |
@@ -626,8 +638,8 @@ struct address_space { | |||
626 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ | 638 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ |
627 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ | 639 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ |
628 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ | 640 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ |
629 | spinlock_t i_mmap_lock; /* protect tree, count, list */ | 641 | struct mutex i_mmap_mutex; /* protect tree, count, list */ |
630 | unsigned int truncate_count; /* Cover race condition with truncate */ | 642 | /* Protected by tree_lock together with the radix tree */ |
631 | unsigned long nrpages; /* number of total pages */ | 643 | unsigned long nrpages; /* number of total pages */ |
632 | pgoff_t writeback_index;/* writeback starts here */ | 644 | pgoff_t writeback_index;/* writeback starts here */ |
633 | const struct address_space_operations *a_ops; /* methods */ | 645 | const struct address_space_operations *a_ops; /* methods */ |
@@ -639,22 +651,23 @@ struct address_space { | |||
639 | } __attribute__((aligned(sizeof(long)))); | 651 | } __attribute__((aligned(sizeof(long)))); |
640 | /* | 652 | /* |
641 | * On most architectures that alignment is already the case; but | 653 | * On most architectures that alignment is already the case; but |
642 | * must be enforced here for CRIS, to let the least signficant bit | 654 | * must be enforced here for CRIS, to let the least significant bit |
643 | * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. | 655 | * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. |
644 | */ | 656 | */ |
645 | 657 | ||
646 | struct block_device { | 658 | struct block_device { |
647 | dev_t bd_dev; /* not a kdev_t - it's a search key */ | 659 | dev_t bd_dev; /* not a kdev_t - it's a search key */ |
660 | int bd_openers; | ||
648 | struct inode * bd_inode; /* will die */ | 661 | struct inode * bd_inode; /* will die */ |
649 | struct super_block * bd_super; | 662 | struct super_block * bd_super; |
650 | int bd_openers; | ||
651 | struct mutex bd_mutex; /* open/close mutex */ | 663 | struct mutex bd_mutex; /* open/close mutex */ |
652 | struct list_head bd_inodes; | 664 | struct list_head bd_inodes; |
653 | void * bd_claiming; | 665 | void * bd_claiming; |
654 | void * bd_holder; | 666 | void * bd_holder; |
655 | int bd_holders; | 667 | int bd_holders; |
668 | bool bd_write_holder; | ||
656 | #ifdef CONFIG_SYSFS | 669 | #ifdef CONFIG_SYSFS |
657 | struct list_head bd_holder_list; | 670 | struct list_head bd_holder_disks; |
658 | #endif | 671 | #endif |
659 | struct block_device * bd_contains; | 672 | struct block_device * bd_contains; |
660 | unsigned bd_block_size; | 673 | unsigned bd_block_size; |
@@ -724,15 +737,35 @@ struct posix_acl; | |||
724 | struct inode_obj_id_table; | 737 | struct inode_obj_id_table; |
725 | 738 | ||
726 | struct inode { | 739 | struct inode { |
740 | /* RCU path lookup touches following: */ | ||
741 | umode_t i_mode; | ||
742 | uid_t i_uid; | ||
743 | gid_t i_gid; | ||
744 | const struct inode_operations *i_op; | ||
745 | struct super_block *i_sb; | ||
746 | |||
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 | ||
751 | void *i_security; | ||
752 | #endif | ||
753 | struct mutex i_mutex; | ||
754 | |||
755 | |||
756 | unsigned long dirtied_when; /* jiffies of first dirtying */ | ||
757 | |||
727 | struct hlist_node i_hash; | 758 | struct hlist_node i_hash; |
728 | struct list_head i_list; /* backing dev IO list */ | 759 | struct list_head i_wb_list; /* backing dev IO list */ |
760 | struct list_head i_lru; /* inode LRU list */ | ||
729 | struct list_head i_sb_list; | 761 | struct list_head i_sb_list; |
730 | struct list_head i_dentry; | 762 | union { |
763 | struct list_head i_dentry; | ||
764 | struct rcu_head i_rcu; | ||
765 | }; | ||
731 | unsigned long i_ino; | 766 | unsigned long i_ino; |
732 | atomic_t i_count; | 767 | atomic_t i_count; |
733 | unsigned int i_nlink; | 768 | unsigned int i_nlink; |
734 | uid_t i_uid; | ||
735 | gid_t i_gid; | ||
736 | dev_t i_rdev; | 769 | dev_t i_rdev; |
737 | unsigned int i_blkbits; | 770 | unsigned int i_blkbits; |
738 | u64 i_version; | 771 | u64 i_version; |
@@ -745,13 +778,8 @@ struct inode { | |||
745 | struct timespec i_ctime; | 778 | struct timespec i_ctime; |
746 | blkcnt_t i_blocks; | 779 | blkcnt_t i_blocks; |
747 | unsigned short i_bytes; | 780 | unsigned short i_bytes; |
748 | umode_t i_mode; | ||
749 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | ||
750 | struct mutex i_mutex; | ||
751 | struct rw_semaphore i_alloc_sem; | 781 | struct rw_semaphore i_alloc_sem; |
752 | const struct inode_operations *i_op; | ||
753 | const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 782 | const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ |
754 | struct super_block *i_sb; | ||
755 | struct file_lock *i_flock; | 783 | struct file_lock *i_flock; |
756 | struct address_space *i_mapping; | 784 | struct address_space *i_mapping; |
757 | struct address_space i_data; | 785 | struct address_space i_data; |
@@ -772,15 +800,10 @@ struct inode { | |||
772 | struct hlist_head i_fsnotify_marks; | 800 | struct hlist_head i_fsnotify_marks; |
773 | #endif | 801 | #endif |
774 | 802 | ||
775 | unsigned long i_state; | 803 | #ifdef CONFIG_IMA |
776 | unsigned long dirtied_when; /* jiffies of first dirtying */ | 804 | atomic_t i_readcount; /* struct files open RO */ |
777 | |||
778 | unsigned int i_flags; | ||
779 | |||
780 | atomic_t i_writecount; | ||
781 | #ifdef CONFIG_SECURITY | ||
782 | void *i_security; | ||
783 | #endif | 805 | #endif |
806 | atomic_t i_writecount; | ||
784 | #ifdef CONFIG_FS_POSIX_ACL | 807 | #ifdef CONFIG_FS_POSIX_ACL |
785 | struct posix_acl *i_acl; | 808 | struct posix_acl *i_acl; |
786 | struct posix_acl *i_default_acl; | 809 | struct posix_acl *i_default_acl; |
@@ -790,6 +813,11 @@ struct inode { | |||
790 | void *i_private; /* fs or device private pointer */ | 813 | void *i_private; /* fs or device private pointer */ |
791 | }; | 814 | }; |
792 | 815 | ||
816 | static inline int inode_unhashed(struct inode *inode) | ||
817 | { | ||
818 | return hlist_unhashed(&inode->i_hash); | ||
819 | } | ||
820 | |||
793 | /* | 821 | /* |
794 | * inode->i_mutex nesting subclasses for the lock validator: | 822 | * inode->i_mutex nesting subclasses for the lock validator: |
795 | * | 823 | * |
@@ -951,6 +979,13 @@ struct file { | |||
951 | #endif | 979 | #endif |
952 | }; | 980 | }; |
953 | 981 | ||
982 | struct file_handle { | ||
983 | __u32 handle_bytes; | ||
984 | int handle_type; | ||
985 | /* file identifier */ | ||
986 | unsigned char f_handle[0]; | ||
987 | }; | ||
988 | |||
954 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 989 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
955 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 990 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
956 | #define file_count(x) atomic_long_read(&(x)->f_count) | 991 | #define file_count(x) atomic_long_read(&(x)->f_count) |
@@ -1040,10 +1075,8 @@ struct lock_manager_operations { | |||
1040 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); | 1075 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); |
1041 | void (*fl_notify)(struct file_lock *); /* unblock callback */ | 1076 | void (*fl_notify)(struct file_lock *); /* unblock callback */ |
1042 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); | 1077 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); |
1043 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); | ||
1044 | void (*fl_release_private)(struct file_lock *); | 1078 | void (*fl_release_private)(struct file_lock *); |
1045 | void (*fl_break)(struct file_lock *); | 1079 | void (*fl_break)(struct file_lock *); |
1046 | int (*fl_mylease)(struct file_lock *, struct file_lock *); | ||
1047 | int (*fl_change)(struct file_lock **, int); | 1080 | int (*fl_change)(struct file_lock **, int); |
1048 | }; | 1081 | }; |
1049 | 1082 | ||
@@ -1096,10 +1129,6 @@ struct file_lock { | |||
1096 | 1129 | ||
1097 | #include <linux/fcntl.h> | 1130 | #include <linux/fcntl.h> |
1098 | 1131 | ||
1099 | /* temporary stubs for BKL removal */ | ||
1100 | #define lock_flocks() lock_kernel() | ||
1101 | #define unlock_flocks() unlock_kernel() | ||
1102 | |||
1103 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1132 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1104 | 1133 | ||
1105 | #ifdef CONFIG_FILE_LOCKING | 1134 | #ifdef CONFIG_FILE_LOCKING |
@@ -1117,7 +1146,9 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | |||
1117 | extern int fcntl_getlease(struct file *filp); | 1146 | extern int fcntl_getlease(struct file *filp); |
1118 | 1147 | ||
1119 | /* fs/locks.c */ | 1148 | /* fs/locks.c */ |
1149 | void locks_free_lock(struct file_lock *fl); | ||
1120 | extern void locks_init_lock(struct file_lock *); | 1150 | extern void locks_init_lock(struct file_lock *); |
1151 | extern struct file_lock * locks_alloc_lock(void); | ||
1121 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1152 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
1122 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); | 1153 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); |
1123 | extern void locks_remove_posix(struct file *, fl_owner_t); | 1154 | extern void locks_remove_posix(struct file *, fl_owner_t); |
@@ -1138,6 +1169,8 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1138 | extern int lease_modify(struct file_lock **, int); | 1169 | extern int lease_modify(struct file_lock **, int); |
1139 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1170 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1140 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1171 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1172 | extern void lock_flocks(void); | ||
1173 | extern void unlock_flocks(void); | ||
1141 | #else /* !CONFIG_FILE_LOCKING */ | 1174 | #else /* !CONFIG_FILE_LOCKING */ |
1142 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) | 1175 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
1143 | { | 1176 | { |
@@ -1280,6 +1313,14 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1280 | return 1; | 1313 | return 1; |
1281 | } | 1314 | } |
1282 | 1315 | ||
1316 | static inline void lock_flocks(void) | ||
1317 | { | ||
1318 | } | ||
1319 | |||
1320 | static inline void unlock_flocks(void) | ||
1321 | { | ||
1322 | } | ||
1323 | |||
1283 | #endif /* !CONFIG_FILE_LOCKING */ | 1324 | #endif /* !CONFIG_FILE_LOCKING */ |
1284 | 1325 | ||
1285 | 1326 | ||
@@ -1296,6 +1337,11 @@ struct fasync_struct { | |||
1296 | 1337 | ||
1297 | /* SMP safe fasync helpers: */ | 1338 | /* SMP safe fasync helpers: */ |
1298 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); | 1339 | extern int fasync_helper(int, struct file *, int, struct fasync_struct **); |
1340 | extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *); | ||
1341 | extern int fasync_remove_entry(struct file *, struct fasync_struct **); | ||
1342 | extern struct fasync_struct *fasync_alloc(void); | ||
1343 | extern void fasync_free(struct fasync_struct *); | ||
1344 | |||
1299 | /* can be called from interrupts */ | 1345 | /* can be called from interrupts */ |
1300 | extern void kill_fasync(struct fasync_struct **, int, int); | 1346 | extern void kill_fasync(struct fasync_struct **, int, int); |
1301 | 1347 | ||
@@ -1343,13 +1389,13 @@ struct super_block { | |||
1343 | const struct xattr_handler **s_xattr; | 1389 | const struct xattr_handler **s_xattr; |
1344 | 1390 | ||
1345 | struct list_head s_inodes; /* all inodes */ | 1391 | struct list_head s_inodes; /* all inodes */ |
1346 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1392 | struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ |
1347 | #ifdef CONFIG_SMP | 1393 | #ifdef CONFIG_SMP |
1348 | struct list_head __percpu *s_files; | 1394 | struct list_head __percpu *s_files; |
1349 | #else | 1395 | #else |
1350 | struct list_head s_files; | 1396 | struct list_head s_files; |
1351 | #endif | 1397 | #endif |
1352 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ | 1398 | /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ |
1353 | struct list_head s_dentry_lru; /* unused dentry lru */ | 1399 | struct list_head s_dentry_lru; /* unused dentry lru */ |
1354 | int s_nr_dentry_unused; /* # of dentry on lru */ | 1400 | int s_nr_dentry_unused; /* # of dentry on lru */ |
1355 | 1401 | ||
@@ -1363,6 +1409,7 @@ struct super_block { | |||
1363 | wait_queue_head_t s_wait_unfrozen; | 1409 | wait_queue_head_t s_wait_unfrozen; |
1364 | 1410 | ||
1365 | char s_id[32]; /* Informational name */ | 1411 | char s_id[32]; /* Informational name */ |
1412 | u8 s_uuid[16]; /* UUID */ | ||
1366 | 1413 | ||
1367 | void *s_fs_info; /* Filesystem private info */ | 1414 | void *s_fs_info; /* Filesystem private info */ |
1368 | fmode_t s_mode; | 1415 | fmode_t s_mode; |
@@ -1387,7 +1434,13 @@ struct super_block { | |||
1387 | * Saved mount options for lazy filesystems using | 1434 | * Saved mount options for lazy filesystems using |
1388 | * generic_show_options() | 1435 | * generic_show_options() |
1389 | */ | 1436 | */ |
1390 | char *s_options; | 1437 | char __rcu *s_options; |
1438 | const struct dentry_operations *s_d_op; /* default d_op for dentries */ | ||
1439 | |||
1440 | /* | ||
1441 | * Saved pool identifier for cleancache (-1 means none) | ||
1442 | */ | ||
1443 | int cleancache_poolid; | ||
1391 | }; | 1444 | }; |
1392 | 1445 | ||
1393 | extern struct timespec current_fs_time(struct super_block *sb); | 1446 | extern struct timespec current_fs_time(struct super_block *sb); |
@@ -1408,8 +1461,13 @@ enum { | |||
1408 | #define put_fs_excl() atomic_dec(¤t->fs_excl) | 1461 | #define put_fs_excl() atomic_dec(¤t->fs_excl) |
1409 | #define has_fs_excl() atomic_read(¤t->fs_excl) | 1462 | #define has_fs_excl() atomic_read(¤t->fs_excl) |
1410 | 1463 | ||
1411 | #define is_owner_or_cap(inode) \ | 1464 | /* |
1412 | ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER)) | 1465 | * until VFS tracks user namespaces for inodes, just make all files |
1466 | * belong to init_user_ns | ||
1467 | */ | ||
1468 | extern struct user_namespace init_user_ns; | ||
1469 | #define inode_userns(inode) (&init_user_ns) | ||
1470 | extern bool inode_owner_or_capable(const struct inode *inode); | ||
1413 | 1471 | ||
1414 | /* not quite ready to be deprecated, but... */ | 1472 | /* not quite ready to be deprecated, but... */ |
1415 | extern void lock_super(struct super_block *); | 1473 | extern void lock_super(struct super_block *); |
@@ -1445,8 +1503,8 @@ struct fiemap_extent_info { | |||
1445 | unsigned int fi_flags; /* Flags as passed from user */ | 1503 | unsigned int fi_flags; /* Flags as passed from user */ |
1446 | unsigned int fi_extents_mapped; /* Number of mapped extents */ | 1504 | unsigned int fi_extents_mapped; /* Number of mapped extents */ |
1447 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ | 1505 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ |
1448 | struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent | 1506 | struct fiemap_extent __user *fi_extents_start; /* Start of |
1449 | * array */ | 1507 | fiemap_extent array */ |
1450 | }; | 1508 | }; |
1451 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | 1509 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, |
1452 | u64 phys, u64 len, u32 flags); | 1510 | u64 phys, u64 len, u32 flags); |
@@ -1514,11 +1572,22 @@ struct file_operations { | |||
1514 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); | 1572 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); |
1515 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); | 1573 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); |
1516 | int (*setlease)(struct file *, long, struct file_lock **); | 1574 | int (*setlease)(struct file *, long, struct file_lock **); |
1575 | long (*fallocate)(struct file *file, int mode, loff_t offset, | ||
1576 | loff_t len); | ||
1517 | }; | 1577 | }; |
1518 | 1578 | ||
1579 | #define IPERM_FLAG_RCU 0x0001 | ||
1580 | |||
1519 | struct inode_operations { | 1581 | struct inode_operations { |
1520 | int (*create) (struct inode *,struct dentry *,int, struct nameidata *); | ||
1521 | struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); | 1582 | struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); |
1583 | void * (*follow_link) (struct dentry *, struct nameidata *); | ||
1584 | int (*permission) (struct inode *, int, unsigned int); | ||
1585 | int (*check_acl)(struct inode *, int, unsigned int); | ||
1586 | |||
1587 | int (*readlink) (struct dentry *, char __user *,int); | ||
1588 | void (*put_link) (struct dentry *, struct nameidata *, void *); | ||
1589 | |||
1590 | int (*create) (struct inode *,struct dentry *,int, struct nameidata *); | ||
1522 | int (*link) (struct dentry *,struct inode *,struct dentry *); | 1591 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
1523 | int (*unlink) (struct inode *,struct dentry *); | 1592 | int (*unlink) (struct inode *,struct dentry *); |
1524 | int (*symlink) (struct inode *,struct dentry *,const char *); | 1593 | int (*symlink) (struct inode *,struct dentry *,const char *); |
@@ -1527,12 +1596,7 @@ struct inode_operations { | |||
1527 | int (*mknod) (struct inode *,struct dentry *,int,dev_t); | 1596 | int (*mknod) (struct inode *,struct dentry *,int,dev_t); |
1528 | int (*rename) (struct inode *, struct dentry *, | 1597 | int (*rename) (struct inode *, struct dentry *, |
1529 | struct inode *, struct dentry *); | 1598 | struct inode *, struct dentry *); |
1530 | int (*readlink) (struct dentry *, char __user *,int); | ||
1531 | void * (*follow_link) (struct dentry *, struct nameidata *); | ||
1532 | void (*put_link) (struct dentry *, struct nameidata *, void *); | ||
1533 | void (*truncate) (struct inode *); | 1599 | void (*truncate) (struct inode *); |
1534 | int (*permission) (struct inode *, int); | ||
1535 | int (*check_acl)(struct inode *, int); | ||
1536 | int (*setattr) (struct dentry *, struct iattr *); | 1600 | int (*setattr) (struct dentry *, struct iattr *); |
1537 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1601 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
1538 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 1602 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
@@ -1540,11 +1604,9 @@ struct inode_operations { | |||
1540 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1604 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
1541 | int (*removexattr) (struct dentry *, const char *); | 1605 | int (*removexattr) (struct dentry *, const char *); |
1542 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1606 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1543 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | ||
1544 | loff_t len); | ||
1545 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | 1607 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, |
1546 | u64 len); | 1608 | u64 len); |
1547 | }; | 1609 | } ____cacheline_aligned; |
1548 | 1610 | ||
1549 | struct seq_file; | 1611 | struct seq_file; |
1550 | 1612 | ||
@@ -1564,7 +1626,7 @@ struct super_operations { | |||
1564 | struct inode *(*alloc_inode)(struct super_block *sb); | 1626 | struct inode *(*alloc_inode)(struct super_block *sb); |
1565 | void (*destroy_inode)(struct inode *); | 1627 | void (*destroy_inode)(struct inode *); |
1566 | 1628 | ||
1567 | void (*dirty_inode) (struct inode *); | 1629 | void (*dirty_inode) (struct inode *, int flags); |
1568 | int (*write_inode) (struct inode *, struct writeback_control *wbc); | 1630 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
1569 | int (*drop_inode) (struct inode *); | 1631 | int (*drop_inode) (struct inode *); |
1570 | void (*evict_inode) (struct inode *); | 1632 | void (*evict_inode) (struct inode *); |
@@ -1578,6 +1640,8 @@ struct super_operations { | |||
1578 | void (*umount_begin) (struct super_block *); | 1640 | void (*umount_begin) (struct super_block *); |
1579 | 1641 | ||
1580 | int (*show_options)(struct seq_file *, struct vfsmount *); | 1642 | int (*show_options)(struct seq_file *, struct vfsmount *); |
1643 | int (*show_devname)(struct seq_file *, struct vfsmount *); | ||
1644 | int (*show_path)(struct seq_file *, struct vfsmount *); | ||
1581 | int (*show_stats)(struct seq_file *, struct vfsmount *); | 1645 | int (*show_stats)(struct seq_file *, struct vfsmount *); |
1582 | #ifdef CONFIG_QUOTA | 1646 | #ifdef CONFIG_QUOTA |
1583 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); | 1647 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); |
@@ -1587,7 +1651,7 @@ struct super_operations { | |||
1587 | }; | 1651 | }; |
1588 | 1652 | ||
1589 | /* | 1653 | /* |
1590 | * Inode state bits. Protected by inode_lock. | 1654 | * Inode state bits. Protected by inode->i_lock |
1591 | * | 1655 | * |
1592 | * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, | 1656 | * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, |
1593 | * I_DIRTY_DATASYNC and I_DIRTY_PAGES. | 1657 | * I_DIRTY_DATASYNC and I_DIRTY_PAGES. |
@@ -1634,16 +1698,17 @@ struct super_operations { | |||
1634 | * | 1698 | * |
1635 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1699 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1636 | */ | 1700 | */ |
1637 | #define I_DIRTY_SYNC 1 | 1701 | #define I_DIRTY_SYNC (1 << 0) |
1638 | #define I_DIRTY_DATASYNC 2 | 1702 | #define I_DIRTY_DATASYNC (1 << 1) |
1639 | #define I_DIRTY_PAGES 4 | 1703 | #define I_DIRTY_PAGES (1 << 2) |
1640 | #define __I_NEW 3 | 1704 | #define __I_NEW 3 |
1641 | #define I_NEW (1 << __I_NEW) | 1705 | #define I_NEW (1 << __I_NEW) |
1642 | #define I_WILL_FREE 16 | 1706 | #define I_WILL_FREE (1 << 4) |
1643 | #define I_FREEING 32 | 1707 | #define I_FREEING (1 << 5) |
1644 | #define I_CLEAR 64 | 1708 | #define I_CLEAR (1 << 6) |
1645 | #define __I_SYNC 7 | 1709 | #define __I_SYNC 7 |
1646 | #define I_SYNC (1 << __I_SYNC) | 1710 | #define I_SYNC (1 << __I_SYNC) |
1711 | #define I_REFERENCED (1 << 8) | ||
1647 | 1712 | ||
1648 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1713 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
1649 | 1714 | ||
@@ -1735,12 +1800,13 @@ static inline void file_accessed(struct file *file) | |||
1735 | } | 1800 | } |
1736 | 1801 | ||
1737 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 1802 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
1803 | int sync_inode_metadata(struct inode *inode, int wait); | ||
1738 | 1804 | ||
1739 | struct file_system_type { | 1805 | struct file_system_type { |
1740 | const char *name; | 1806 | const char *name; |
1741 | int fs_flags; | 1807 | int fs_flags; |
1742 | int (*get_sb) (struct file_system_type *, int, | 1808 | struct dentry *(*mount) (struct file_system_type *, int, |
1743 | const char *, void *, struct vfsmount *); | 1809 | const char *, void *); |
1744 | void (*kill_sb) (struct super_block *); | 1810 | void (*kill_sb) (struct super_block *); |
1745 | struct module *owner; | 1811 | struct module *owner; |
1746 | struct file_system_type * next; | 1812 | struct file_system_type * next; |
@@ -1756,21 +1822,17 @@ struct file_system_type { | |||
1756 | struct lock_class_key i_alloc_sem_key; | 1822 | struct lock_class_key i_alloc_sem_key; |
1757 | }; | 1823 | }; |
1758 | 1824 | ||
1759 | extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, | 1825 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, |
1760 | int (*fill_super)(struct super_block *, void *, int), | 1826 | void *data, int (*fill_super)(struct super_block *, void *, int)); |
1761 | struct vfsmount *mnt); | 1827 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, |
1762 | extern int get_sb_bdev(struct file_system_type *fs_type, | ||
1763 | int flags, const char *dev_name, void *data, | 1828 | int flags, const char *dev_name, void *data, |
1764 | int (*fill_super)(struct super_block *, void *, int), | 1829 | int (*fill_super)(struct super_block *, void *, int)); |
1765 | struct vfsmount *mnt); | 1830 | extern struct dentry *mount_single(struct file_system_type *fs_type, |
1766 | extern int get_sb_single(struct file_system_type *fs_type, | ||
1767 | int flags, void *data, | 1831 | int flags, void *data, |
1768 | int (*fill_super)(struct super_block *, void *, int), | 1832 | int (*fill_super)(struct super_block *, void *, int)); |
1769 | struct vfsmount *mnt); | 1833 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, |
1770 | extern int get_sb_nodev(struct file_system_type *fs_type, | ||
1771 | int flags, void *data, | 1834 | int flags, void *data, |
1772 | int (*fill_super)(struct super_block *, void *, int), | 1835 | int (*fill_super)(struct super_block *, void *, int)); |
1773 | struct vfsmount *mnt); | ||
1774 | void generic_shutdown_super(struct super_block *sb); | 1836 | void generic_shutdown_super(struct super_block *sb); |
1775 | void kill_block_super(struct super_block *sb); | 1837 | void kill_block_super(struct super_block *sb); |
1776 | void kill_anon_super(struct super_block *sb); | 1838 | void kill_anon_super(struct super_block *sb); |
@@ -1782,10 +1844,10 @@ struct super_block *sget(struct file_system_type *type, | |||
1782 | int (*test)(struct super_block *,void *), | 1844 | int (*test)(struct super_block *,void *), |
1783 | int (*set)(struct super_block *,void *), | 1845 | int (*set)(struct super_block *,void *), |
1784 | void *data); | 1846 | void *data); |
1785 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1847 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, |
1786 | const struct super_operations *ops, unsigned long, | 1848 | const struct super_operations *ops, |
1787 | struct vfsmount *mnt); | 1849 | const struct dentry_operations *dops, |
1788 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1850 | unsigned long); |
1789 | 1851 | ||
1790 | static inline void sb_mark_dirty(struct super_block *sb) | 1852 | static inline void sb_mark_dirty(struct super_block *sb) |
1791 | { | 1853 | { |
@@ -1818,6 +1880,8 @@ extern void drop_collected_mounts(struct vfsmount *); | |||
1818 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | 1880 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, |
1819 | struct vfsmount *); | 1881 | struct vfsmount *); |
1820 | extern int vfs_statfs(struct path *, struct kstatfs *); | 1882 | extern int vfs_statfs(struct path *, struct kstatfs *); |
1883 | extern int user_statfs(const char __user *, struct kstatfs *); | ||
1884 | extern int fd_statfs(int, struct kstatfs *); | ||
1821 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1885 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); |
1822 | extern int freeze_super(struct super_block *super); | 1886 | extern int freeze_super(struct super_block *super); |
1823 | extern int thaw_super(struct super_block *super); | 1887 | extern int thaw_super(struct super_block *super); |
@@ -1827,6 +1891,7 @@ extern int current_umask(void); | |||
1827 | /* /sys/fs */ | 1891 | /* /sys/fs */ |
1828 | extern struct kobject *fs_kobj; | 1892 | extern struct kobject *fs_kobj; |
1829 | 1893 | ||
1894 | #define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) | ||
1830 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | 1895 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); |
1831 | 1896 | ||
1832 | #define FLOCK_VERIFY_READ 1 | 1897 | #define FLOCK_VERIFY_READ 1 |
@@ -1933,6 +1998,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset, | |||
1933 | extern long do_sys_open(int dfd, const char __user *filename, int flags, | 1998 | extern long do_sys_open(int dfd, const char __user *filename, int flags, |
1934 | int mode); | 1999 | int mode); |
1935 | extern struct file *filp_open(const char *, int, int); | 2000 | extern struct file *filp_open(const char *, int, int); |
2001 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, | ||
2002 | const char *, int); | ||
1936 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, | 2003 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, |
1937 | const struct cred *); | 2004 | const struct cred *); |
1938 | extern int filp_close(struct file *, fl_owner_t id); | 2005 | extern int filp_close(struct file *, fl_owner_t id); |
@@ -1965,7 +2032,6 @@ extern struct block_device *bdgrab(struct block_device *bdev); | |||
1965 | extern void bd_set_size(struct block_device *, loff_t size); | 2032 | extern void bd_set_size(struct block_device *, loff_t size); |
1966 | extern void bd_forget(struct inode *inode); | 2033 | extern void bd_forget(struct inode *inode); |
1967 | extern void bdput(struct block_device *); | 2034 | extern void bdput(struct block_device *); |
1968 | extern struct block_device *open_by_devnum(dev_t, fmode_t); | ||
1969 | extern void invalidate_bdev(struct block_device *); | 2035 | extern void invalidate_bdev(struct block_device *); |
1970 | extern int sync_blockdev(struct block_device *bdev); | 2036 | extern int sync_blockdev(struct block_device *bdev); |
1971 | extern struct super_block *freeze_bdev(struct block_device *); | 2037 | extern struct super_block *freeze_bdev(struct block_device *); |
@@ -1996,16 +2062,26 @@ extern const struct file_operations def_fifo_fops; | |||
1996 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 2062 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
1997 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | 2063 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
1998 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 2064 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
1999 | extern int blkdev_get(struct block_device *, fmode_t); | 2065 | extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); |
2000 | extern int blkdev_put(struct block_device *, fmode_t); | 2066 | extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, |
2001 | extern int bd_claim(struct block_device *, void *); | 2067 | void *holder); |
2002 | extern void bd_release(struct block_device *); | 2068 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, |
2069 | void *holder); | ||
2070 | extern int blkdev_put(struct block_device *bdev, fmode_t mode); | ||
2003 | #ifdef CONFIG_SYSFS | 2071 | #ifdef CONFIG_SYSFS |
2004 | extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *); | 2072 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
2005 | extern void bd_release_from_disk(struct block_device *, struct gendisk *); | 2073 | extern void bd_unlink_disk_holder(struct block_device *bdev, |
2074 | struct gendisk *disk); | ||
2006 | #else | 2075 | #else |
2007 | #define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) | 2076 | static inline int bd_link_disk_holder(struct block_device *bdev, |
2008 | #define bd_release_from_disk(bdev, disk) bd_release(bdev) | 2077 | struct gendisk *disk) |
2078 | { | ||
2079 | return 0; | ||
2080 | } | ||
2081 | static inline void bd_unlink_disk_holder(struct block_device *bdev, | ||
2082 | struct gendisk *disk) | ||
2083 | { | ||
2084 | } | ||
2009 | #endif | 2085 | #endif |
2010 | #endif | 2086 | #endif |
2011 | 2087 | ||
@@ -2041,8 +2117,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) | |||
2041 | extern const char *__bdevname(dev_t, char *buffer); | 2117 | extern const char *__bdevname(dev_t, char *buffer); |
2042 | extern const char *bdevname(struct block_device *bdev, char *buffer); | 2118 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
2043 | extern struct block_device *lookup_bdev(const char *); | 2119 | extern struct block_device *lookup_bdev(const char *); |
2044 | extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *); | ||
2045 | extern void close_bdev_exclusive(struct block_device *, fmode_t); | ||
2046 | extern void blkdev_show(struct seq_file *,off_t); | 2120 | extern void blkdev_show(struct seq_file *,off_t); |
2047 | 2121 | ||
2048 | #else | 2122 | #else |
@@ -2076,10 +2150,9 @@ extern void check_disk_size_change(struct gendisk *disk, | |||
2076 | struct block_device *bdev); | 2150 | struct block_device *bdev); |
2077 | extern int revalidate_disk(struct gendisk *); | 2151 | extern int revalidate_disk(struct gendisk *); |
2078 | extern int check_disk_change(struct block_device *); | 2152 | extern int check_disk_change(struct block_device *); |
2079 | extern int __invalidate_device(struct block_device *); | 2153 | extern int __invalidate_device(struct block_device *, bool); |
2080 | extern int invalidate_partition(struct gendisk *, int); | 2154 | extern int invalidate_partition(struct gendisk *, int); |
2081 | #endif | 2155 | #endif |
2082 | extern int invalidate_inodes(struct super_block *); | ||
2083 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2156 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
2084 | pgoff_t start, pgoff_t end); | 2157 | pgoff_t start, pgoff_t end); |
2085 | 2158 | ||
@@ -2118,8 +2191,8 @@ extern sector_t bmap(struct inode *, sector_t); | |||
2118 | #endif | 2191 | #endif |
2119 | extern int notify_change(struct dentry *, struct iattr *); | 2192 | extern int notify_change(struct dentry *, struct iattr *); |
2120 | extern int inode_permission(struct inode *, int); | 2193 | extern int inode_permission(struct inode *, int); |
2121 | extern int generic_permission(struct inode *, int, | 2194 | extern int generic_permission(struct inode *, int, unsigned int, |
2122 | int (*check_acl)(struct inode *, int)); | 2195 | int (*check_acl)(struct inode *, int, unsigned int)); |
2123 | 2196 | ||
2124 | static inline bool execute_ok(struct inode *inode) | 2197 | static inline bool execute_ok(struct inode *inode) |
2125 | { | 2198 | { |
@@ -2137,15 +2210,31 @@ static inline void allow_write_access(struct file *file) | |||
2137 | if (file) | 2210 | if (file) |
2138 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2211 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
2139 | } | 2212 | } |
2213 | #ifdef CONFIG_IMA | ||
2214 | static inline void i_readcount_dec(struct inode *inode) | ||
2215 | { | ||
2216 | BUG_ON(!atomic_read(&inode->i_readcount)); | ||
2217 | atomic_dec(&inode->i_readcount); | ||
2218 | } | ||
2219 | static inline void i_readcount_inc(struct inode *inode) | ||
2220 | { | ||
2221 | atomic_inc(&inode->i_readcount); | ||
2222 | } | ||
2223 | #else | ||
2224 | static inline void i_readcount_dec(struct inode *inode) | ||
2225 | { | ||
2226 | return; | ||
2227 | } | ||
2228 | static inline void i_readcount_inc(struct inode *inode) | ||
2229 | { | ||
2230 | return; | ||
2231 | } | ||
2232 | #endif | ||
2140 | extern int do_pipe_flags(int *, int); | 2233 | extern int do_pipe_flags(int *, int); |
2141 | extern struct file *create_read_pipe(struct file *f, int flags); | 2234 | extern struct file *create_read_pipe(struct file *f, int flags); |
2142 | extern struct file *create_write_pipe(int flags); | 2235 | extern struct file *create_write_pipe(int flags); |
2143 | extern void free_write_pipe(struct file *); | 2236 | extern void free_write_pipe(struct file *); |
2144 | 2237 | ||
2145 | extern struct file *do_filp_open(int dfd, const char *pathname, | ||
2146 | int open_flag, int mode, int acc_mode); | ||
2147 | extern int may_open(struct path *, int, int); | ||
2148 | |||
2149 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2238 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2150 | extern struct file * open_exec(const char *); | 2239 | extern struct file * open_exec(const char *); |
2151 | 2240 | ||
@@ -2163,7 +2252,8 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
2163 | 2252 | ||
2164 | extern int inode_init_always(struct super_block *, struct inode *); | 2253 | extern int inode_init_always(struct super_block *, struct inode *); |
2165 | extern void inode_init_once(struct inode *); | 2254 | extern void inode_init_once(struct inode *); |
2166 | extern void inode_add_to_lists(struct super_block *, struct inode *); | 2255 | extern void address_space_init_once(struct address_space *mapping); |
2256 | extern void ihold(struct inode * inode); | ||
2167 | extern void iput(struct inode *); | 2257 | extern void iput(struct inode *); |
2168 | extern struct inode * igrab(struct inode *); | 2258 | extern struct inode * igrab(struct inode *); |
2169 | extern ino_t iunique(struct super_block *, ino_t); | 2259 | extern ino_t iunique(struct super_block *, ino_t); |
@@ -2183,21 +2273,24 @@ extern struct inode * iget_locked(struct super_block *, unsigned long); | |||
2183 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); | 2273 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); |
2184 | extern int insert_inode_locked(struct inode *); | 2274 | extern int insert_inode_locked(struct inode *); |
2185 | extern void unlock_new_inode(struct inode *); | 2275 | extern void unlock_new_inode(struct inode *); |
2276 | extern unsigned int get_next_ino(void); | ||
2186 | 2277 | ||
2187 | extern void __iget(struct inode * inode); | 2278 | extern void __iget(struct inode * inode); |
2188 | extern void iget_failed(struct inode *); | 2279 | extern void iget_failed(struct inode *); |
2189 | extern void end_writeback(struct inode *); | 2280 | extern void end_writeback(struct inode *); |
2190 | extern void destroy_inode(struct inode *); | ||
2191 | extern void __destroy_inode(struct inode *); | 2281 | extern void __destroy_inode(struct inode *); |
2192 | extern struct inode *new_inode(struct super_block *); | 2282 | extern struct inode *new_inode(struct super_block *); |
2283 | extern void free_inode_nonrcu(struct inode *inode); | ||
2193 | extern int should_remove_suid(struct dentry *); | 2284 | extern int should_remove_suid(struct dentry *); |
2194 | extern int file_remove_suid(struct file *); | 2285 | extern int file_remove_suid(struct file *); |
2195 | 2286 | ||
2196 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 2287 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
2197 | extern void remove_inode_hash(struct inode *); | 2288 | extern void remove_inode_hash(struct inode *); |
2198 | static inline void insert_inode_hash(struct inode *inode) { | 2289 | static inline void insert_inode_hash(struct inode *inode) |
2290 | { | ||
2199 | __insert_inode_hash(inode, inode->i_ino); | 2291 | __insert_inode_hash(inode, inode->i_ino); |
2200 | } | 2292 | } |
2293 | extern void inode_sb_list_add(struct inode *inode); | ||
2201 | 2294 | ||
2202 | #ifdef CONFIG_BLOCK | 2295 | #ifdef CONFIG_BLOCK |
2203 | extern void submit_bio(int, struct bio *); | 2296 | extern void submit_bio(int, struct bio *); |
@@ -2381,6 +2474,8 @@ extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, | |||
2381 | 2474 | ||
2382 | extern int generic_file_fsync(struct file *, int); | 2475 | extern int generic_file_fsync(struct file *, int); |
2383 | 2476 | ||
2477 | extern int generic_check_addressable(unsigned, u64); | ||
2478 | |||
2384 | #ifdef CONFIG_MIGRATION | 2479 | #ifdef CONFIG_MIGRATION |
2385 | extern int buffer_migrate_page(struct address_space *, | 2480 | extern int buffer_migrate_page(struct address_space *, |
2386 | struct page *, struct page *); | 2481 | struct page *, struct page *); |
@@ -2402,6 +2497,10 @@ static inline ino_t parent_ino(struct dentry *dentry) | |||
2402 | { | 2497 | { |
2403 | ino_t res; | 2498 | ino_t res; |
2404 | 2499 | ||
2500 | /* | ||
2501 | * Don't strictly need d_lock here? If the parent ino could change | ||
2502 | * then surely we'd have a deeper race in the caller? | ||
2503 | */ | ||
2405 | spin_lock(&dentry->d_lock); | 2504 | spin_lock(&dentry->d_lock); |
2406 | res = dentry->d_parent->d_inode->i_ino; | 2505 | res = dentry->d_parent->d_inode->i_ino; |
2407 | spin_unlock(&dentry->d_lock); | 2506 | spin_unlock(&dentry->d_lock); |
@@ -2457,6 +2556,7 @@ static const struct file_operations __fops = { \ | |||
2457 | .release = simple_attr_release, \ | 2556 | .release = simple_attr_release, \ |
2458 | .read = simple_attr_read, \ | 2557 | .read = simple_attr_read, \ |
2459 | .write = simple_attr_write, \ | 2558 | .write = simple_attr_write, \ |
2559 | .llseek = generic_file_llseek, \ | ||
2460 | }; | 2560 | }; |
2461 | 2561 | ||
2462 | static inline void __attribute__((format(printf, 1, 2))) | 2562 | static inline void __attribute__((format(printf, 1, 2))) |
@@ -2477,12 +2577,29 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, | |||
2477 | struct ctl_table; | 2577 | struct ctl_table; |
2478 | int proc_nr_files(struct ctl_table *table, int write, | 2578 | int proc_nr_files(struct ctl_table *table, int write, |
2479 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2579 | void __user *buffer, size_t *lenp, loff_t *ppos); |
2480 | 2580 | int proc_nr_dentry(struct ctl_table *table, int write, | |
2581 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
2582 | int proc_nr_inodes(struct ctl_table *table, int write, | ||
2583 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
2481 | int __init get_filesystem_list(char *buf); | 2584 | int __init get_filesystem_list(char *buf); |
2482 | 2585 | ||
2586 | #define __FMODE_EXEC ((__force int) FMODE_EXEC) | ||
2587 | #define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY) | ||
2588 | |||
2483 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | 2589 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) |
2484 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ | 2590 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ |
2485 | (flag & FMODE_NONOTIFY))) | 2591 | (flag & __FMODE_NONOTIFY))) |
2592 | |||
2593 | static inline int is_sxid(mode_t mode) | ||
2594 | { | ||
2595 | return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); | ||
2596 | } | ||
2597 | |||
2598 | static inline void inode_has_no_xattr(struct inode *inode) | ||
2599 | { | ||
2600 | if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) | ||
2601 | inode->i_flags |= S_NOSEC; | ||
2602 | } | ||
2486 | 2603 | ||
2487 | #endif /* __KERNEL__ */ | 2604 | #endif /* __KERNEL__ */ |
2488 | #endif /* _LINUX_FS_H */ | 2605 | #endif /* _LINUX_FS_H */ |