Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1500121lqe; Mon, 8 Apr 2024 10:31:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMUnU1CKTA/D3sdpMu0fTUr/OQmxkMjN0IW+3FTPKO/rJnzfx51RKmO/oqOHmH8kILw/P/v5NAuqNQglKYxhyf13t6l5dBWoa11jlP8g== X-Google-Smtp-Source: AGHT+IFHxxVMyH6vU4grmXhHrE9Z63bIXKtg7Zhsnnkegfll4JAHSsYXe/WSwDFy242mStF1aHSl X-Received: by 2002:a17:902:db06:b0:1e4:fd4:48df with SMTP id m6-20020a170902db0600b001e40fd448dfmr613112plx.0.1712597504232; Mon, 08 Apr 2024 10:31:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712597504; cv=pass; d=google.com; s=arc-20160816; b=RB1EY6e6lp1bk02BD4RZHew1fQBiJpUQZlVbFiEo/WnSDuAyrNIeSUM8Lcs9ByZnFb lDxUWCva9s/sD78QP4Ckpwst1FoGX58TCNa2f2kV8ncMhNVx2XpuZ5zsLBIpSLGcSGlX LPfcdXYhcCwVd/rtOE5fOc5hBaE+QefUZM1gprxF5sKSvoX6dPLoa3eLhtDp2LyzXnxu wAMASjMl2rCifaMtQTFvpqOwP7gQyB6JfBBDiHHo3O+XNFpJS/Ctm01TT0fxgaKpNp4P 9pNm3oGeC+benfLrq1yL/vaPZyr3efINwSXTw3mvXMxP7N9PEkPhgTuf1+7f5ZjSAgUN 14yQ== 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:dkim-signature :dkim-signature; bh=xV81rmNEyhjlhM2Tp+PiGt98fW3umGqOG+Ocyj52zOw=; fh=i/0chK/FByAELe5QhcdHcWA35Du8/aBfsMhtRi5T8NY=; b=ShU2eLCGy5g7DVW+4Pasec4VpgglYEfx8Msp0nTmuEiramBQyLOSMT02cyJzYDSuTK Sf5u7GMtZPlX4a4789BNFOcp4e6TX70niMS55HmDwRhfU0RszY5ayOXWWnPlwyVuXtce VSnOqDhBs6PkWjJV8Wh2fZ5hoSL5wpaXRowuk3q+xCGbaFWgLMFK27gmVo+WfMwkwmpc WuoG2OTnskp1Tew9t5wX/fzqbvrB+lN21PETS1yclL9OVgQnLIfcFxFQuadqY1PNzwwf var3nx01peVI/Vt0OnzGIyAmbmVIjriwExmbDMCpnN+fkodG5/cDFuVD1YpehRXGllEB ZZ0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=2FwAFRh7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=2FwAFRh7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=C8hwhnVW; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135754-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y33-20020a634b21000000b005dd99dbfe0bsi6755780pga.892.2024.04.08.10.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:31:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=2FwAFRh7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=2FwAFRh7; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=C8hwhnVW; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135754-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B5DA0287F99 for ; Mon, 8 Apr 2024 17:31:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 459AB143C6A; Mon, 8 Apr 2024 17:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2FwAFRh7"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="C8hwhnVW"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2FwAFRh7"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="C8hwhnVW" 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 4230B7460; Mon, 8 Apr 2024 17:31:00 +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=1712597462; cv=none; b=eQmfPK3+l8yRo+7LjUcdY/K+SafrH+c+6n3FjBzl8ZcNnG0vC/c/YQDfsxqHGOdD2qbQl65x/qiXIAId9cVDt2v6fz2Xk05u3DnobsFw0SnedvrwZ1FKe01Ql/5rgn8pH4S4wXuzMnAreOaQR/wS/jtwHlKKgAtFt4hUskWa4FE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712597462; c=relaxed/simple; bh=twqbe68/XRyzhadcXrUVGJkZd/W9Wk/J9xpcSGDM68s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ifkn+u33o/ZOl3HNPSMiyISHSuExabHxnwaCzJJbHy6KMF5ZSNluGRqrtUbPcvtL6kS/X+pLV1K3YkauKRZJxNBy1XXS/sI7yRTBwQJAIn4x4zF+xc7gne7Xi32qqHOYyVS12FsOQBRqFkfajCUKu1YEYxAoKEA+xQwBQPo1Fk4= 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=2FwAFRh7; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=C8hwhnVW; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=2FwAFRh7; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=C8hwhnVW; 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 0A9A0204A7; Mon, 8 Apr 2024 17:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712597458; 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=xV81rmNEyhjlhM2Tp+PiGt98fW3umGqOG+Ocyj52zOw=; b=2FwAFRh7UixIMuAfk8CfXn0J9As5n1Vz5uJDceH0553zub4gGKorsCmtkvCtWd56/qMrzu baCLrgN0gtQa0MroZUYWXDecNweEQrvPiI6RNgrOEOjFqgFfION/j+vaH4A2BxXdOgzbLL PJMwPFoaF65zmIwxl8H3DiemxMBLJPY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712597458; 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=xV81rmNEyhjlhM2Tp+PiGt98fW3umGqOG+Ocyj52zOw=; b=C8hwhnVW0eBQH+DJAOqdmQpiJixyj+97IoCAhfaqIyz8teTcaKSFWxUb+oHw6lv4kQiO5P /N1Y36DbeN4daOCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=2FwAFRh7; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=C8hwhnVW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712597458; 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=xV81rmNEyhjlhM2Tp+PiGt98fW3umGqOG+Ocyj52zOw=; b=2FwAFRh7UixIMuAfk8CfXn0J9As5n1Vz5uJDceH0553zub4gGKorsCmtkvCtWd56/qMrzu baCLrgN0gtQa0MroZUYWXDecNweEQrvPiI6RNgrOEOjFqgFfION/j+vaH4A2BxXdOgzbLL PJMwPFoaF65zmIwxl8H3DiemxMBLJPY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712597458; 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=xV81rmNEyhjlhM2Tp+PiGt98fW3umGqOG+Ocyj52zOw=; b=C8hwhnVW0eBQH+DJAOqdmQpiJixyj+97IoCAhfaqIyz8teTcaKSFWxUb+oHw6lv4kQiO5P /N1Y36DbeN4daOCw== 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 F2C5E13A92; Mon, 8 Apr 2024 17:30:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id 8e89O9EpFGYkGQAAn2gu4w (envelope-from ); Mon, 08 Apr 2024 17:30:57 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 89EAAA0814; Mon, 8 Apr 2024 19:30:57 +0200 (CEST) Date: Mon, 8 Apr 2024 19:30:57 +0200 From: Jan Kara To: Ye Bin Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jack@suse.cz Subject: Re: [PATCH v2 1/2] jbd2: use shrink_type type instead of bool type for __jbd2_journal_clean_checkpoint_list() Message-ID: <20240408173057.3wn4pnlzrxkai5fc@quack3> References: <20240407065355.1528580-1-yebin10@huawei.com> <20240407065355.1528580-2-yebin10@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240407065355.1528580-2-yebin10@huawei.com> X-Spam-Flag: NO X-Spam-Score: -4.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 0A9A0204A7 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; TO_DN_SOME(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:98:from]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[huawei.com:email,suse.com:email,suse.cz:dkim,suse.cz:email,imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:98:from]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[suse.cz:+] On Sun 07-04-24 14:53:54, 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 Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/jbd2/checkpoint.c | 16 +++++++++------- > fs/jbd2/commit.c | 2 +- > include/linux/jbd2.h | 4 +++- > 3 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c > index 1c97e64c4784..80c0ab98bc63 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 > * > @@ -472,21 +470,25 @@ unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal, > * journal_clean_checkpoint_list > * > * Find all the written-back checkpoint buffers in the journal and release them. > - * If 'destroy' is set, release all buffers unconditionally. > + * If 'type' is SHRINK_DESTROY, release all buffers unconditionally. If 'type' > + * is SHRINK_BUSY_STOP, will stop release buffers if encounters a busy buffer. > + * To avoid wasting CPU cycles scanning the buffer list in some cases, don't > + * pass SHRINK_BUSY_SKIP 'type' for this function. > * > * 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) > { > transaction_t *transaction, *last_transaction, *next_transaction; > - enum shrink_type type; > bool released; > > + WARN_ON_ONCE(type == SHRINK_BUSY_SKIP); > + > transaction = journal->j_checkpoint_transactions; > if (!transaction) > return; > > - type = destroy ? SHRINK_DESTROY : SHRINK_BUSY_STOP; > last_transaction = transaction->t_cpprev; > next_transaction = transaction; > do { > @@ -527,7 +529,7 @@ void jbd2_journal_destroy_checkpoint(journal_t *journal) > spin_unlock(&journal->j_list_lock); > break; > } > - __jbd2_journal_clean_checkpoint_list(journal, true); > + __jbd2_journal_clean_checkpoint_list(journal, SHRINK_DESTROY); > spin_unlock(&journal->j_list_lock); > cond_resched(); > } > diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c > index 5e122586e06e..78ebd04ac97d 100644 > --- a/fs/jbd2/commit.c > +++ b/fs/jbd2/commit.c > @@ -501,7 +501,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) > * frees some memory > */ > spin_lock(&journal->j_list_lock); > - __jbd2_journal_clean_checkpoint_list(journal, false); > + __jbd2_journal_clean_checkpoint_list(journal, SHRINK_BUSY_STOP); > spin_unlock(&journal->j_list_lock); > > jbd2_debug(3, "JBD2: commit phase 1\n"); > diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h > index 971f3e826e15..58a961999d70 100644 > --- a/include/linux/jbd2.h > +++ b/include/linux/jbd2.h > @@ -1434,7 +1434,9 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); > extern void jbd2_journal_commit_transaction(journal_t *); > > /* Checkpoint list management */ > -void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy); > +enum shrink_type {SHRINK_DESTROY, SHRINK_BUSY_STOP, SHRINK_BUSY_SKIP}; > + > +void __jbd2_journal_clean_checkpoint_list(journal_t *journal, enum shrink_type type); > unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal, unsigned long *nr_to_scan); > int __jbd2_journal_remove_checkpoint(struct journal_head *); > int jbd2_journal_try_remove_checkpoint(struct journal_head *jh); > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR