diff options
| author | Zhang Yi <yi.zhang@huawei.com> | 2025-05-06 09:20:08 +0800 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2025-05-20 10:30:59 -0400 |
| commit | dbe27f06fa38b9bfc598f8864ae1c5d5831d9992 (patch) | |
| tree | 0c90ca78c9f5de5f9d57e17d86f563f6bd4dd8ab /fs/ext4/ext4.h | |
| parent | 29ec9bed2395061350249ae356fb300dd82a78e7 (diff) | |
ext4: factor out ext4_get_maxbytes()
There are several locations that get the correct maxbytes value based on
the inode's block type. It would be beneficial to extract a common
helper function to make the code more clear.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Baokun Li <libaokun1@huawei.com>
Link: https://patch.msgid.link/20250506012009.3896990-3-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Diffstat (limited to 'fs/ext4/ext4.h')
| -rw-r--r-- | fs/ext4/ext4.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 3f352f2a6d85..f329aa0517b4 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3395,6 +3395,13 @@ static inline unsigned int ext4_flex_bg_size(struct ext4_sb_info *sbi) return 1 << sbi->s_log_groups_per_flex; } +static inline loff_t ext4_get_maxbytes(struct inode *inode) +{ + if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) + return inode->i_sb->s_maxbytes; + return EXT4_SB(inode->i_sb)->s_bitmap_maxbytes; +} + #define ext4_std_error(sb, errno) \ do { \ if ((errno)) \ |