aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h71
1 files changed, 43 insertions, 28 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 334d68a17108..baf3e556ff0e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -34,9 +34,9 @@
34#define SEEK_MAX SEEK_END 34#define SEEK_MAX SEEK_END
35 35
36struct fstrim_range { 36struct fstrim_range {
37 uint64_t start; 37 __u64 start;
38 uint64_t len; 38 __u64 len;
39 uint64_t minlen; 39 __u64 minlen;
40}; 40};
41 41
42/* And dynamically-tunable limits and defaults: */ 42/* And dynamically-tunable limits and defaults: */
@@ -392,6 +392,7 @@ struct inodes_stat_t {
392#include <linux/capability.h> 392#include <linux/capability.h>
393#include <linux/semaphore.h> 393#include <linux/semaphore.h>
394#include <linux/fiemap.h> 394#include <linux/fiemap.h>
395#include <linux/rculist_bl.h>
395 396
396#include <asm/atomic.h> 397#include <asm/atomic.h>
397#include <asm/byteorder.h> 398#include <asm/byteorder.h>
@@ -602,6 +603,7 @@ struct address_space_operations {
602 sector_t (*bmap)(struct address_space *, sector_t); 603 sector_t (*bmap)(struct address_space *, sector_t);
603 void (*invalidatepage) (struct page *, unsigned long); 604 void (*invalidatepage) (struct page *, unsigned long);
604 int (*releasepage) (struct page *, gfp_t); 605 int (*releasepage) (struct page *, gfp_t);
606 void (*freepage)(struct page *);
605 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 607 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
606 loff_t offset, unsigned long nr_segs); 608 loff_t offset, unsigned long nr_segs);
607 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 609 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
@@ -732,16 +734,31 @@ struct posix_acl;
732#define ACL_NOT_CACHED ((void *)(-1)) 734#define ACL_NOT_CACHED ((void *)(-1))
733 735
734struct inode { 736struct inode {
737 /* RCU path lookup touches following: */
738 umode_t i_mode;
739 uid_t i_uid;
740 gid_t i_gid;
741 const struct inode_operations *i_op;
742 struct super_block *i_sb;
743
744 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
745 unsigned int i_flags;
746 struct mutex i_mutex;
747
748 unsigned long i_state;
749 unsigned long dirtied_when; /* jiffies of first dirtying */
750
735 struct hlist_node i_hash; 751 struct hlist_node i_hash;
736 struct list_head i_wb_list; /* backing dev IO list */ 752 struct list_head i_wb_list; /* backing dev IO list */
737 struct list_head i_lru; /* inode LRU list */ 753 struct list_head i_lru; /* inode LRU list */
738 struct list_head i_sb_list; 754 struct list_head i_sb_list;
739 struct list_head i_dentry; 755 union {
756 struct list_head i_dentry;
757 struct rcu_head i_rcu;
758 };
740 unsigned long i_ino; 759 unsigned long i_ino;
741 atomic_t i_count; 760 atomic_t i_count;
742 unsigned int i_nlink; 761 unsigned int i_nlink;
743 uid_t i_uid;
744 gid_t i_gid;
745 dev_t i_rdev; 762 dev_t i_rdev;
746 unsigned int i_blkbits; 763 unsigned int i_blkbits;
747 u64 i_version; 764 u64 i_version;
@@ -754,13 +771,8 @@ struct inode {
754 struct timespec i_ctime; 771 struct timespec i_ctime;
755 blkcnt_t i_blocks; 772 blkcnt_t i_blocks;
756 unsigned short i_bytes; 773 unsigned short i_bytes;
757 umode_t i_mode;
758 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
759 struct mutex i_mutex;
760 struct rw_semaphore i_alloc_sem; 774 struct rw_semaphore i_alloc_sem;
761 const struct inode_operations *i_op;
762 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 775 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
763 struct super_block *i_sb;
764 struct file_lock *i_flock; 776 struct file_lock *i_flock;
765 struct address_space *i_mapping; 777 struct address_space *i_mapping;
766 struct address_space i_data; 778 struct address_space i_data;
@@ -781,11 +793,6 @@ struct inode {
781 struct hlist_head i_fsnotify_marks; 793 struct hlist_head i_fsnotify_marks;
782#endif 794#endif
783 795
784 unsigned long i_state;
785 unsigned long dirtied_when; /* jiffies of first dirtying */
786
787 unsigned int i_flags;
788
789#ifdef CONFIG_IMA 796#ifdef CONFIG_IMA
790 /* protected by i_lock */ 797 /* protected by i_lock */
791 unsigned int i_readcount; /* struct files open RO */ 798 unsigned int i_readcount; /* struct files open RO */
@@ -1371,13 +1378,13 @@ struct super_block {
1371 const struct xattr_handler **s_xattr; 1378 const struct xattr_handler **s_xattr;
1372 1379
1373 struct list_head s_inodes; /* all inodes */ 1380 struct list_head s_inodes; /* all inodes */
1374 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1381 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
1375#ifdef CONFIG_SMP 1382#ifdef CONFIG_SMP
1376 struct list_head __percpu *s_files; 1383 struct list_head __percpu *s_files;
1377#else 1384#else
1378 struct list_head s_files; 1385 struct list_head s_files;
1379#endif 1386#endif
1380 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1387 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1381 struct list_head s_dentry_lru; /* unused dentry lru */ 1388 struct list_head s_dentry_lru; /* unused dentry lru */
1382 int s_nr_dentry_unused; /* # of dentry on lru */ 1389 int s_nr_dentry_unused; /* # of dentry on lru */
1383 1390
@@ -1544,9 +1551,18 @@ struct file_operations {
1544 int (*setlease)(struct file *, long, struct file_lock **); 1551 int (*setlease)(struct file *, long, struct file_lock **);
1545}; 1552};
1546 1553
1554#define IPERM_FLAG_RCU 0x0001
1555
1547struct inode_operations { 1556struct inode_operations {
1548 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
1549 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1557 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1558 void * (*follow_link) (struct dentry *, struct nameidata *);
1559 int (*permission) (struct inode *, int, unsigned int);
1560 int (*check_acl)(struct inode *, int, unsigned int);
1561
1562 int (*readlink) (struct dentry *, char __user *,int);
1563 void (*put_link) (struct dentry *, struct nameidata *, void *);
1564
1565 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
1550 int (*link) (struct dentry *,struct inode *,struct dentry *); 1566 int (*link) (struct dentry *,struct inode *,struct dentry *);
1551 int (*unlink) (struct inode *,struct dentry *); 1567 int (*unlink) (struct inode *,struct dentry *);
1552 int (*symlink) (struct inode *,struct dentry *,const char *); 1568 int (*symlink) (struct inode *,struct dentry *,const char *);
@@ -1555,12 +1571,7 @@ struct inode_operations {
1555 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1571 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
1556 int (*rename) (struct inode *, struct dentry *, 1572 int (*rename) (struct inode *, struct dentry *,
1557 struct inode *, struct dentry *); 1573 struct inode *, struct dentry *);
1558 int (*readlink) (struct dentry *, char __user *,int);
1559 void * (*follow_link) (struct dentry *, struct nameidata *);
1560 void (*put_link) (struct dentry *, struct nameidata *, void *);
1561 void (*truncate) (struct inode *); 1574 void (*truncate) (struct inode *);
1562 int (*permission) (struct inode *, int);
1563 int (*check_acl)(struct inode *, int);
1564 int (*setattr) (struct dentry *, struct iattr *); 1575 int (*setattr) (struct dentry *, struct iattr *);
1565 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1576 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1566 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1577 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1572,7 +1583,7 @@ struct inode_operations {
1572 loff_t len); 1583 loff_t len);
1573 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, 1584 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1574 u64 len); 1585 u64 len);
1575}; 1586} ____cacheline_aligned;
1576 1587
1577struct seq_file; 1588struct seq_file;
1578 1589
@@ -1612,7 +1623,6 @@ struct super_operations {
1612 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1623 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1613#endif 1624#endif
1614 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1625 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1615 int (*trim_fs) (struct super_block *, struct fstrim_range *);
1616}; 1626};
1617 1627
1618/* 1628/*
@@ -2158,8 +2168,8 @@ extern sector_t bmap(struct inode *, sector_t);
2158#endif 2168#endif
2159extern int notify_change(struct dentry *, struct iattr *); 2169extern int notify_change(struct dentry *, struct iattr *);
2160extern int inode_permission(struct inode *, int); 2170extern int inode_permission(struct inode *, int);
2161extern int generic_permission(struct inode *, int, 2171extern int generic_permission(struct inode *, int, unsigned int,
2162 int (*check_acl)(struct inode *, int)); 2172 int (*check_acl)(struct inode *, int, unsigned int));
2163 2173
2164static inline bool execute_ok(struct inode *inode) 2174static inline bool execute_ok(struct inode *inode)
2165{ 2175{
@@ -2230,6 +2240,7 @@ extern void iget_failed(struct inode *);
2230extern void end_writeback(struct inode *); 2240extern void end_writeback(struct inode *);
2231extern void __destroy_inode(struct inode *); 2241extern void __destroy_inode(struct inode *);
2232extern struct inode *new_inode(struct super_block *); 2242extern struct inode *new_inode(struct super_block *);
2243extern void free_inode_nonrcu(struct inode *inode);
2233extern int should_remove_suid(struct dentry *); 2244extern int should_remove_suid(struct dentry *);
2234extern int file_remove_suid(struct file *); 2245extern int file_remove_suid(struct file *);
2235 2246
@@ -2446,6 +2457,10 @@ static inline ino_t parent_ino(struct dentry *dentry)
2446{ 2457{
2447 ino_t res; 2458 ino_t res;
2448 2459
2460 /*
2461 * Don't strictly need d_lock here? If the parent ino could change
2462 * then surely we'd have a deeper race in the caller?
2463 */
2449 spin_lock(&dentry->d_lock); 2464 spin_lock(&dentry->d_lock);
2450 res = dentry->d_parent->d_inode->i_ino; 2465 res = dentry->d_parent->d_inode->i_ino;
2451 spin_unlock(&dentry->d_lock); 2466 spin_unlock(&dentry->d_lock);