Commit 4df031f
ext4: check and update i_disksize properly
After commit 3da40c7 ("ext4: only call ext4_truncate when size <=
isize"), i_disksize could always be updated to i_size in ext4_setattr(),
and we could sure that i_disksize <= i_size since holding inode lock and
if i_disksize < i_size there are delalloc writes pending in the range
upto i_size. If the end of the current write is <= i_size, there's no
need to touch i_disksize since writeback will push i_disksize upto
i_size eventually. So we can switch to check i_size instead of
i_disksize in ext4_da_write_end() when write to the end of the file.
we also could remove ext4_mark_inode_dirty() together because we defer
inode dirtying to generic_write_end() or ext4_da_write_inline_data_end().
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20210716122024.1105856-2-yi.zhang@huawei.com1 parent b33d9f5 commit 4df031f
1 file changed
Lines changed: 18 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3084 | 3084 | | |
3085 | 3085 | | |
3086 | 3086 | | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
3090 | 3100 | | |
3091 | 3101 | | |
3092 | | - | |
| 3102 | + | |
3093 | 3103 | | |
3094 | | - | |
| 3104 | + | |
3095 | 3105 | | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
3100 | | - | |
3101 | | - | |
3102 | 3106 | | |
3103 | 3107 | | |
3104 | 3108 | | |
3105 | 3109 | | |
3106 | 3110 | | |
3107 | | - | |
| 3111 | + | |
3108 | 3112 | | |
3109 | 3113 | | |
3110 | | - | |
| 3114 | + | |
3111 | 3115 | | |
3112 | 3116 | | |
3113 | | - | |
3114 | | - | |
3115 | | - | |
| 3117 | + | |
3116 | 3118 | | |
3117 | 3119 | | |
3118 | 3120 | | |
| |||
0 commit comments