diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 121 |
1 files changed, 43 insertions, 78 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index e0bc4ffb8e7f..4bc8169fb5a1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -525,6 +525,7 @@ enum positive_aop_returns { | |||
525 | struct page; | 525 | struct page; |
526 | struct address_space; | 526 | struct address_space; |
527 | struct writeback_control; | 527 | struct writeback_control; |
528 | enum migrate_mode; | ||
528 | 529 | ||
529 | struct iov_iter { | 530 | struct iov_iter { |
530 | const struct iovec *iov; | 531 | const struct iovec *iov; |
@@ -609,9 +610,12 @@ struct address_space_operations { | |||
609 | loff_t offset, unsigned long nr_segs); | 610 | loff_t offset, unsigned long nr_segs); |
610 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, | 611 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, |
611 | void **, unsigned long *); | 612 | void **, unsigned long *); |
612 | /* migrate the contents of a page to the specified target */ | 613 | /* |
614 | * migrate the contents of a page to the specified target. If sync | ||
615 | * is false, it must not block. | ||
616 | */ | ||
613 | int (*migratepage) (struct address_space *, | 617 | int (*migratepage) (struct address_space *, |
614 | struct page *, struct page *); | 618 | struct page *, struct page *, enum migrate_mode); |
615 | int (*launder_page) (struct page *); | 619 | int (*launder_page) (struct page *); |
616 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, | 620 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, |
617 | unsigned long); | 621 | unsigned long); |
@@ -656,6 +660,7 @@ struct address_space { | |||
656 | * must be enforced here for CRIS, to let the least significant bit | 660 | * must be enforced here for CRIS, to let the least significant bit |
657 | * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. | 661 | * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. |
658 | */ | 662 | */ |
663 | struct request_queue; | ||
659 | 664 | ||
660 | struct block_device { | 665 | struct block_device { |
661 | dev_t bd_dev; /* not a kdev_t - it's a search key */ | 666 | dev_t bd_dev; /* not a kdev_t - it's a search key */ |
@@ -678,6 +683,7 @@ struct block_device { | |||
678 | unsigned bd_part_count; | 683 | unsigned bd_part_count; |
679 | int bd_invalidated; | 684 | int bd_invalidated; |
680 | struct gendisk * bd_disk; | 685 | struct gendisk * bd_disk; |
686 | struct request_queue * bd_queue; | ||
681 | struct list_head bd_list; | 687 | struct list_head bd_list; |
682 | /* | 688 | /* |
683 | * Private data. You must have bd_claim'ed the block_device | 689 | * Private data. You must have bd_claim'ed the block_device |
@@ -1001,6 +1007,7 @@ struct file { | |||
1001 | #ifdef CONFIG_EPOLL | 1007 | #ifdef CONFIG_EPOLL |
1002 | /* Used by fs/eventpoll.c to link all the hooks to this file */ | 1008 | /* Used by fs/eventpoll.c to link all the hooks to this file */ |
1003 | struct list_head f_ep_links; | 1009 | struct list_head f_ep_links; |
1010 | struct list_head f_tfile_llink; | ||
1004 | #endif /* #ifdef CONFIG_EPOLL */ | 1011 | #endif /* #ifdef CONFIG_EPOLL */ |
1005 | struct address_space *f_mapping; | 1012 | struct address_space *f_mapping; |
1006 | #ifdef CONFIG_DEBUG_WRITECOUNT | 1013 | #ifdef CONFIG_DEBUG_WRITECOUNT |
@@ -1428,6 +1435,7 @@ struct super_block { | |||
1428 | #else | 1435 | #else |
1429 | struct list_head s_files; | 1436 | struct list_head s_files; |
1430 | #endif | 1437 | #endif |
1438 | 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 */ | 1439 | /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ |
1432 | struct list_head s_dentry_lru; /* unused dentry lru */ | 1440 | struct list_head s_dentry_lru; /* unused dentry lru */ |
1433 | int s_nr_dentry_unused; /* # of dentry on lru */ | 1441 | int s_nr_dentry_unused; /* # of dentry on lru */ |
@@ -1440,7 +1448,7 @@ struct super_block { | |||
1440 | struct block_device *s_bdev; | 1448 | struct block_device *s_bdev; |
1441 | struct backing_dev_info *s_bdi; | 1449 | struct backing_dev_info *s_bdi; |
1442 | struct mtd_info *s_mtd; | 1450 | struct mtd_info *s_mtd; |
1443 | struct list_head s_instances; | 1451 | struct hlist_node s_instances; |
1444 | struct quota_info s_dquot; /* Diskquota specific options */ | 1452 | struct quota_info s_dquot; /* Diskquota specific options */ |
1445 | 1453 | ||
1446 | int s_frozen; | 1454 | int s_frozen; |
@@ -1481,6 +1489,12 @@ struct super_block { | |||
1481 | int cleancache_poolid; | 1489 | int cleancache_poolid; |
1482 | 1490 | ||
1483 | struct shrinker s_shrink; /* per-sb shrinker handle */ | 1491 | struct shrinker s_shrink; /* per-sb shrinker handle */ |
1492 | |||
1493 | /* Number of inodes with nlink == 0 but still referenced */ | ||
1494 | atomic_long_t s_remove_count; | ||
1495 | |||
1496 | /* Being remounted read-only */ | ||
1497 | int s_readonly_remount; | ||
1484 | }; | 1498 | }; |
1485 | 1499 | ||
1486 | /* superblock cache pruning functions */ | 1500 | /* superblock cache pruning functions */ |
@@ -1516,9 +1530,9 @@ extern void unlock_super(struct super_block *); | |||
1516 | /* | 1530 | /* |
1517 | * VFS helper functions.. | 1531 | * VFS helper functions.. |
1518 | */ | 1532 | */ |
1519 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 1533 | extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *); |
1520 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 1534 | extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); |
1521 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 1535 | extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); |
1522 | extern int vfs_symlink(struct inode *, struct dentry *, const char *); | 1536 | extern int vfs_symlink(struct inode *, struct dentry *, const char *); |
1523 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); | 1537 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); |
1524 | extern int vfs_rmdir(struct inode *, struct dentry *); | 1538 | extern int vfs_rmdir(struct inode *, struct dentry *); |
@@ -1534,7 +1548,7 @@ extern void dentry_unhash(struct dentry *dentry); | |||
1534 | * VFS file helper functions. | 1548 | * VFS file helper functions. |
1535 | */ | 1549 | */ |
1536 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, | 1550 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, |
1537 | mode_t mode); | 1551 | umode_t mode); |
1538 | /* | 1552 | /* |
1539 | * VFS FS_IOC_FIEMAP helper definitions. | 1553 | * VFS FS_IOC_FIEMAP helper definitions. |
1540 | */ | 1554 | */ |
@@ -1619,13 +1633,13 @@ struct inode_operations { | |||
1619 | int (*readlink) (struct dentry *, char __user *,int); | 1633 | int (*readlink) (struct dentry *, char __user *,int); |
1620 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1634 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1621 | 1635 | ||
1622 | int (*create) (struct inode *,struct dentry *,int, struct nameidata *); | 1636 | int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *); |
1623 | int (*link) (struct dentry *,struct inode *,struct dentry *); | 1637 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
1624 | int (*unlink) (struct inode *,struct dentry *); | 1638 | int (*unlink) (struct inode *,struct dentry *); |
1625 | int (*symlink) (struct inode *,struct dentry *,const char *); | 1639 | int (*symlink) (struct inode *,struct dentry *,const char *); |
1626 | int (*mkdir) (struct inode *,struct dentry *,int); | 1640 | int (*mkdir) (struct inode *,struct dentry *,umode_t); |
1627 | int (*rmdir) (struct inode *,struct dentry *); | 1641 | int (*rmdir) (struct inode *,struct dentry *); |
1628 | int (*mknod) (struct inode *,struct dentry *,int,dev_t); | 1642 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); |
1629 | int (*rename) (struct inode *, struct dentry *, | 1643 | int (*rename) (struct inode *, struct dentry *, |
1630 | struct inode *, struct dentry *); | 1644 | struct inode *, struct dentry *); |
1631 | void (*truncate) (struct inode *); | 1645 | void (*truncate) (struct inode *); |
@@ -1672,10 +1686,10 @@ struct super_operations { | |||
1672 | int (*remount_fs) (struct super_block *, int *, char *); | 1686 | int (*remount_fs) (struct super_block *, int *, char *); |
1673 | void (*umount_begin) (struct super_block *); | 1687 | void (*umount_begin) (struct super_block *); |
1674 | 1688 | ||
1675 | int (*show_options)(struct seq_file *, struct vfsmount *); | 1689 | int (*show_options)(struct seq_file *, struct dentry *); |
1676 | int (*show_devname)(struct seq_file *, struct vfsmount *); | 1690 | int (*show_devname)(struct seq_file *, struct dentry *); |
1677 | int (*show_path)(struct seq_file *, struct vfsmount *); | 1691 | int (*show_path)(struct seq_file *, struct dentry *); |
1678 | int (*show_stats)(struct seq_file *, struct vfsmount *); | 1692 | int (*show_stats)(struct seq_file *, struct dentry *); |
1679 | #ifdef CONFIG_QUOTA | 1693 | #ifdef CONFIG_QUOTA |
1680 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); | 1694 | 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); | 1695 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
@@ -1764,31 +1778,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode) | |||
1764 | __mark_inode_dirty(inode, I_DIRTY_SYNC); | 1778 | __mark_inode_dirty(inode, I_DIRTY_SYNC); |
1765 | } | 1779 | } |
1766 | 1780 | ||
1767 | /** | 1781 | extern void inc_nlink(struct inode *inode); |
1768 | * set_nlink - directly set an inode's link count | 1782 | extern void drop_nlink(struct inode *inode); |
1769 | * @inode: inode | 1783 | extern void clear_nlink(struct inode *inode); |
1770 | * @nlink: new nlink (should be non-zero) | 1784 | extern 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 | */ | ||
1775 | static 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 | */ | ||
1788 | static inline void inc_nlink(struct inode *inode) | ||
1789 | { | ||
1790 | inode->__i_nlink++; | ||
1791 | } | ||
1792 | 1785 | ||
1793 | static inline void inode_inc_link_count(struct inode *inode) | 1786 | static inline void inode_inc_link_count(struct inode *inode) |
1794 | { | 1787 | { |
@@ -1796,35 +1789,6 @@ static inline void inode_inc_link_count(struct inode *inode) | |||
1796 | mark_inode_dirty(inode); | 1789 | mark_inode_dirty(inode); |
1797 | } | 1790 | } |
1798 | 1791 | ||
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 | */ | ||
1810 | static 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 | */ | ||
1823 | static inline void clear_nlink(struct inode *inode) | ||
1824 | { | ||
1825 | inode->__i_nlink = 0; | ||
1826 | } | ||
1827 | |||
1828 | static inline void inode_dec_link_count(struct inode *inode) | 1792 | static inline void inode_dec_link_count(struct inode *inode) |
1829 | { | 1793 | { |
1830 | drop_nlink(inode); | 1794 | drop_nlink(inode); |
@@ -1864,7 +1828,7 @@ struct file_system_type { | |||
1864 | void (*kill_sb) (struct super_block *); | 1828 | void (*kill_sb) (struct super_block *); |
1865 | struct module *owner; | 1829 | struct module *owner; |
1866 | struct file_system_type * next; | 1830 | struct file_system_type * next; |
1867 | struct list_head fs_supers; | 1831 | struct hlist_head fs_supers; |
1868 | 1832 | ||
1869 | struct lock_class_key s_lock_key; | 1833 | struct lock_class_key s_lock_key; |
1870 | struct lock_class_key s_umount_key; | 1834 | struct lock_class_key s_umount_key; |
@@ -1939,7 +1903,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | |||
1939 | extern int vfs_statfs(struct path *, struct kstatfs *); | 1903 | extern int vfs_statfs(struct path *, struct kstatfs *); |
1940 | extern int user_statfs(const char __user *, struct kstatfs *); | 1904 | extern int user_statfs(const char __user *, struct kstatfs *); |
1941 | extern int fd_statfs(int, struct kstatfs *); | 1905 | extern int fd_statfs(int, struct kstatfs *); |
1942 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1906 | extern int vfs_ustat(dev_t, struct kstatfs *); |
1943 | extern int freeze_super(struct super_block *super); | 1907 | extern int freeze_super(struct super_block *super); |
1944 | extern int thaw_super(struct super_block *super); | 1908 | extern int thaw_super(struct super_block *super); |
1945 | extern bool our_mnt(struct vfsmount *mnt); | 1909 | extern bool our_mnt(struct vfsmount *mnt); |
@@ -2054,8 +2018,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, | |||
2054 | extern int do_fallocate(struct file *file, int mode, loff_t offset, | 2018 | extern int do_fallocate(struct file *file, int mode, loff_t offset, |
2055 | loff_t len); | 2019 | loff_t len); |
2056 | extern long do_sys_open(int dfd, const char __user *filename, int flags, | 2020 | extern long do_sys_open(int dfd, const char __user *filename, int flags, |
2057 | int mode); | 2021 | umode_t mode); |
2058 | extern struct file *filp_open(const char *, int, int); | 2022 | extern struct file *filp_open(const char *, int, umode_t); |
2059 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, | 2023 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, |
2060 | const char *, int); | 2024 | const char *, int); |
2061 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, | 2025 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, |
@@ -2092,6 +2056,7 @@ extern void bd_forget(struct inode *inode); | |||
2092 | extern void bdput(struct block_device *); | 2056 | extern void bdput(struct block_device *); |
2093 | extern void invalidate_bdev(struct block_device *); | 2057 | extern void invalidate_bdev(struct block_device *); |
2094 | extern int sync_blockdev(struct block_device *bdev); | 2058 | extern int sync_blockdev(struct block_device *bdev); |
2059 | extern void kill_bdev(struct block_device *); | ||
2095 | extern struct super_block *freeze_bdev(struct block_device *); | 2060 | extern struct super_block *freeze_bdev(struct block_device *); |
2096 | extern void emergency_thaw_all(void); | 2061 | extern void emergency_thaw_all(void); |
2097 | extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); | 2062 | extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); |
@@ -2099,6 +2064,7 @@ extern int fsync_bdev(struct block_device *); | |||
2099 | #else | 2064 | #else |
2100 | static inline void bd_forget(struct inode *inode) {} | 2065 | static inline void bd_forget(struct inode *inode) {} |
2101 | static inline int sync_blockdev(struct block_device *bdev) { return 0; } | 2066 | static inline int sync_blockdev(struct block_device *bdev) { return 0; } |
2067 | static inline void kill_bdev(struct block_device *bdev) {} | ||
2102 | static inline void invalidate_bdev(struct block_device *bdev) {} | 2068 | static inline void invalidate_bdev(struct block_device *bdev) {} |
2103 | 2069 | ||
2104 | static inline struct super_block *freeze_bdev(struct block_device *sb) | 2070 | static inline struct super_block *freeze_bdev(struct block_device *sb) |
@@ -2191,8 +2157,6 @@ extern const struct file_operations read_pipefifo_fops; | |||
2191 | extern const struct file_operations write_pipefifo_fops; | 2157 | extern const struct file_operations write_pipefifo_fops; |
2192 | extern const struct file_operations rdwr_pipefifo_fops; | 2158 | extern const struct file_operations rdwr_pipefifo_fops; |
2193 | 2159 | ||
2194 | extern int fs_may_remount_ro(struct super_block *); | ||
2195 | |||
2196 | #ifdef CONFIG_BLOCK | 2160 | #ifdef CONFIG_BLOCK |
2197 | /* | 2161 | /* |
2198 | * return READ, READA, or WRITE | 2162 | * return READ, READA, or WRITE |
@@ -2415,6 +2379,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2415 | unsigned long nr_segs, loff_t pos); | 2379 | unsigned long nr_segs, loff_t pos); |
2416 | extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, | 2380 | extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, |
2417 | int datasync); | 2381 | int datasync); |
2382 | extern void block_sync_page(struct page *page); | ||
2418 | 2383 | ||
2419 | /* fs/splice.c */ | 2384 | /* fs/splice.c */ |
2420 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2385 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
@@ -2531,7 +2496,6 @@ extern void put_filesystem(struct file_system_type *fs); | |||
2531 | extern struct file_system_type *get_fs_type(const char *name); | 2496 | extern struct file_system_type *get_fs_type(const char *name); |
2532 | extern struct super_block *get_super(struct block_device *); | 2497 | extern struct super_block *get_super(struct block_device *); |
2533 | extern struct super_block *get_active_super(struct block_device *bdev); | 2498 | extern struct super_block *get_active_super(struct block_device *bdev); |
2534 | extern struct super_block *user_get_super(dev_t); | ||
2535 | extern void drop_super(struct super_block *sb); | 2499 | extern void drop_super(struct super_block *sb); |
2536 | extern void iterate_supers(void (*)(struct super_block *, void *), void *); | 2500 | extern void iterate_supers(void (*)(struct super_block *, void *), void *); |
2537 | extern void iterate_supers_type(struct file_system_type *, | 2501 | extern void iterate_supers_type(struct file_system_type *, |
@@ -2579,7 +2543,8 @@ extern int generic_check_addressable(unsigned, u64); | |||
2579 | 2543 | ||
2580 | #ifdef CONFIG_MIGRATION | 2544 | #ifdef CONFIG_MIGRATION |
2581 | extern int buffer_migrate_page(struct address_space *, | 2545 | extern int buffer_migrate_page(struct address_space *, |
2582 | struct page *, struct page *); | 2546 | struct page *, struct page *, |
2547 | enum migrate_mode); | ||
2583 | #else | 2548 | #else |
2584 | #define buffer_migrate_page NULL | 2549 | #define buffer_migrate_page NULL |
2585 | #endif | 2550 | #endif |
@@ -2590,7 +2555,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr); | |||
2590 | 2555 | ||
2591 | extern void file_update_time(struct file *file); | 2556 | extern void file_update_time(struct file *file); |
2592 | 2557 | ||
2593 | extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); | 2558 | extern int generic_show_options(struct seq_file *m, struct dentry *root); |
2594 | extern void save_mount_options(struct super_block *sb, char *options); | 2559 | extern void save_mount_options(struct super_block *sb, char *options); |
2595 | extern void replace_mount_options(struct super_block *sb, char *options); | 2560 | extern void replace_mount_options(struct super_block *sb, char *options); |
2596 | 2561 | ||
@@ -2691,7 +2656,7 @@ int __init get_filesystem_list(char *buf); | |||
2691 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ | 2656 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ |
2692 | (flag & __FMODE_NONOTIFY))) | 2657 | (flag & __FMODE_NONOTIFY))) |
2693 | 2658 | ||
2694 | static inline int is_sxid(mode_t mode) | 2659 | static inline int is_sxid(umode_t mode) |
2695 | { | 2660 | { |
2696 | return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); | 2661 | return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); |
2697 | } | 2662 | } |