Skip to content

Commit bfa1a58

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 7c8d29b commit bfa1a58

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
@@ -1748,7 +1748,7 @@ static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc,
17481748

17491749
static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17501750
struct folio *folio, u64 pos, u64 end_pos, unsigned dirty_len,
1751-
unsigned *count)
1751+
bool *wb_pending)
17521752
{
17531753
int error;
17541754

@@ -1776,7 +1776,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17761776
error = iomap_add_to_ioend(wpc, folio, pos, end_pos,
17771777
map_len);
17781778
if (!error)
1779-
(*count)++;
1779+
*wb_pending = true;
17801780
break;
17811781
}
17821782
dirty_len -= map_len;
@@ -1863,7 +1863,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
18631863
u64 pos = folio_pos(folio);
18641864
u64 end_pos = pos + folio_size(folio);
18651865
u64 end_aligned = 0;
1866-
unsigned count = 0;
1866+
bool wb_pending = false;
18671867
int error = 0;
18681868
u32 rlen;
18691869

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

1916-
if (count)
1916+
if (wb_pending)
19171917
wpc->nr_folios++;
19181918

19191919
/*
@@ -1935,7 +1935,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
19351935
if (atomic_dec_and_test(&ifs->write_bytes_pending))
19361936
folio_end_writeback(folio);
19371937
} else {
1938-
if (!count)
1938+
if (!wb_pending)
19391939
folio_end_writeback(folio);
19401940
}
19411941
mapping_set_error(inode->i_mapping, error);

0 commit comments

Comments
 (0)