Skip to content

Commit 7c3e774

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 18da355 commit 7c3e774

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

17541754
static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17551755
struct folio *folio, u64 pos, u64 end_pos, unsigned dirty_len,
1756-
unsigned *count)
1756+
bool *wb_pending)
17571757
{
17581758
int error;
17591759

@@ -1781,7 +1781,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17811781
error = iomap_add_to_ioend(wpc, folio, pos, end_pos,
17821782
map_len);
17831783
if (!error)
1784-
(*count)++;
1784+
*wb_pending = true;
17851785
break;
17861786
}
17871787
dirty_len -= map_len;
@@ -1868,7 +1868,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
18681868
u64 pos = folio_pos(folio);
18691869
u64 end_pos = pos + folio_size(folio);
18701870
u64 end_aligned = 0;
1871-
unsigned count = 0;
1871+
bool wb_pending = false;
18721872
int error = 0;
18731873
u32 rlen;
18741874

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

1921-
if (count)
1921+
if (wb_pending)
19221922
wpc->nr_folios++;
19231923

19241924
/*
@@ -1940,7 +1940,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
19401940
if (atomic_dec_and_test(&ifs->write_bytes_pending))
19411941
folio_end_writeback(folio);
19421942
} else {
1943-
if (!count)
1943+
if (!wb_pending)
19441944
folio_end_writeback(folio);
19451945
}
19461946
mapping_set_error(inode->i_mapping, error);

0 commit comments

Comments
 (0)