Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2044245lqz; Tue, 2 Apr 2024 05:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5JV8asVkfnb6lGkr94FlIYPOjspcRb4N42HI0ZYTwYsjWMbHoRyPW0EPpKPQNdLi2Z8m93uNIpf8kH6d4UEYBKS/TuYLDLkxdwE6VqQ== X-Google-Smtp-Source: AGHT+IERTVMFB3AgxfExZUOfn84dZGaWoYYzAfZv3uVrYTL3MWgilkT2QPjum1CyG5GGqCZ6lXjG X-Received: by 2002:a05:620a:12e9:b0:78a:397f:9f71 with SMTP id f9-20020a05620a12e900b0078a397f9f71mr12605028qkl.51.1712062605497; Tue, 02 Apr 2024 05:56:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712062605; cv=pass; d=google.com; s=arc-20160816; b=nBnzhJ7LXG1fsKbL9vE0p+PAknhHv0epahJcorKX9XUsrfkdui4mMzSsMACuwlWraz 7NIlYx2CJFaBlFM0vZhhmO/ap9upL79TxAdydxuxB9IkpU2D7gvROE+eP8wkH8CeUWlQ Ui5pJI53fNEYHAj33wDE8/5agPgIyZWfmAw8u0W2gouN8GrE+/AAtFV070PpT2FMhiJy 10S/Wcph2CshWPbKPpRdgGltC3LDYgM3PqXq+UX+8WrUUXz6GsnCO7lgEex/9WkR855M auTw8kGjssGVP9HFfheAJLcNT745Eo9YyvKPa/tEUlXO9dyTsDsABy+frAUnQs/zeIax RblA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=QVwsTL4VXfxmQnjRGfaT+5S6pqQmO4IL8cSJr05k2/4=; fh=e0d0/ooe6Ni/BYswxN6ADyEXgxpSEEzz9NORz71oiJc=; b=YASYgqYDRkoSTcDCoefveBOK0ZG5RXDL0pxF9XNQMZGSlOO9wD7j+/y8VF33ud1lRk nfnw8EW17LqdLL7swcS1xvptNByGaaoi334cDmea/yA4WQqb/K85vHr4WuSChcaS4SBv R9UD/Ss8/45D9N9rIFAnDhtsbH64U/dml01RWxyFOyKhpwGL+OlyDo6Eh1geNP2b1Klv efNdVza2Ib+dTjPK968y/nuOf+39vWzaCwWEQG+8k4cdIvnuO8lq+sKLgaVfyQFLcifk 51sIZWdDvtCDkt2ItvAMNHYSfXgvJOWpAT04cR5cl6hLQckwS8QVHnaDqhhGVSK92uva PFoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Or4i/ENo"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-1822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1822-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f6-20020a05620a12e600b0078a0b02960fsi11705202qkl.232.2024.04.02.05.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 05:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Or4i/ENo"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-1822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1822-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 261031C22DA9 for ; Tue, 2 Apr 2024 12:56:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C95F84A33; Tue, 2 Apr 2024 12:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Or4i/ENo"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="9YvGzYa7" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C2A283CB9; Tue, 2 Apr 2024 12:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712062561; cv=none; b=fnLAOp+OE8e9Vyx2J0UgyUdOaiw3m+vb45Cs9u9f+NsFSbvcN3ZarQ3bYPcyGL+DbbkCNnnYUuWdrOW1nSNAK28xeCLnqBNZ54cT+Hyz5lzuShsKWvCKdu5pgtCCDpQqIcpTxLPVP1zdqo3gOJcGukwOB9SosheATxdNWD80zFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712062561; c=relaxed/simple; bh=TtZLtq8Hz8doC1J37xg6YqY30LO/H0F9ybpVFSesKt0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HaEjgy62JpE8YuLIZry/MAS+qnQRJNrYEPGylBd3bPN0elis6rkzifg3qY5u6zRMclkGCLSiy7jzzBzFtGKyKQeBwmF+MCrMmzjQoGQpaau9bIGUOkJyUx+euJ6pBQFIJ5Gb7Lm0C32XycXAXu2E/aCo/zoxzDsAjoJpNwK4qH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Or4i/ENo; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=9YvGzYa7; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 17ADD5BD3D; Tue, 2 Apr 2024 12:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712062556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QVwsTL4VXfxmQnjRGfaT+5S6pqQmO4IL8cSJr05k2/4=; b=Or4i/ENo7CiiZ589iN6rMHL38JcSTi9UPmnJ2Rjvx4aLBY7fBvcKc70W44UE4rMjJ0tFjv lCiYvXQHjkbQTMbBvDqudo58qLeRQo5HkaQVha9hv3VX5Mg789mR4wNM0tPSobF0yHIYR7 c1nENf7lzNgIBhNNbRT76JFgQ0wB884= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712062556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QVwsTL4VXfxmQnjRGfaT+5S6pqQmO4IL8cSJr05k2/4=; b=9YvGzYa7eQPk5x2MdCr3lPY3PCCb3v4ndrCCWR+POUOJaK3EaZSIL3SfMeXX1m93x/QKzj 1Vj617lGCLCjM0DA== Authentication-Results: smtp-out2.suse.de; dkim=none Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 0CC3413357; Tue, 2 Apr 2024 12:55:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id MQ4aA1wADGZnSQAAn2gu4w (envelope-from ); Tue, 02 Apr 2024 12:55:56 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 9CE09A0813; Tue, 2 Apr 2024 14:55:55 +0200 (CEST) Date: Tue, 2 Apr 2024 14:55:55 +0200 From: Jan Kara To: "yebin (H)" Cc: "Darrick J. Wong" , tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jack@suse.cz Subject: Re: [PATCH] jbd2: use shrink_type type instead of bool type for __jbd2_journal_clean_checkpoint_list() Message-ID: <20240402125555.kqxsfmzeaeqbsmdp@quack3> References: <20240401011614.3650958-1-yebin10@huawei.com> <20240401024417.GA739535@frogsfrogsfrogs> <660A5535.7080005@huawei.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <660A5535.7080005@huawei.com> X-Rspamd-Queue-Id: 17ADD5BD3D X-Spamd-Result: default: False [-2.81 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; R_DKIM_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_TLS_LAST(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap2.dmz-prg2.suse.org:rdns,imap2.dmz-prg2.suse.org:helo,huawei.com:email] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Score: -2.81 X-Spam-Level: X-Spam-Flag: NO On Mon 01-04-24 14:33:25, yebin (H) wrote: > On 2024/4/1 10:44, Darrick J. Wong wrote: > > On Mon, Apr 01, 2024 at 09:16:14AM +0800, Ye Bin wrote: > > > "enum shrink_type" can clearly express the meaning of the parameter of > > > __jbd2_journal_clean_checkpoint_list(), and there is no need to use the > > > bool type. > > > > > > Signed-off-by: Ye Bin > > > --- > > > fs/jbd2/checkpoint.c | 9 +++------ > > > fs/jbd2/commit.c | 2 +- > > > include/linux/jbd2.h | 4 +++- > > > 3 files changed, 7 insertions(+), 8 deletions(-) > > > > > > diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c > > > index 1c97e64c4784..d6e8b80a4078 100644 > > > --- a/fs/jbd2/checkpoint.c > > > +++ b/fs/jbd2/checkpoint.c > > > @@ -337,8 +337,6 @@ int jbd2_cleanup_journal_tail(journal_t *journal) > > > /* Checkpoint list management */ > > > -enum shrink_type {SHRINK_DESTROY, SHRINK_BUSY_STOP, SHRINK_BUSY_SKIP}; > > > - > > > /* > > > * journal_shrink_one_cp_list > > > * > > > @@ -476,17 +474,16 @@ unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal, > > > * > > > * Called with j_list_lock held. > > > */ > > > -void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy) > > > +void __jbd2_journal_clean_checkpoint_list(journal_t *journal, > > > + enum shrink_type type) The comment above this function needs updating after this change. > > > { > > > transaction_t *transaction, *last_transaction, *next_transaction; > > > - enum shrink_type type; > > > bool released; > > > transaction = journal->j_checkpoint_transactions; > > > if (!transaction) > > > return; > > > - type = destroy ? SHRINK_DESTROY : SHRINK_BUSY_STOP; > > What is supposed to happen if the caller passes in SHRINK_BUSY_SKIP? > > > > --D > > If SHRING_BUSY_SKIP is passed, the buffers in use will be skipped during traversal > and release.Currently, SHRINKING_BUSY_SKIP is used in the memory reclamation process. I guess Darrick was wondering whether there's some usefulness in calling __jbd2_journal_clean_checkpoint_list() with SHRINKING_BUSY_SKIP. I agree it does no harm but as we have seen in the past, it just wastes CPU cycles scanning the buffer list in some cases so that's why we created SHRINKING_BUSY_STOP. I also agree the 'bool' argument isn't great and the enum is actually explaining more so I'm in favor of switching to enum but perhaps we can have WARN_ON_ONCE(type == SHRINKING_BUSY_SKIP) (perhaps with a short explanation in the comment above the function) to see if we accidentally didn't grow unexpected use. Honza -- Jan Kara SUSE Labs, CR