Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: allow quota to use reserved blocks

This patch allows quota to use reserved blocks all the time.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

+8 -3
+8 -3
fs/f2fs/f2fs.h
··· 1576 1576 return ofs == XATTR_NODE_OFFSET; 1577 1577 } 1578 1578 1579 - static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi) 1579 + static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi, 1580 + struct inode *inode) 1580 1581 { 1582 + if (!inode) 1583 + return true; 1581 1584 if (!test_opt(sbi, RESERVE_ROOT)) 1582 1585 return false; 1586 + if (IS_NOQUOTA(inode)) 1587 + return true; 1583 1588 if (capable(CAP_SYS_RESOURCE)) 1584 1589 return true; 1585 1590 if (uid_eq(sbi->s_resuid, current_fsuid())) ··· 1625 1620 avail_user_block_count = sbi->user_block_count - 1626 1621 sbi->current_reserved_blocks; 1627 1622 1628 - if (!__allow_reserved_blocks(sbi)) 1623 + if (!__allow_reserved_blocks(sbi, inode)) 1629 1624 avail_user_block_count -= sbi->root_reserved_blocks; 1630 1625 1631 1626 if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) { ··· 1826 1821 valid_block_count = sbi->total_valid_block_count + 1827 1822 sbi->current_reserved_blocks + 1; 1828 1823 1829 - if (!__allow_reserved_blocks(sbi)) 1824 + if (!__allow_reserved_blocks(sbi, inode)) 1830 1825 valid_block_count += sbi->root_reserved_blocks; 1831 1826 1832 1827 if (unlikely(valid_block_count > sbi->user_block_count)) {