Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp430194pxb; Thu, 13 Jan 2022 09:16:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOrvkqaKlmvn5s9YJbN4efgotoqzgQCTE9TaKtU8GlSVdAb4dqm4T9PlKrwklhCkbggTyy X-Received: by 2002:a17:902:f681:b0:14a:2a1e:4692 with SMTP id l1-20020a170902f68100b0014a2a1e4692mr5465048plg.99.1642094180922; Thu, 13 Jan 2022 09:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642094180; cv=none; d=google.com; s=arc-20160816; b=Bj0K/xz0rFvLXfmscGaIK+em7fQ5g164rsO1b8DbHXQJ+dOaXUKqvpE9UH9gJOsYgL QHoOXX8DuZxQ6l3oDM9hhUty+RlruIiARAvMa5nVZonHsrklStXW3ORyO3Gut9ED6A8b TP9kksYn3XQCXgGd79FReU3vdHG5F9xvVBZ3vDMB5IDQIOzv/gMQkVr7cN/1z0x2U/DE NZUdbWmUGQQSJxP4ywFsFjxLjUhMIB7pRdKoDsYJvDVG6hbq5me43VhGd+ZjJH363dNW 6v4RcCDZRO3RzLArjfnWfWjog5/cyeMa1cU40j/i3iZcfM9UdzeIGVtFtxWIZj3mN+2x Uigw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=knNxTHuHCUWy+TfikTNU9RikhIY8xv43/13z9bJTOUE=; b=DWc3BQomOGpo6y8/3Tr2sadNU+uMBW7ic5kWzCAEk940HtPKxNoXPm4GgtYMtjAS5E 7vjAceyvvtRStb5UY5SAqO0DPv/qlPV7xsx0NNZixo7xmu89XkREm4sukFTJ5c22q5xA 0QFqs9Cy8T9iw1PtfUB1R2kFz/Mj0RV9guu4pgvjMlD8G2DEzfaYiYpUCvD7t5EeODM1 yR31/bK6kGPCH38NL2/Wm8R/ues8EVWCPA2UB8q151MiEFLmlYMmsaQa3fHL3ov6Y5O5 Cz2vM2bUOJtgR3c41OWZ6UluuVPrdVxc3zazbka0IAilwtzH8FtstXJa6DPWbP1f1ouT 897w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=hPdAG+6s; dkim=neutral (no key) header.i=@suse.cz header.b=ByKIMFrB; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ls2si4006886pjb.70.2022.01.13.09.16.05; Thu, 13 Jan 2022 09:16:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=hPdAG+6s; dkim=neutral (no key) header.i=@suse.cz header.b=ByKIMFrB; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234175AbiAMLax (ORCPT + 99 others); Thu, 13 Jan 2022 06:30:53 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:46446 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbiAMLaw (ORCPT ); Thu, 13 Jan 2022 06:30:52 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 861181F3A5; Thu, 13 Jan 2022 11:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642073451; 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=knNxTHuHCUWy+TfikTNU9RikhIY8xv43/13z9bJTOUE=; b=hPdAG+6sEAbjAcgtqa89wm7DgwL8JgdEyvPYxKcqohHVkCH/gjeus+5xKe4Z+jBtifr8gT sS5iyvLPxGb5VRDeOxFyCMG2sYOsTY+a5B7mj2hzB/bwj2Qn1nBy7Bruz68U1jrXWTsrK6 NIxnXAhHdzFOZlrEfRmbM2Hkm02J3kE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642073451; 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=knNxTHuHCUWy+TfikTNU9RikhIY8xv43/13z9bJTOUE=; b=ByKIMFrBvSO/sVz8lPoa39xOYyxeqYwimGsvQdry6rrvuIYkGSP/fegbtaLrTFBQYEIWbX Qr3a96MQCvZ1xaBw== Received: from quack3.suse.cz (unknown [10.163.28.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 72926A3B87; Thu, 13 Jan 2022 11:30:51 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 317CAA05E2; Thu, 13 Jan 2022 12:30:51 +0100 (CET) Date: Thu, 13 Jan 2022 12:30:51 +0100 From: Jan Kara To: Ritesh Harjani Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Andreas Dilger , tytso@mit.edu, Eric Whitney Subject: Re: [PATCH 5/6] jbd2: Refactor wait logic for transaction updates into a common function Message-ID: <20220113113051.5ehxl2ap3v64eyya@quack3.lan> References: <95fa94cbeb4bb0275430a6721a588bd738d5a9aa.1642044249.git.riteshh@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <95fa94cbeb4bb0275430a6721a588bd738d5a9aa.1642044249.git.riteshh@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 13-01-22 08:56:28, Ritesh Harjani wrote: > No functionality change as such in this patch. This only refactors the > common piece of code which waits for t_updates to finish into a common > function named as jbd2_journal_wait_updates(journal_t *) > > Signed-off-by: Ritesh Harjani Just one nit, otherwise. Feel free to add: Reviewed-by: Jan Kara > @@ -1757,6 +1757,35 @@ static inline unsigned long jbd2_log_space_left(journal_t *journal) > return max_t(long, free, 0); > } > > +/* > + * Waits for any outstanding t_updates to finish. > + * This is called with write j_state_lock held. > + */ > +static inline void jbd2_journal_wait_updates(journal_t *journal) > +{ > + transaction_t *commit_transaction = journal->j_running_transaction; > + > + if (!commit_transaction) > + return; > + > + spin_lock(&commit_transaction->t_handle_lock); > + while (atomic_read(&commit_transaction->t_updates)) { > + DEFINE_WAIT(wait); > + > + prepare_to_wait(&journal->j_wait_updates, &wait, > + TASK_UNINTERRUPTIBLE); > + if (atomic_read(&commit_transaction->t_updates)) { > + spin_unlock(&commit_transaction->t_handle_lock); > + write_unlock(&journal->j_state_lock); > + schedule(); > + write_lock(&journal->j_state_lock); > + spin_lock(&commit_transaction->t_handle_lock); > + } > + finish_wait(&journal->j_wait_updates, &wait); > + } > + spin_unlock(&commit_transaction->t_handle_lock); > +} > + I don't think making this inline makes sence. Neither the commit code nor jbd2_journal_lock_updates() are so hot that it would warrant this large inline function... Honza -- Jan Kara SUSE Labs, CR