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.h107
1 files changed, 32 insertions, 75 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e0bc4ffb8e7f..7aacf31418fe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1428,6 +1428,7 @@ struct super_block {
1428#else 1428#else
1429 struct list_head s_files; 1429 struct list_head s_files;
1430#endif 1430#endif
1431 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1431 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ 1432 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1432 struct list_head s_dentry_lru; /* unused dentry lru */ 1433 struct list_head s_dentry_lru; /* unused dentry lru */
1433 int s_nr_dentry_unused; /* # of dentry on lru */ 1434 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1440,7 +1441,7 @@ struct super_block {
1440 struct block_device *s_bdev; 1441 struct block_device *s_bdev;
1441 struct backing_dev_info *s_bdi; 1442 struct backing_dev_info *s_bdi;
1442 struct mtd_info *s_mtd; 1443 struct mtd_info *s_mtd;
1443 struct list_head s_instances; 1444 struct hlist_node s_instances;
1444 struct quota_info s_dquot; /* Diskquota specific options */ 1445 struct quota_info s_dquot; /* Diskquota specific options */
1445 1446
1446 int s_frozen; 1447 int s_frozen;
@@ -1481,6 +1482,12 @@ struct super_block {
1481 int cleancache_poolid; 1482 int cleancache_poolid;
1482 1483
1483 struct shrinker s_shrink; /* per-sb shrinker handle */ 1484 struct shrinker s_shrink; /* per-sb shrinker handle */
1485
1486 /* Number of inodes with nlink == 0 but still referenced */
1487 atomic_long_t s_remove_count;
1488
1489 /* Being remounted read-only */
1490 int s_readonly_remount;
1484}; 1491};
1485 1492
1486/* superblock cache pruning functions */ 1493/* superblock cache pruning functions */
@@ -1516,9 +1523,9 @@ extern void unlock_super(struct super_block *);
1516/* 1523/*
1517 * VFS helper functions.. 1524 * VFS helper functions..
1518 */ 1525 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1526extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1527extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1528extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1529extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1530extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1531extern int vfs_rmdir(struct inode *, struct dentry *);
@@ -1534,7 +1541,7 @@ extern void dentry_unhash(struct dentry *dentry);
1534 * VFS file helper functions. 1541 * VFS file helper functions.
1535 */ 1542 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1543extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1537 mode_t mode); 1544 umode_t mode);
1538/* 1545/*
1539 * VFS FS_IOC_FIEMAP helper definitions. 1546 * VFS FS_IOC_FIEMAP helper definitions.
1540 */ 1547 */
@@ -1619,13 +1626,13 @@ struct inode_operations {
1619 int (*readlink) (struct dentry *, char __user *,int); 1626 int (*readlink) (struct dentry *, char __user *,int);
1620 void (*put_link) (struct dentry *, struct nameidata *, void *); 1627 void (*put_link) (struct dentry *, struct nameidata *, void *);
1621 1628
1622 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 1629 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1623 int (*link) (struct dentry *,struct inode *,struct dentry *); 1630 int (*link) (struct dentry *,struct inode *,struct dentry *);
1624 int (*unlink) (struct inode *,struct dentry *); 1631 int (*unlink) (struct inode *,struct dentry *);
1625 int (*symlink) (struct inode *,struct dentry *,const char *); 1632 int (*symlink) (struct inode *,struct dentry *,const char *);
1626 int (*mkdir) (struct inode *,struct dentry *,int); 1633 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1627 int (*rmdir) (struct inode *,struct dentry *); 1634 int (*rmdir) (struct inode *,struct dentry *);
1628 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1635 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1629 int (*rename) (struct inode *, struct dentry *, 1636 int (*rename) (struct inode *, struct dentry *,
1630 struct inode *, struct dentry *); 1637 struct inode *, struct dentry *);
1631 void (*truncate) (struct inode *); 1638 void (*truncate) (struct inode *);
@@ -1672,10 +1679,10 @@ struct super_operations {
1672 int (*remount_fs) (struct super_block *, int *, char *); 1679 int (*remount_fs) (struct super_block *, int *, char *);
1673 void (*umount_begin) (struct super_block *); 1680 void (*umount_begin) (struct super_block *);
1674 1681
1675 int (*show_options)(struct seq_file *, struct vfsmount *); 1682 int (*show_options)(struct seq_file *, struct dentry *);
1676 int (*show_devname)(struct seq_file *, struct vfsmount *); 1683 int (*show_devname)(struct seq_file *, struct dentry *);
1677 int (*show_path)(struct seq_file *, struct vfsmount *); 1684 int (*show_path)(struct seq_file *, struct dentry *);
1678 int (*show_stats)(struct seq_file *, struct vfsmount *); 1685 int (*show_stats)(struct seq_file *, struct dentry *);
1679#ifdef CONFIG_QUOTA 1686#ifdef CONFIG_QUOTA
1680 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1687 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1681 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1688 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1764,31 +1771,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1764 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1771 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1765} 1772}
1766 1773
1767/** 1774extern void inc_nlink(struct inode *inode);
1768 * set_nlink - directly set an inode's link count 1775extern void drop_nlink(struct inode *inode);
1769 * @inode: inode 1776extern void clear_nlink(struct inode *inode);
1770 * @nlink: new nlink (should be non-zero) 1777extern void set_nlink(struct inode *inode, unsigned int nlink);
1771 *
1772 * This is a low-level filesystem helper to replace any
1773 * direct filesystem manipulation of i_nlink.
1774 */
1775static inline void set_nlink(struct inode *inode, unsigned int nlink)
1776{
1777 inode->__i_nlink = nlink;
1778}
1779
1780/**
1781 * inc_nlink - directly increment an inode's link count
1782 * @inode: inode
1783 *
1784 * This is a low-level filesystem helper to replace any
1785 * direct filesystem manipulation of i_nlink. Currently,
1786 * it is only here for parity with dec_nlink().
1787 */
1788static inline void inc_nlink(struct inode *inode)
1789{
1790 inode->__i_nlink++;
1791}
1792 1778
1793static inline void inode_inc_link_count(struct inode *inode) 1779static inline void inode_inc_link_count(struct inode *inode)
1794{ 1780{
@@ -1796,35 +1782,6 @@ static inline void inode_inc_link_count(struct inode *inode)
1796 mark_inode_dirty(inode); 1782 mark_inode_dirty(inode);
1797} 1783}
1798 1784
1799/**
1800 * drop_nlink - directly drop an inode's link count
1801 * @inode: inode
1802 *
1803 * This is a low-level filesystem helper to replace any
1804 * direct filesystem manipulation of i_nlink. In cases
1805 * where we are attempting to track writes to the
1806 * filesystem, a decrement to zero means an imminent
1807 * write when the file is truncated and actually unlinked
1808 * on the filesystem.
1809 */
1810static inline void drop_nlink(struct inode *inode)
1811{
1812 inode->__i_nlink--;
1813}
1814
1815/**
1816 * clear_nlink - directly zero an inode's link count
1817 * @inode: inode
1818 *
1819 * This is a low-level filesystem helper to replace any
1820 * direct filesystem manipulation of i_nlink. See
1821 * drop_nlink() for why we care about i_nlink hitting zero.
1822 */
1823static inline void clear_nlink(struct inode *inode)
1824{
1825 inode->__i_nlink = 0;
1826}
1827
1828static inline void inode_dec_link_count(struct inode *inode) 1785static inline void inode_dec_link_count(struct inode *inode)
1829{ 1786{
1830 drop_nlink(inode); 1787 drop_nlink(inode);
@@ -1864,7 +1821,7 @@ struct file_system_type {
1864 void (*kill_sb) (struct super_block *); 1821 void (*kill_sb) (struct super_block *);
1865 struct module *owner; 1822 struct module *owner;
1866 struct file_system_type * next; 1823 struct file_system_type * next;
1867 struct list_head fs_supers; 1824 struct hlist_head fs_supers;
1868 1825
1869 struct lock_class_key s_lock_key; 1826 struct lock_class_key s_lock_key;
1870 struct lock_class_key s_umount_key; 1827 struct lock_class_key s_umount_key;
@@ -1939,7 +1896,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1939extern int vfs_statfs(struct path *, struct kstatfs *); 1896extern int vfs_statfs(struct path *, struct kstatfs *);
1940extern int user_statfs(const char __user *, struct kstatfs *); 1897extern int user_statfs(const char __user *, struct kstatfs *);
1941extern int fd_statfs(int, struct kstatfs *); 1898extern int fd_statfs(int, struct kstatfs *);
1942extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1899extern int vfs_ustat(dev_t, struct kstatfs *);
1943extern int freeze_super(struct super_block *super); 1900extern int freeze_super(struct super_block *super);
1944extern int thaw_super(struct super_block *super); 1901extern int thaw_super(struct super_block *super);
1945extern bool our_mnt(struct vfsmount *mnt); 1902extern bool our_mnt(struct vfsmount *mnt);
@@ -2054,8 +2011,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2054extern int do_fallocate(struct file *file, int mode, loff_t offset, 2011extern int do_fallocate(struct file *file, int mode, loff_t offset,
2055 loff_t len); 2012 loff_t len);
2056extern long do_sys_open(int dfd, const char __user *filename, int flags, 2013extern long do_sys_open(int dfd, const char __user *filename, int flags,
2057 int mode); 2014 umode_t mode);
2058extern struct file *filp_open(const char *, int, int); 2015extern struct file *filp_open(const char *, int, umode_t);
2059extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2016extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2060 const char *, int); 2017 const char *, int);
2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2018extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2092,6 +2049,7 @@ extern void bd_forget(struct inode *inode);
2092extern void bdput(struct block_device *); 2049extern void bdput(struct block_device *);
2093extern void invalidate_bdev(struct block_device *); 2050extern void invalidate_bdev(struct block_device *);
2094extern int sync_blockdev(struct block_device *bdev); 2051extern int sync_blockdev(struct block_device *bdev);
2052extern void kill_bdev(struct block_device *);
2095extern struct super_block *freeze_bdev(struct block_device *); 2053extern struct super_block *freeze_bdev(struct block_device *);
2096extern void emergency_thaw_all(void); 2054extern void emergency_thaw_all(void);
2097extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2055extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
@@ -2099,6 +2057,7 @@ extern int fsync_bdev(struct block_device *);
2099#else 2057#else
2100static inline void bd_forget(struct inode *inode) {} 2058static inline void bd_forget(struct inode *inode) {}
2101static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2059static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2060static inline void kill_bdev(struct block_device *bdev) {}
2102static inline void invalidate_bdev(struct block_device *bdev) {} 2061static inline void invalidate_bdev(struct block_device *bdev) {}
2103 2062
2104static inline struct super_block *freeze_bdev(struct block_device *sb) 2063static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2191,8 +2150,6 @@ extern const struct file_operations read_pipefifo_fops;
2191extern const struct file_operations write_pipefifo_fops; 2150extern const struct file_operations write_pipefifo_fops;
2192extern const struct file_operations rdwr_pipefifo_fops; 2151extern const struct file_operations rdwr_pipefifo_fops;
2193 2152
2194extern int fs_may_remount_ro(struct super_block *);
2195
2196#ifdef CONFIG_BLOCK 2153#ifdef CONFIG_BLOCK
2197/* 2154/*
2198 * return READ, READA, or WRITE 2155 * return READ, READA, or WRITE
@@ -2415,6 +2372,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2415 unsigned long nr_segs, loff_t pos); 2372 unsigned long nr_segs, loff_t pos);
2416extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2373extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2417 int datasync); 2374 int datasync);
2375extern void block_sync_page(struct page *page);
2418 2376
2419/* fs/splice.c */ 2377/* fs/splice.c */
2420extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2378extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2531,7 +2489,6 @@ extern void put_filesystem(struct file_system_type *fs);
2531extern struct file_system_type *get_fs_type(const char *name); 2489extern struct file_system_type *get_fs_type(const char *name);
2532extern struct super_block *get_super(struct block_device *); 2490extern struct super_block *get_super(struct block_device *);
2533extern struct super_block *get_active_super(struct block_device *bdev); 2491extern struct super_block *get_active_super(struct block_device *bdev);
2534extern struct super_block *user_get_super(dev_t);
2535extern void drop_super(struct super_block *sb); 2492extern void drop_super(struct super_block *sb);
2536extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2493extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2537extern void iterate_supers_type(struct file_system_type *, 2494extern void iterate_supers_type(struct file_system_type *,
@@ -2590,7 +2547,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2590 2547
2591extern void file_update_time(struct file *file); 2548extern void file_update_time(struct file *file);
2592 2549
2593extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2550extern int generic_show_options(struct seq_file *m, struct dentry *root);
2594extern void save_mount_options(struct super_block *sb, char *options); 2551extern void save_mount_options(struct super_block *sb, char *options);
2595extern void replace_mount_options(struct super_block *sb, char *options); 2552extern void replace_mount_options(struct super_block *sb, char *options);
2596 2553
@@ -2691,7 +2648,7 @@ int __init get_filesystem_list(char *buf);
2691#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2648#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2692 (flag & __FMODE_NONOTIFY))) 2649 (flag & __FMODE_NONOTIFY)))
2693 2650
2694static inline int is_sxid(mode_t mode) 2651static inline int is_sxid(umode_t mode)
2695{ 2652{
2696 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2653 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2697} 2654}