Skip to content

Commit ad11526

Browse files
zhangyi089tytso
authored andcommitted
ext4: rename ext4_block_zero_page_range() to ext4_block_zero_range()
Rename ext4_block_zero_page_range() to ext4_block_zero_range() since the "page" naming is no longer appropriate for current context. Also change its signature to take an inode pointer instead of an address_space. This aligns with the caller ext4_block_zero_eof() and ext4_zero_partial_blocks(). Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20260327102939.1095257-5-yi.zhang@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 3b312a6 commit ad11526

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

fs/ext4/inode.c

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4170,17 +4170,14 @@ static int ext4_block_journalled_zero_range(handle_t *handle,
41704170
}
41714171

41724172
/*
4173-
* ext4_block_zero_page_range() zeros out a mapping of length 'length'
4174-
* starting from file offset 'from'. The range to be zero'd must
4175-
* be contained with in one block. If the specified range exceeds
4176-
* the end of the block it will be shortened to end of the block
4177-
* that corresponds to 'from'
4173+
* Zeros out a mapping of length 'length' starting from file offset
4174+
* 'from'. The range to be zero'd must be contained with in one block.
4175+
* If the specified range exceeds the end of the block it will be
4176+
* shortened to end of the block that corresponds to 'from'.
41784177
*/
4179-
static int ext4_block_zero_page_range(handle_t *handle,
4180-
struct address_space *mapping, loff_t from, loff_t length,
4181-
bool *did_zero)
4178+
static int ext4_block_zero_range(handle_t *handle, struct inode *inode,
4179+
loff_t from, loff_t length, bool *did_zero)
41824180
{
4183-
struct inode *inode = mapping->host;
41844181
unsigned blocksize = inode->i_sb->s_blocksize;
41854182
unsigned int max = blocksize - (from & (blocksize - 1));
41864183

@@ -4225,15 +4222,13 @@ int ext4_block_zero_eof(handle_t *handle, struct inode *inode,
42254222
if (length > blocksize - offset)
42264223
length = blocksize - offset;
42274224

4228-
return ext4_block_zero_page_range(handle, inode->i_mapping, from,
4229-
length, NULL);
4225+
return ext4_block_zero_range(handle, inode, from, length, NULL);
42304226
}
42314227

42324228
int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
42334229
loff_t lstart, loff_t length)
42344230
{
42354231
struct super_block *sb = inode->i_sb;
4236-
struct address_space *mapping = inode->i_mapping;
42374232
unsigned partial_start, partial_end;
42384233
ext4_fsblk_t start, end;
42394234
loff_t byte_end = (lstart + length - 1);
@@ -4248,22 +4243,22 @@ int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
42484243
/* Handle partial zero within the single block */
42494244
if (start == end &&
42504245
(partial_start || (partial_end != sb->s_blocksize - 1))) {
4251-
err = ext4_block_zero_page_range(handle, mapping,
4252-
lstart, length, NULL);
4246+
err = ext4_block_zero_range(handle, inode, lstart,
4247+
length, NULL);
42534248
return err;
42544249
}
42554250
/* Handle partial zero out on the start of the range */
42564251
if (partial_start) {
4257-
err = ext4_block_zero_page_range(handle, mapping, lstart,
4258-
sb->s_blocksize, NULL);
4252+
err = ext4_block_zero_range(handle, inode, lstart,
4253+
sb->s_blocksize, NULL);
42594254
if (err)
42604255
return err;
42614256
}
42624257
/* Handle partial zero out on the end of the range */
42634258
if (partial_end != sb->s_blocksize - 1)
4264-
err = ext4_block_zero_page_range(handle, mapping,
4265-
byte_end - partial_end,
4266-
partial_end + 1, NULL);
4259+
err = ext4_block_zero_range(handle, inode,
4260+
byte_end - partial_end,
4261+
partial_end + 1, NULL);
42674262
return err;
42684263
}
42694264

0 commit comments

Comments
 (0)