f2fs.h (04f0b2eaa3b3ee243df6040617b4bfbbc0404854) f2fs.h (dcbb4c10e6d9693cc9d6fa493b4d130b66a60c7d)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/f2fs.h
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#ifndef _LINUX_F2FS_H

--- 1794 unchanged lines hidden (view full) ---

1803 return 0;
1804
1805enospc:
1806 percpu_counter_sub(&sbi->alloc_valid_block_count, release);
1807 dquot_release_reservation_block(inode, release);
1808 return -ENOSPC;
1809}
1810
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/f2fs.h
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#ifndef _LINUX_F2FS_H

--- 1794 unchanged lines hidden (view full) ---

1803 return 0;
1804
1805enospc:
1806 percpu_counter_sub(&sbi->alloc_valid_block_count, release);
1807 dquot_release_reservation_block(inode, release);
1808 return -ENOSPC;
1809}
1810
1811void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...);
1811__printf(2, 3)
1812void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...);
1813
1814#define f2fs_err(sbi, fmt, ...) \
1815 f2fs_printk(sbi, KERN_ERR fmt, ##__VA_ARGS__)
1816#define f2fs_warn(sbi, fmt, ...) \
1817 f2fs_printk(sbi, KERN_WARNING fmt, ##__VA_ARGS__)
1818#define f2fs_notice(sbi, fmt, ...) \
1819 f2fs_printk(sbi, KERN_NOTICE fmt, ##__VA_ARGS__)
1820#define f2fs_info(sbi, fmt, ...) \
1821 f2fs_printk(sbi, KERN_INFO fmt, ##__VA_ARGS__)
1822#define f2fs_debug(sbi, fmt, ...) \
1823 f2fs_printk(sbi, KERN_DEBUG fmt, ##__VA_ARGS__)
1824
1812static inline void dec_valid_block_count(struct f2fs_sb_info *sbi,
1813 struct inode *inode,
1814 block_t count)
1815{
1816 blkcnt_t sectors = count << F2FS_LOG_SECTORS_PER_BLOCK;
1817
1818 spin_lock(&sbi->stat_lock);
1819 f2fs_bug_on(sbi, sbi->total_valid_block_count < (block_t) count);
1820 sbi->total_valid_block_count -= (block_t)count;
1821 if (sbi->reserved_blocks &&
1822 sbi->current_reserved_blocks < sbi->reserved_blocks)
1823 sbi->current_reserved_blocks = min(sbi->reserved_blocks,
1824 sbi->current_reserved_blocks + count);
1825 spin_unlock(&sbi->stat_lock);
1826 if (unlikely(inode->i_blocks < sectors)) {
1825static inline void dec_valid_block_count(struct f2fs_sb_info *sbi,
1826 struct inode *inode,
1827 block_t count)
1828{
1829 blkcnt_t sectors = count << F2FS_LOG_SECTORS_PER_BLOCK;
1830
1831 spin_lock(&sbi->stat_lock);
1832 f2fs_bug_on(sbi, sbi->total_valid_block_count < (block_t) count);
1833 sbi->total_valid_block_count -= (block_t)count;
1834 if (sbi->reserved_blocks &&
1835 sbi->current_reserved_blocks < sbi->reserved_blocks)
1836 sbi->current_reserved_blocks = min(sbi->reserved_blocks,
1837 sbi->current_reserved_blocks + count);
1838 spin_unlock(&sbi->stat_lock);
1839 if (unlikely(inode->i_blocks < sectors)) {
1827 f2fs_msg(sbi->sb, KERN_WARNING,
1828 "Inconsistent i_blocks, ino:%lu, iblocks:%llu, sectors:%llu",
1829 inode->i_ino,
1830 (unsigned long long)inode->i_blocks,
1831 (unsigned long long)sectors);
1840 f2fs_warn(sbi, "Inconsistent i_blocks, ino:%lu, iblocks:%llu, sectors:%llu",
1841 inode->i_ino,
1842 (unsigned long long)inode->i_blocks,
1843 (unsigned long long)sectors);
1832 set_sbi_flag(sbi, SBI_NEED_FSCK);
1833 return;
1834 }
1835 f2fs_i_blocks_write(inode, count, false, true);
1836}
1837
1838static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
1839{

--- 221 unchanged lines hidden (view full) ---

2061 sbi->current_reserved_blocks++;
2062
2063 spin_unlock(&sbi->stat_lock);
2064
2065 if (is_inode) {
2066 dquot_free_inode(inode);
2067 } else {
2068 if (unlikely(inode->i_blocks == 0)) {
1844 set_sbi_flag(sbi, SBI_NEED_FSCK);
1845 return;
1846 }
1847 f2fs_i_blocks_write(inode, count, false, true);
1848}
1849
1850static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
1851{

--- 221 unchanged lines hidden (view full) ---

2073 sbi->current_reserved_blocks++;
2074
2075 spin_unlock(&sbi->stat_lock);
2076
2077 if (is_inode) {
2078 dquot_free_inode(inode);
2079 } else {
2080 if (unlikely(inode->i_blocks == 0)) {
2069 f2fs_msg(sbi->sb, KERN_WARNING,
2070 "Inconsistent i_blocks, ino:%lu, iblocks:%llu",
2071 inode->i_ino,
2072 (unsigned long long)inode->i_blocks);
2081 f2fs_warn(sbi, "Inconsistent i_blocks, ino:%lu, iblocks:%llu",
2082 inode->i_ino,
2083 (unsigned long long)inode->i_blocks);
2073 set_sbi_flag(sbi, SBI_NEED_FSCK);
2074 return;
2075 }
2076 f2fs_i_blocks_write(inode, 1, false, true);
2077 }
2078}
2079
2080static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi)

--- 753 unchanged lines hidden (view full) ---

2834#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META)
2835
2836bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
2837 block_t blkaddr, int type);
2838static inline void verify_blkaddr(struct f2fs_sb_info *sbi,
2839 block_t blkaddr, int type)
2840{
2841 if (!f2fs_is_valid_blkaddr(sbi, blkaddr, type)) {
2084 set_sbi_flag(sbi, SBI_NEED_FSCK);
2085 return;
2086 }
2087 f2fs_i_blocks_write(inode, 1, false, true);
2088 }
2089}
2090
2091static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi)

--- 753 unchanged lines hidden (view full) ---

2845#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META)
2846
2847bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
2848 block_t blkaddr, int type);
2849static inline void verify_blkaddr(struct f2fs_sb_info *sbi,
2850 block_t blkaddr, int type)
2851{
2852 if (!f2fs_is_valid_blkaddr(sbi, blkaddr, type)) {
2842 f2fs_msg(sbi->sb, KERN_ERR,
2843 "invalid blkaddr: %u, type: %d, run fsck to fix.",
2844 blkaddr, type);
2853 f2fs_err(sbi, "invalid blkaddr: %u, type: %d, run fsck to fix.",
2854 blkaddr, type);
2845 f2fs_bug_on(sbi, 1);
2846 }
2847}
2848
2849static inline bool __is_valid_data_blkaddr(block_t blkaddr)
2850{
2851 if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
2852 return false;

--- 114 unchanged lines hidden (view full) ---

2967 */
2968int f2fs_inode_dirtied(struct inode *inode, bool sync);
2969void f2fs_inode_synced(struct inode *inode);
2970int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly);
2971int f2fs_quota_sync(struct super_block *sb, int type);
2972void f2fs_quota_off_umount(struct super_block *sb);
2973int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
2974int f2fs_sync_fs(struct super_block *sb, int sync);
2855 f2fs_bug_on(sbi, 1);
2856 }
2857}
2858
2859static inline bool __is_valid_data_blkaddr(block_t blkaddr)
2860{
2861 if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
2862 return false;

--- 114 unchanged lines hidden (view full) ---

2977 */
2978int f2fs_inode_dirtied(struct inode *inode, bool sync);
2979void f2fs_inode_synced(struct inode *inode);
2980int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly);
2981int f2fs_quota_sync(struct super_block *sb, int type);
2982void f2fs_quota_off_umount(struct super_block *sb);
2983int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
2984int f2fs_sync_fs(struct super_block *sb, int sync);
2975extern __printf(3, 4)
2976void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...);
2977int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
2978
2979/*
2980 * hash.c
2981 */
2982f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info,
2983 struct fscrypt_name *fname);
2984

--- 719 unchanged lines hidden ---
2985int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
2986
2987/*
2988 * hash.c
2989 */
2990f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info,
2991 struct fscrypt_name *fname);
2992

--- 719 unchanged lines hidden ---