|
2 | 2 | #ifndef _LINUX_FS_H |
3 | 3 | #define _LINUX_FS_H |
4 | 4 |
|
5 | | -#include <linux/fs/super_types.h> |
| 5 | +#include <linux/fs/super.h> |
6 | 6 | #include <linux/vfsdebug.h> |
7 | 7 | #include <linux/linkage.h> |
8 | 8 | #include <linux/wait_bit.h> |
@@ -1662,66 +1662,6 @@ struct timespec64 simple_inode_init_ts(struct inode *inode); |
1662 | 1662 | * Snapshotting support. |
1663 | 1663 | */ |
1664 | 1664 |
|
1665 | | -/* |
1666 | | - * These are internal functions, please use sb_start_{write,pagefault,intwrite} |
1667 | | - * instead. |
1668 | | - */ |
1669 | | -static inline void __sb_end_write(struct super_block *sb, int level) |
1670 | | -{ |
1671 | | - percpu_up_read(sb->s_writers.rw_sem + level-1); |
1672 | | -} |
1673 | | - |
1674 | | -static inline void __sb_start_write(struct super_block *sb, int level) |
1675 | | -{ |
1676 | | - percpu_down_read_freezable(sb->s_writers.rw_sem + level - 1, true); |
1677 | | -} |
1678 | | - |
1679 | | -static inline bool __sb_start_write_trylock(struct super_block *sb, int level) |
1680 | | -{ |
1681 | | - return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1); |
1682 | | -} |
1683 | | - |
1684 | | -#define __sb_writers_acquired(sb, lev) \ |
1685 | | - percpu_rwsem_acquire(&(sb)->s_writers.rw_sem[(lev)-1], 1, _THIS_IP_) |
1686 | | -#define __sb_writers_release(sb, lev) \ |
1687 | | - percpu_rwsem_release(&(sb)->s_writers.rw_sem[(lev)-1], _THIS_IP_) |
1688 | | - |
1689 | | -/** |
1690 | | - * __sb_write_started - check if sb freeze level is held |
1691 | | - * @sb: the super we write to |
1692 | | - * @level: the freeze level |
1693 | | - * |
1694 | | - * * > 0 - sb freeze level is held |
1695 | | - * * 0 - sb freeze level is not held |
1696 | | - * * < 0 - !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN |
1697 | | - */ |
1698 | | -static inline int __sb_write_started(const struct super_block *sb, int level) |
1699 | | -{ |
1700 | | - return lockdep_is_held_type(sb->s_writers.rw_sem + level - 1, 1); |
1701 | | -} |
1702 | | - |
1703 | | -/** |
1704 | | - * sb_write_started - check if SB_FREEZE_WRITE is held |
1705 | | - * @sb: the super we write to |
1706 | | - * |
1707 | | - * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN. |
1708 | | - */ |
1709 | | -static inline bool sb_write_started(const struct super_block *sb) |
1710 | | -{ |
1711 | | - return __sb_write_started(sb, SB_FREEZE_WRITE); |
1712 | | -} |
1713 | | - |
1714 | | -/** |
1715 | | - * sb_write_not_started - check if SB_FREEZE_WRITE is not held |
1716 | | - * @sb: the super we write to |
1717 | | - * |
1718 | | - * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN. |
1719 | | - */ |
1720 | | -static inline bool sb_write_not_started(const struct super_block *sb) |
1721 | | -{ |
1722 | | - return __sb_write_started(sb, SB_FREEZE_WRITE) <= 0; |
1723 | | -} |
1724 | | - |
1725 | 1665 | /** |
1726 | 1666 | * file_write_started - check if SB_FREEZE_WRITE is held |
1727 | 1667 | * @file: the file we write to |
@@ -1752,118 +1692,6 @@ static inline bool file_write_not_started(const struct file *file) |
1752 | 1692 | return sb_write_not_started(file_inode(file)->i_sb); |
1753 | 1693 | } |
1754 | 1694 |
|
1755 | | -/** |
1756 | | - * sb_end_write - drop write access to a superblock |
1757 | | - * @sb: the super we wrote to |
1758 | | - * |
1759 | | - * Decrement number of writers to the filesystem. Wake up possible waiters |
1760 | | - * wanting to freeze the filesystem. |
1761 | | - */ |
1762 | | -static inline void sb_end_write(struct super_block *sb) |
1763 | | -{ |
1764 | | - __sb_end_write(sb, SB_FREEZE_WRITE); |
1765 | | -} |
1766 | | - |
1767 | | -/** |
1768 | | - * sb_end_pagefault - drop write access to a superblock from a page fault |
1769 | | - * @sb: the super we wrote to |
1770 | | - * |
1771 | | - * Decrement number of processes handling write page fault to the filesystem. |
1772 | | - * Wake up possible waiters wanting to freeze the filesystem. |
1773 | | - */ |
1774 | | -static inline void sb_end_pagefault(struct super_block *sb) |
1775 | | -{ |
1776 | | - __sb_end_write(sb, SB_FREEZE_PAGEFAULT); |
1777 | | -} |
1778 | | - |
1779 | | -/** |
1780 | | - * sb_end_intwrite - drop write access to a superblock for internal fs purposes |
1781 | | - * @sb: the super we wrote to |
1782 | | - * |
1783 | | - * Decrement fs-internal number of writers to the filesystem. Wake up possible |
1784 | | - * waiters wanting to freeze the filesystem. |
1785 | | - */ |
1786 | | -static inline void sb_end_intwrite(struct super_block *sb) |
1787 | | -{ |
1788 | | - __sb_end_write(sb, SB_FREEZE_FS); |
1789 | | -} |
1790 | | - |
1791 | | -/** |
1792 | | - * sb_start_write - get write access to a superblock |
1793 | | - * @sb: the super we write to |
1794 | | - * |
1795 | | - * When a process wants to write data or metadata to a file system (i.e. dirty |
1796 | | - * a page or an inode), it should embed the operation in a sb_start_write() - |
1797 | | - * sb_end_write() pair to get exclusion against file system freezing. This |
1798 | | - * function increments number of writers preventing freezing. If the file |
1799 | | - * system is already frozen, the function waits until the file system is |
1800 | | - * thawed. |
1801 | | - * |
1802 | | - * Since freeze protection behaves as a lock, users have to preserve |
1803 | | - * ordering of freeze protection and other filesystem locks. Generally, |
1804 | | - * freeze protection should be the outermost lock. In particular, we have: |
1805 | | - * |
1806 | | - * sb_start_write |
1807 | | - * -> i_rwsem (write path, truncate, directory ops, ...) |
1808 | | - * -> s_umount (freeze_super, thaw_super) |
1809 | | - */ |
1810 | | -static inline void sb_start_write(struct super_block *sb) |
1811 | | -{ |
1812 | | - __sb_start_write(sb, SB_FREEZE_WRITE); |
1813 | | -} |
1814 | | - |
1815 | | -static inline bool sb_start_write_trylock(struct super_block *sb) |
1816 | | -{ |
1817 | | - return __sb_start_write_trylock(sb, SB_FREEZE_WRITE); |
1818 | | -} |
1819 | | - |
1820 | | -/** |
1821 | | - * sb_start_pagefault - get write access to a superblock from a page fault |
1822 | | - * @sb: the super we write to |
1823 | | - * |
1824 | | - * When a process starts handling write page fault, it should embed the |
1825 | | - * operation into sb_start_pagefault() - sb_end_pagefault() pair to get |
1826 | | - * exclusion against file system freezing. This is needed since the page fault |
1827 | | - * is going to dirty a page. This function increments number of running page |
1828 | | - * faults preventing freezing. If the file system is already frozen, the |
1829 | | - * function waits until the file system is thawed. |
1830 | | - * |
1831 | | - * Since page fault freeze protection behaves as a lock, users have to preserve |
1832 | | - * ordering of freeze protection and other filesystem locks. It is advised to |
1833 | | - * put sb_start_pagefault() close to mmap_lock in lock ordering. Page fault |
1834 | | - * handling code implies lock dependency: |
1835 | | - * |
1836 | | - * mmap_lock |
1837 | | - * -> sb_start_pagefault |
1838 | | - */ |
1839 | | -static inline void sb_start_pagefault(struct super_block *sb) |
1840 | | -{ |
1841 | | - __sb_start_write(sb, SB_FREEZE_PAGEFAULT); |
1842 | | -} |
1843 | | - |
1844 | | -/** |
1845 | | - * sb_start_intwrite - get write access to a superblock for internal fs purposes |
1846 | | - * @sb: the super we write to |
1847 | | - * |
1848 | | - * This is the third level of protection against filesystem freezing. It is |
1849 | | - * free for use by a filesystem. The only requirement is that it must rank |
1850 | | - * below sb_start_pagefault. |
1851 | | - * |
1852 | | - * For example filesystem can call sb_start_intwrite() when starting a |
1853 | | - * transaction which somewhat eases handling of freezing for internal sources |
1854 | | - * of filesystem changes (internal fs threads, discarding preallocation on file |
1855 | | - * close, etc.). |
1856 | | - */ |
1857 | | -static inline void sb_start_intwrite(struct super_block *sb) |
1858 | | -{ |
1859 | | - __sb_start_write(sb, SB_FREEZE_FS); |
1860 | | -} |
1861 | | - |
1862 | | -static inline bool sb_start_intwrite_trylock(struct super_block *sb) |
1863 | | -{ |
1864 | | - return __sb_start_write_trylock(sb, SB_FREEZE_FS); |
1865 | | -} |
1866 | | - |
1867 | 1695 | bool inode_owner_or_capable(struct mnt_idmap *idmap, |
1868 | 1696 | const struct inode *inode); |
1869 | 1697 |
|
@@ -2233,7 +2061,6 @@ extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, |
2233 | 2061 | */ |
2234 | 2062 | #define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg)) |
2235 | 2063 |
|
2236 | | -static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & SB_RDONLY; } |
2237 | 2064 | #define IS_RDONLY(inode) sb_rdonly((inode)->i_sb) |
2238 | 2065 | #define IS_SYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS) || \ |
2239 | 2066 | ((inode)->i_flags & S_SYNC)) |
@@ -2467,10 +2294,6 @@ extern int unregister_filesystem(struct file_system_type *); |
2467 | 2294 | extern int vfs_statfs(const struct path *, struct kstatfs *); |
2468 | 2295 | extern int user_statfs(const char __user *, struct kstatfs *); |
2469 | 2296 | extern int fd_statfs(int, struct kstatfs *); |
2470 | | -int freeze_super(struct super_block *super, enum freeze_holder who, |
2471 | | - const void *freeze_owner); |
2472 | | -int thaw_super(struct super_block *super, enum freeze_holder who, |
2473 | | - const void *freeze_owner); |
2474 | 2297 | extern __printf(2, 3) |
2475 | 2298 | int super_setup_bdi_name(struct super_block *sb, char *fmt, ...); |
2476 | 2299 | extern int super_setup_bdi(struct super_block *sb); |
@@ -2657,12 +2480,6 @@ extern struct kmem_cache *names_cachep; |
2657 | 2480 | #define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) |
2658 | 2481 | #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) |
2659 | 2482 |
|
2660 | | -extern struct super_block *blockdev_superblock; |
2661 | | -static inline bool sb_is_blkdev_sb(struct super_block *sb) |
2662 | | -{ |
2663 | | - return IS_ENABLED(CONFIG_BLOCK) && sb == blockdev_superblock; |
2664 | | -} |
2665 | | - |
2666 | 2483 | void emergency_thaw_all(void); |
2667 | 2484 | extern int sync_filesystem(struct super_block *); |
2668 | 2485 | extern const struct file_operations def_blk_fops; |
@@ -3117,9 +2934,6 @@ static inline void remove_inode_hash(struct inode *inode) |
3117 | 2934 | extern void inode_sb_list_add(struct inode *inode); |
3118 | 2935 | extern void inode_add_lru(struct inode *inode); |
3119 | 2936 |
|
3120 | | -extern int sb_set_blocksize(struct super_block *, int); |
3121 | | -extern int sb_min_blocksize(struct super_block *, int); |
3122 | | - |
3123 | 2937 | int generic_file_mmap(struct file *, struct vm_area_struct *); |
3124 | 2938 | int generic_file_mmap_prepare(struct vm_area_desc *desc); |
3125 | 2939 | int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); |
@@ -3439,38 +3253,6 @@ static inline bool generic_ci_validate_strict_name(struct inode *dir, |
3439 | 3253 | } |
3440 | 3254 | #endif |
3441 | 3255 |
|
3442 | | -static inline struct unicode_map *sb_encoding(const struct super_block *sb) |
3443 | | -{ |
3444 | | -#if IS_ENABLED(CONFIG_UNICODE) |
3445 | | - return sb->s_encoding; |
3446 | | -#else |
3447 | | - return NULL; |
3448 | | -#endif |
3449 | | -} |
3450 | | - |
3451 | | -static inline bool sb_has_encoding(const struct super_block *sb) |
3452 | | -{ |
3453 | | - return !!sb_encoding(sb); |
3454 | | -} |
3455 | | - |
3456 | | -/* |
3457 | | - * Compare if two super blocks have the same encoding and flags |
3458 | | - */ |
3459 | | -static inline bool sb_same_encoding(const struct super_block *sb1, |
3460 | | - const struct super_block *sb2) |
3461 | | -{ |
3462 | | -#if IS_ENABLED(CONFIG_UNICODE) |
3463 | | - if (sb1->s_encoding == sb2->s_encoding) |
3464 | | - return true; |
3465 | | - |
3466 | | - return (sb1->s_encoding && sb2->s_encoding && |
3467 | | - (sb1->s_encoding->version == sb2->s_encoding->version) && |
3468 | | - (sb1->s_encoding_flags == sb2->s_encoding_flags)); |
3469 | | -#else |
3470 | | - return true; |
3471 | | -#endif |
3472 | | -} |
3473 | | - |
3474 | 3256 | int may_setattr(struct mnt_idmap *idmap, struct inode *inode, |
3475 | 3257 | unsigned int ia_valid); |
3476 | 3258 | int setattr_prepare(struct mnt_idmap *, struct dentry *, struct iattr *); |
|
0 commit comments