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