From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12591C46CD2 for ; Tue, 30 Jan 2024 14:16:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EF206B0083; Tue, 30 Jan 2024 09:16:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 79F706B0089; Tue, 30 Jan 2024 09:16:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 666B46B008A; Tue, 30 Jan 2024 09:16:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 541956B0083 for ; Tue, 30 Jan 2024 09:16:09 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1934980837 for ; Tue, 30 Jan 2024 14:16:09 +0000 (UTC) X-FDA: 81736176858.24.D8CA962 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf09.hostedemail.com (Postfix) with ESMTP id 12E55140009 for ; Tue, 30 Jan 2024 14:16:05 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706624166; a=rsa-sha256; cv=none; b=wMrjh6FgmD9f1rH24u43Zc4yRdG3M70gbiLqa20c5NdUyihg0ZkQZDBiDTrSItrhEhFZGg tZAKkO5sjhujXWO9+92D+UpBmKpicDq2JwRDlV+36X3yuJxTLDPQY9lBNOsUS8lx309Bj2 sWXdOaZV1QDi3D32Age3La9zVlDswgE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706624166; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cI5g0uYBr+vLeFJJ5y1vPxAZ0Tx+uCAvCHpzBjq2PmU=; b=vpJJ4FuLndJi3+oR+5urjAj3/a3Xw2c9WlJ/59ZEjr5VpUnwdq+ZwcmAL5fuhN5gawE+Dg c8Hmje5qfOi7t/g/OOZ3lXxarOBHTgDffY0BDndjIzqPePIjiT5osAZv/xJ/s6EUqHzhUh Woui58QYRMiL0qJgkPK673bQ58nE/DM= Received: by verein.lst.de (Postfix, from userid 2407) id 9847868C4E; Tue, 30 Jan 2024 15:16:01 +0100 (CET) Date: Tue, 30 Jan 2024 15:16:01 +0100 From: Christoph Hellwig To: Jan Kara Cc: Christoph Hellwig , linux-mm@kvack.org, Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 19/19] writeback: simplify writeback iteration Message-ID: <20240130141601.GA31330@lst.de> References: <20240125085758.2393327-1-hch@lst.de> <20240125085758.2393327-20-hch@lst.de> <20240130104605.2i6mmdncuhwwwfin@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240130104605.2i6mmdncuhwwwfin@quack3> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 12E55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zIqJSr6Ma9NBEZuAaY6U6zq6JLLt8e/oG+tYTOalOdK6Sgbgc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jan 30, 2024 at 11:46:05AM +0100, Jan Kara wrote: > Looking at it now I'm thinking whether we would not be better off to > completely dump the 'error' argument of writeback_iter() / > writeback_iter_next() and just make all .writepage implementations set > wbc->err directly. But that means touching all the ~20 writepage > implementations we still have... Heh. I actually had an earlier version that looked at wbc->err in the ->writepages callers. But it felt a bit too ugly. > > + */ > > + if (wbc->sync_mode == WB_SYNC_NONE && > > + (wbc->err || wbc->nr_to_write <= 0)) > > + goto finish; > > I think it would be a bit more comprehensible if we replace the goto with: > folio_batch_release(&wbc->fbatch); > if (wbc->range_cyclic) > mapping->writeback_index = > folio->index + folio_nr_pages(folio); > *error = wbc->err; > return NULL; I agree that keeping the logic on when to break and when to set the writeback_index is good, but duplicating the batch release and error assignment seems a bit suboptimal. Let me know what you think of the alternatŃ–ve variant below. > > + struct folio *folio = 0; > ^^ NULL please Fixed. > > ret = writeback_use_writepage(mapping, wbc); > > + if (!ret) > > + ret = wbc->err; > > AFAICT this should not be needed as writeback_iter() made sure wbc->err is > returned when set? Heh. That's a leftover from my above mentioned different attempt at error handling and shouldn't have stayed in.