Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp34061pxb; Wed, 4 Nov 2020 13:40:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3SqUBXXB+MGzb+nd0LsSyg6909WOXuGzIBSn8OVyDVlVyCBgshLjqzKV92W4nZ8l642Mc X-Received: by 2002:a17:906:2b4e:: with SMTP id b14mr113009ejg.354.1604526012640; Wed, 04 Nov 2020 13:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604526012; cv=none; d=google.com; s=arc-20160816; b=Lp0PhSTc5m1VQGYyoa1qMMXQ3u0CAItlbs9e0gaE+3xFSnA9hX/ERSOTkBq9CUj0/0 9ZhFqGdrFVg/+Pi+G9pMuxVnhfnPQ99O06dIxOmp8BuBP/9czX5qZ9dYMwGiKXsheeXe CJqnqjZdzZAL3NsRTIkqw9ztX8HYUo4BE6/mMU1qYnpCAjOPDDZ+0IR1UPOa+Vzhswqw zbvF0QTOMFo020FD2X2UwYd78o6URazs2q53XZfiFkLU0iGPBMpK3GBVBkwCWk5WXUal VhHHzpzpPU6qy3H6JDGj3B7txSZTa+ecOMPW514/bP+sO8JQJiwlTJvvMyD6sNQck4OI P6Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QFObasUtiXPKydGigI97edI1fCaY0o3DK1B8Ycx9MKw=; b=qqqlSFHRB7nd9y/XSDlbcTnehUseJZciQAoDDCQSFRlW4/YXAWPh9M2JeQzYOe1pvH Ij5Bn0o4OsQWBI7D6tiH1dSBdgSM65QyVErK4HZLUS29neh2hO7EOmhZLTji60DrHczv q+TuqMAMB7BRgon3ZPn2isSaBV82wXQy2AElgA50t2rkHPsQ4TBbOYnLlYGT5qVJFzTq ihD5y+MQJhx0ogWZuIsLhMcwrKCVE5MnheCk7Aw0q887fRLV0xSUV2gPcC168avI7zNV ZRP/7YKXUr1MoqMeABkbaRqlBUrHurLiK7mwGlESnCjbSHBZ9kRYD0y119GSxeiZuGuW JrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kyvUfnhy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qc1si2399384ejb.315.2020.11.04.13.39.49; Wed, 04 Nov 2020 13:40:12 -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=@gmail.com header.s=20161025 header.b=kyvUfnhy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731414AbgKDVf5 (ORCPT + 99 others); Wed, 4 Nov 2020 16:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731404AbgKDVf5 (ORCPT ); Wed, 4 Nov 2020 16:35:57 -0500 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3705C0613D3 for ; Wed, 4 Nov 2020 13:35:56 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id a10so6838967edt.12 for ; Wed, 04 Nov 2020 13:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QFObasUtiXPKydGigI97edI1fCaY0o3DK1B8Ycx9MKw=; b=kyvUfnhyEnQblgYOVJRYaszDhNkY+Xc5xWBTzS+btZHNSR9zs+QVl5MaWOsEaUWuHZ SvsaIMuomLojf5UA3ZkIIifCo1NZLGDtNIXIsEALPcvfimDsKPNQrvHRtonXxNbzNyt2 4GDkLC3Omhm+JmrFnfhX2hycWxhG3u4FcdwC83FMK/+0mU+vSepnKDdq6qsnh2NZJi5X zfrk5PsIZoQfmj1/jtEyfFis16wwFAben2+CVHDVi1y+WoaJuHidPPBJ14CHd76nh1HE GEil4uPTaOzeVRwM6InzQDPOVZvUVwMzaPBgNDJ7aV1JFU5nJ6uOHzF0sTbrs4bwbeVg +POw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QFObasUtiXPKydGigI97edI1fCaY0o3DK1B8Ycx9MKw=; b=Q4HGX0jpfdXqwUAAbbPnb7fDUwfmf8QFwYsraXPxeYBsC9fwDISroX/4fWMmIfslYY 1b2K3FJduDErjdTccBqDFeshrhXmPwftwR4aLiynlsilvF7Pe3/PON+LHRYh3U8YRo4Y r6S9LQzNqDLDy8niVvJ3Ibq+bNVXnaBhp7nCZv7TSNWepQGbDriJ0CDwmS/lBMWQAUbE x0NH7MCH1nI0gnyWKuiPImgN7vG2NXXao9HzuKHp7VQHKno0kfvcaD0jVVuhtszFckmB 6IJpDrc1UZUbZ7dzrt04vb0MOfBfPDSzhlOXz1i+R7Z+PXU6SO58iZ2bJCAU2ZOEUfCS PzYg== X-Gm-Message-State: AOAM532exgFNgEOL9uprazFz9b2Lbcdbcm8sKGxAstmcz0dBBQfpgVhq es3RHn47k8nb5GipN3FQ5ccFlsHWSXlSWQZpP2GvwjjX7MH6HJIW X-Received: by 2002:aa7:df81:: with SMTP id b1mr21245227edy.365.1604525755605; Wed, 04 Nov 2020 13:35:55 -0800 (PST) MIME-Version: 1.0 References: <20201031200518.4178786-1-harshadshirwadkar@gmail.com> <20201031200518.4178786-7-harshadshirwadkar@gmail.com> <20201103164203.GJ3440@quack2.suse.cz> In-Reply-To: <20201103164203.GJ3440@quack2.suse.cz> From: harshad shirwadkar Date: Wed, 4 Nov 2020 13:35:44 -0800 Message-ID: Subject: Re: [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed To: Jan Kara Cc: Ext4 Developers List , "Theodore Y. Ts'o" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Nov 3, 2020 at 8:42 AM Jan Kara wrote: > > On Sat 31-10-20 13:05:14, Harshad Shirwadkar wrote: > > This patch removes the deduplicates the code that implements waiting > > on inode that's being committed. That code is moved into a new > > function. > > > > Suggested-by: Jan Kara > > Signed-off-by: Harshad Shirwadkar > > Looks good to me. Just one nit below: > > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > > index b1ca55c7d32a..0f2543220d1d 100644 > > --- a/fs/ext4/fast_commit.c > > +++ b/fs/ext4/fast_commit.c > > @@ -155,6 +155,28 @@ void ext4_fc_init_inode(struct inode *inode) > > ei->i_fc_committed_subtid = 0; > > } > > > > +static void ext4_fc_wait_committing_inode(struct inode *inode) > > +{ > > + wait_queue_head_t *wq; > > + struct ext4_inode_info *ei = EXT4_I(inode); > > + > > Maybe add lockdep_assert_held(&EXT4_SB(inode->i_sb)->s_fc_lock) here to > make sure the function is called properly? It's kind of unobvious > requirement (but hard to avoid)... Sounds good. I had to add it after the #ifdef and before the "prepare_to_wait()" call in order to avoid "ISO C90 forbids mixed declarations and code [-Wd eclaration-after-statement]" warning. Thanks, Harshad > > > +#if (BITS_PER_LONG < 64) > > + DEFINE_WAIT_BIT(wait, &ei->i_state_flags, > > + EXT4_STATE_FC_COMMITTING); > > + wq = bit_waitqueue(&ei->i_state_flags, > > + EXT4_STATE_FC_COMMITTING); > > +#else > > + DEFINE_WAIT_BIT(wait, &ei->i_flags, > > + EXT4_STATE_FC_COMMITTING); > > + wq = bit_waitqueue(&ei->i_flags, > > + EXT4_STATE_FC_COMMITTING); > > +#endif > > + prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE); > > + spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock); > > + schedule(); > > + finish_wait(wq, &wait.wq_entry); > > +} > > + > > Honza > -- > Jan Kara > SUSE Labs, CR