]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iomap: cleanup the pending writeback tracking in iomap_writepage_map_blocks
authorJoanne Koong <joannelkoong@gmail.com>
Thu, 10 Jul 2025 13:33:27 +0000 (15:33 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 14 Jul 2025 08:51:31 +0000 (10:51 +0200)
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 <joannelkoong@gmail.com>
[hch: rename the variable, update the commit message]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/20250710133343.399917-4-hch@lst.de
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c

index 77d44b691b81443bd5d0101c88bed01a16f57b77..93b2a90e6867acc6e401fd7525f4562b787714d2 100644 (file)
@@ -1750,7 +1750,7 @@ new_ioend:
 
 static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
                struct folio *folio, u64 pos, u64 end_pos, unsigned dirty_len,
-               unsigned *count)
+               bool *wb_pending)
 {
        int error;
 
@@ -1778,7 +1778,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
                        error = iomap_add_to_ioend(wpc, folio, pos, end_pos,
                                        map_len);
                        if (!error)
-                               (*count)++;
+                               *wb_pending = true;
                        break;
                }
                dirty_len -= map_len;
@@ -1865,7 +1865,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
        u64 pos = folio_pos(folio);
        u64 end_pos = pos + folio_size(folio);
        u64 end_aligned = 0;
-       unsigned count = 0;
+       bool wb_pending = false;
        int error = 0;
        u32 rlen;
 
@@ -1909,13 +1909,13 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
        end_aligned = round_up(end_pos, i_blocksize(inode));
        while ((rlen = iomap_find_dirty_range(folio, &pos, end_aligned))) {
                error = iomap_writepage_map_blocks(wpc, folio, pos, end_pos,
-                               rlen, &count);
+                               rlen, &wb_pending);
                if (error)
                        break;
                pos += rlen;
        }
 
-       if (count)
+       if (wb_pending)
                wpc->nr_folios++;
 
        /*
@@ -1937,7 +1937,7 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
                if (atomic_dec_and_test(&ifs->write_bytes_pending))
                        folio_end_writeback(folio);
        } else {
-               if (!count)
+               if (!wb_pending)
                        folio_end_writeback(folio);
        }
        mapping_set_error(inode->i_mapping, error);