Skip to content

Commit caeb323

Browse files
joannekoongkawasaki
authored andcommitted
iomap: cleanup the pending writeback tracking in iomap_writepage_map_blocks
We don't care about the count of outstanding ioends, just if there is one. Replace the count variable passed to iomap_writepage_map_blocks with a boolean to make that more clear. Signed-off-by: Joanne Koong <[email protected]> [hch: rename the variable, update the commit message] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]>
1 parent acfa970 commit caeb323

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

fs/iomap/buffered-io.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc,
17501750

17511751
static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17521752
struct folio *folio, u64 pos, u64 end_pos, unsigned dirty_len,
1753-
unsigned *count)
1753+
bool *wb_pending)
17541754
{
17551755
int error;
17561756

@@ -1778,7 +1778,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17781778
error = iomap_add_to_ioend(wpc, folio, pos, end_pos,
17791779
map_len);
17801780
if (!error)
1781-
(*count)++;
1781+
*wb_pending = true;
17821782
break;
17831783
}
17841784
dirty_len -= map_len;
@@ -1865,7 +1865,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
18651865
u64 pos = folio_pos(folio);
18661866
u64 end_pos = pos + folio_size(folio);
18671867
u64 end_aligned = 0;
1868-
unsigned count = 0;
1868+
bool wb_pending = false;
18691869
int error = 0;
18701870
u32 rlen;
18711871

@@ -1909,13 +1909,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
19091909
end_aligned = round_up(end_pos, i_blocksize(inode));
19101910
while ((rlen = iomap_find_dirty_range(folio, &pos, end_aligned))) {
19111911
error = iomap_writepage_map_blocks(wpc, folio, pos, end_pos,
1912-
rlen, &count);
1912+
rlen, &wb_pending);
19131913
if (error)
19141914
break;
19151915
pos += rlen;
19161916
}
19171917

1918-
if (count)
1918+
if (wb_pending)
19191919
wpc->nr_folios++;
19201920

19211921
/*
@@ -1937,7 +1937,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
19371937
if (atomic_dec_and_test(&ifs->write_bytes_pending))
19381938
folio_end_writeback(folio);
19391939
} else {
1940-
if (!count)
1940+
if (!wb_pending)
19411941
folio_end_writeback(folio);
19421942
}
19431943
mapping_set_error(inode->i_mapping, error);

0 commit comments

Comments
 (0)