Skip to content

Commit bb6b180

Browse files
zhangyi089tytso
authored andcommitted
ext4: drop iblock parameter
The start block of the delalloc extent to be inserted is equal to map->m_lblk, just drop the duplicate iblock input parameter. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Ritesh Harjani (IBM) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 14a210c commit bb6b180

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/ext4/inode.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,8 +1712,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk)
17121712
* time. This function looks up the requested blocks and sets the
17131713
* buffer delay bit under the protection of i_data_sem.
17141714
*/
1715-
static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
1716-
struct ext4_map_blocks *map,
1715+
static int ext4_da_map_blocks(struct inode *inode, struct ext4_map_blocks *map,
17171716
struct buffer_head *bh)
17181717
{
17191718
struct extent_status es;
@@ -1733,8 +1732,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
17331732
(unsigned long) map->m_lblk);
17341733

17351734
/* Lookup extent status tree firstly */
1736-
if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) {
1737-
retval = es.es_len - (iblock - es.es_lblk);
1735+
if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) {
1736+
retval = es.es_len - (map->m_lblk - es.es_lblk);
17381737
if (retval > map->m_len)
17391738
retval = map->m_len;
17401739
map->m_len = retval;
@@ -1754,7 +1753,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
17541753
return 0;
17551754
}
17561755

1757-
map->m_pblk = ext4_es_pblock(&es) + iblock - es.es_lblk;
1756+
map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk;
17581757
if (ext4_es_is_written(&es))
17591758
map->m_flags |= EXT4_MAP_MAPPED;
17601759
else if (ext4_es_is_unwritten(&es))
@@ -1790,8 +1789,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
17901789
* is held in write mode, before inserting a new da entry in
17911790
* the extent status tree.
17921791
*/
1793-
if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) {
1794-
retval = es.es_len - (iblock - es.es_lblk);
1792+
if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) {
1793+
retval = es.es_len - (map->m_lblk - es.es_lblk);
17951794
if (retval > map->m_len)
17961795
retval = map->m_len;
17971796
map->m_len = retval;
@@ -1848,7 +1847,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
18481847
* preallocated blocks are unmapped but should treated
18491848
* the same as allocated blocks.
18501849
*/
1851-
ret = ext4_da_map_blocks(inode, iblock, &map, bh);
1850+
ret = ext4_da_map_blocks(inode, &map, bh);
18521851
if (ret <= 0)
18531852
return ret;
18541853

0 commit comments

Comments
 (0)