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.h121
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 {
525struct page; 525struct page;
526struct address_space; 526struct address_space;
527struct writeback_control; 527struct writeback_control;
528enum migrate_mode;
528 529
529struct iov_iter { 530struct 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 */
663struct request_queue;
659 664
660struct block_device { 665struct 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 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1533extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1534extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1535extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1536extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1537extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1538extern 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 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1550extern 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/** 1781extern void inc_nlink(struct inode *inode);
1768 * set_nlink - directly set an inode's link count 1782extern void drop_nlink(struct inode *inode);
1769 * @inode: inode 1783extern void clear_nlink(struct inode *inode);
1770 * @nlink: new nlink (should be non-zero) 1784extern 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 1785
1793static inline void inode_inc_link_count(struct inode *inode) 1786static 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 */
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) 1792static 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 *,
1939extern int vfs_statfs(struct path *, struct kstatfs *); 1903extern int vfs_statfs(struct path *, struct kstatfs *);
1940extern int user_statfs(const char __user *, struct kstatfs *); 1904extern int user_statfs(const char __user *, struct kstatfs *);
1941extern int fd_statfs(int, struct kstatfs *); 1905extern int fd_statfs(int, struct kstatfs *);
1942extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1906extern int vfs_ustat(dev_t, struct kstatfs *);
1943extern int freeze_super(struct super_block *super); 1907extern int freeze_super(struct super_block *super);
1944extern int thaw_super(struct super_block *super); 1908extern int thaw_super(struct super_block *super);
1945extern bool our_mnt(struct vfsmount *mnt); 1909extern bool our_mnt(struct vfsmount *mnt);
@@ -2054,8 +2018,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, 2018extern int do_fallocate(struct file *file, int mode, loff_t offset,
2055 loff_t len); 2019 loff_t len);
2056extern long do_sys_open(int dfd, const char __user *filename, int flags, 2020extern long do_sys_open(int dfd, const char __user *filename, int flags,
2057 int mode); 2021 umode_t mode);
2058extern struct file *filp_open(const char *, int, int); 2022extern struct file *filp_open(const char *, int, umode_t);
2059extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2023extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2060 const char *, int); 2024 const char *, int);
2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2025extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2092,6 +2056,7 @@ extern void bd_forget(struct inode *inode);
2092extern void bdput(struct block_device *); 2056extern void bdput(struct block_device *);
2093extern void invalidate_bdev(struct block_device *); 2057extern void invalidate_bdev(struct block_device *);
2094extern int sync_blockdev(struct block_device *bdev); 2058extern int sync_blockdev(struct block_device *bdev);
2059extern void kill_bdev(struct block_device *);
2095extern struct super_block *freeze_bdev(struct block_device *); 2060extern struct super_block *freeze_bdev(struct block_device *);
2096extern void emergency_thaw_all(void); 2061extern void emergency_thaw_all(void);
2097extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2062extern 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
2100static inline void bd_forget(struct inode *inode) {} 2065static inline void bd_forget(struct inode *inode) {}
2101static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2066static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2067static inline void kill_bdev(struct block_device *bdev) {}
2102static inline void invalidate_bdev(struct block_device *bdev) {} 2068static inline void invalidate_bdev(struct block_device *bdev) {}
2103 2069
2104static inline struct super_block *freeze_bdev(struct block_device *sb) 2070static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2191,8 +2157,6 @@ extern const struct file_operations read_pipefifo_fops;
2191extern const struct file_operations write_pipefifo_fops; 2157extern const struct file_operations write_pipefifo_fops;
2192extern const struct file_operations rdwr_pipefifo_fops; 2158extern const struct file_operations rdwr_pipefifo_fops;
2193 2159
2194extern 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);
2416extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2380extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2417 int datasync); 2381 int datasync);
2382extern void block_sync_page(struct page *page);
2418 2383
2419/* fs/splice.c */ 2384/* fs/splice.c */
2420extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2385extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2531,7 +2496,6 @@ extern void put_filesystem(struct file_system_type *fs);
2531extern struct file_system_type *get_fs_type(const char *name); 2496extern struct file_system_type *get_fs_type(const char *name);
2532extern struct super_block *get_super(struct block_device *); 2497extern struct super_block *get_super(struct block_device *);
2533extern struct super_block *get_active_super(struct block_device *bdev); 2498extern 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); 2499extern void drop_super(struct super_block *sb);
2536extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2500extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2537extern void iterate_supers_type(struct file_system_type *, 2501extern 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
2581extern int buffer_migrate_page(struct address_space *, 2545extern 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
2591extern void file_update_time(struct file *file); 2556extern void file_update_time(struct file *file);
2592 2557
2593extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2558extern int generic_show_options(struct seq_file *m, struct dentry *root);
2594extern void save_mount_options(struct super_block *sb, char *options); 2559extern void save_mount_options(struct super_block *sb, char *options);
2595extern void replace_mount_options(struct super_block *sb, char *options); 2560extern 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
2694static inline int is_sxid(mode_t mode) 2659static 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}