From mboxrd@z Thu Jan 1 00:00:00 1970 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 21A4A2DEA98; Tue, 8 Jul 2025 13:51:45 +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=1751982707; cv=none; b=YbJsJwlvYuxZWK3UQn3xtseBqJ2KdMxQX1XCLb8x+Yh3pVQ+21XQWTHvR4dP7IvBaAaIHkt7OZ2nMjQEhCsGyhbsXmISOn4iy1Q6p/TWlrRu0XteBCrdxKFjUzb97lvc3bmiXyUE4UhLZeTRiC9jzNwtP+pNicBJBkx7kDDcerw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751982707; c=relaxed/simple; bh=dgnpXv8KS4aKSVifJDi36p9qLYDfMXO9dBpNJB5RR3A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NCv8GRkkuIcxcSuxCI5+ptB6WZdpxfvMI/vEAYCcgCQ69JJk9FPu56v2tML9nXtkIMzNw5L0De86gfuC36I7+bOiolxRJpgJql1dEah/iHUrjImdzHU/oMEDffRpdAK595OcXUjRcG1goDeHUDxgi1sAs3s75pG+sn8uAtd1pgk= 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=Qa911K4/; 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="Qa911K4/" 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=yOo5NeoOy0o4PLpz7NWMokzem3AVK3vZ/Wuwkw5A9Fc=; b=Qa911K4/IjhwU4SmBZK0njqIKw mGMUaJZkuPODJMyg8AheUELjq6OARnq15QNf57dh1y15ZkfrmzemPGyG65LpTU1m1uefZzbdXD8V9 WT32LxLUMjYMbJ3qkP+5cdjY098HFu4TT2BIsP0cHrPLfGIlL17pMhPCbGkXxccnfLY+ss0RviDqF 66Tk972UrCZAFeKoKGDqoEsMA3n74bcEoUgdjlH0to4vNRdohUZSF3IlTVeZS6khksIPfkTrvUOp8 rJZjMDS7ageKWsPENW2AmGHEkfeW8rPUV+zbTSdUD5bSipQpV81tHhLfz7b9VNS3sMvpc371Q+85f lemPulTw==; 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 1uZ8jY-00000005UOM-3toC; Tue, 08 Jul 2025 13:51:45 +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: Tue, 8 Jul 2025 15:51:09 +0200 Message-ID: <20250708135132.3347932-4-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250708135132.3347932-1-hch@lst.de> References: <20250708135132.3347932-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org 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 2806ec1e0b5e..372342bfffa3 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1748,7 +1748,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; @@ -1776,7 +1776,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; @@ -1863,7 +1863,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; @@ -1907,13 +1907,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++; /* @@ -1935,7 +1935,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