Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEF6525D1F7; Thu, 10 Jul 2025 13:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752154439; cv=none; b=C+u8/sIaLjq6xjmAyNpSSFZJxw9OwjeXmm/uGyFo+7Ngs79ozRa10qIaeMzqb6YBCdDmztQ1Tl8KnbngpvwGL7VNjChShnpdNmK5q62iRfpI22NmDky5Z5IkjlN8yAzHFvCBzwmzu4LQUvmJnjWlJ4cil/NDoQfQIBUoSMKR5BM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752154439; c=relaxed/simple; bh=xuZ4xtvZHGn6G0DRQnXo9UkSPLYEIlsBj00SixUfwGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cx2sP/k0Ou4Ux0i0xVlP356W1LSCmnZmcATgg0Ez2SAvkQXfjwApwN2g0R/KpmIs1Gyq6PVaTkoaVcupKWkaAjE8L+G2wIRJHojq3CKh6YVAgAbfZe4Nc42sKRIsg0z9tDxc8svgYShu6bpmvY2Hzh4GaaFgJWAVtzfwhxqtRMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GP5iIK52; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GP5iIK52" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=hO62o130vzpE9xwB4GbBaMTDQtL0XN4Ft8UuGQ18xCs=; b=GP5iIK5299+UhqNEQD+iYUJueD VlEI0efC9j65AeL1ZIncsAqYoJi63OIp+AohNThM0yTSRjQqKk3CcNnsWyLUrUJDot87usfWFKKlC G0RWBnk9ZNVOBnbdRD3LjGEvgJ7bKLPwMrwVmYPUthwUWQzU5bz9oMZu9LgUBoTtHXx1KU2n6oke0 d0vwGnIavRZlnS9iZ5UI+X3p1Ur5+QAkgUtM4Kyg+4HKGfC7zR86zUeN5hWtejVRsS4EJFPJAPIva 2F4dQmf7goNICGcKSB+46vlmMMBk/YPW4wXmtxfhX25ZpNC6dFCjW2qV1HTiWOZ1v0MQqSlRE02LU 2w9gId8A==; Received: from 2a02-8389-2341-5b80-d601-7564-c2e0-491c.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:d601:7564:c2e0:491c] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1uZrPQ-0000000BwS7-2n5h; Thu, 10 Jul 2025 13:33:57 +0000 From: Christoph Hellwig To: Christian Brauner Cc: "Darrick J. Wong" , Joanne Koong , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-block@vger.kernel.org, gfs2@lists.linux.dev, Brian Foster , Johannes Thumshirn Subject: [PATCH 03/14] iomap: cleanup the pending writeback tracking in iomap_writepage_map_blocks Date: Thu, 10 Jul 2025 15:33:27 +0200 Message-ID: <20250710133343.399917-4-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250710133343.399917-1-hch@lst.de> References: <20250710133343.399917-1-hch@lst.de> Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html From: Joanne Koong 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 [hch: rename the variable, update the commit message] Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Johannes Thumshirn Reviewed-by: "Darrick J. Wong" --- fs/iomap/buffered-io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 77d44b691b81..93b2a90e6867 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1750,7 +1750,7 @@ static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, 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); -- 2.47.2