Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2542499pxb; Mon, 11 Jan 2021 12:25:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMRJ+OM24bZlCrPZfut4sZrhlKzJgFUkKJZybW5aEFL21tHht0nsGSCaM5IlV5sO+VQZPD X-Received: by 2002:a05:6402:1748:: with SMTP id v8mr846052edx.136.1610396756495; Mon, 11 Jan 2021 12:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610396756; cv=none; d=google.com; s=arc-20160816; b=XEYloDZFEQXWMSgEF0gef0KgBx6zIghb06unlWBAOvBUIJzwytvzIMmzf8VGmzqToL RF3Pgl6lgfwxmYSMfm5cmDI4G2o4z2pncMDpP/U/1+RcwEDiI0IFoumNUN0MLn7EqWIE ifXF4gwkvR7kD3z3ML7lwKVDox6Xa5arxxn1yCu+Q35ClsH14OywAfs3+5HVRKrgWCaI eXn9bDRPe+fjk5jSnuV+dDFsfxEwmCGjCtqI6TcVhqe+C6z/gqJytMhg/IVSokIZ0j3k V4parkDvnT4eCite1FA2meAr9zGy3t0ncQuqprwUzZQ/ovAlaOnJ8QmuHhWyN75U/w5x IeHQ== 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; bh=OGupJZqMipXHR+QD3GXHFTQbgGli0bw/Aana2Vtbh+4=; b=YnnmQ4b1jpw8lQRD+sutE5k7iz4TYBzByRYQPFwwA/LUr/ay0jGXJEGb+4x1GysaTD Nv7Ne1ZR8iO5oQ7xrvp6sQY0O8a5fGIaRWFACTN1Fg3CtWnOsKgmWIwhg3xZgXztWTpx VpRNoGxFAl2vJAR0TZwvcTj82Vj+h0E8nL30NPES/3ttttnMOGMSu0EPdINkCRdLx/VF PSjG3nCeAGTUo8y6NZhB+BmKQBn7R3NNd1aBTSBXap9YkTVaUFkzv9QM83kaOoto95mG udvEK2YBo8cZIkXSwM/q+IBgFrlrsghZj3J6ia8wYWeg8xdwotVLRp99qH9ri5xepG7p u17A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h9UJs0tr; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si163137ejx.41.2021.01.11.12.25.31; Mon, 11 Jan 2021 12:25:56 -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=@kernel.org header.s=k20201202 header.b=h9UJs0tr; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388625AbhAKUYY (ORCPT + 99 others); Mon, 11 Jan 2021 15:24:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:33318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404215AbhAKUYW (ORCPT ); Mon, 11 Jan 2021 15:24:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADBE1225AC; Mon, 11 Jan 2021 20:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610396621; bh=GuikJIMMynj1JoVdFBbBDyTl6eY4ObOVr2EhJzbluqU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h9UJs0tr0HoLvfoM0v704ZMwvpGKTk+NgiLZEjtFVRGKupALugn+LTjpCVAzgGoDt fnvgqZCF48gZoGU8LQOWMLdCBR5SUO9onTJHG74h3wmPwtP+ZqD8Uc1bVk8LPSBTxa yUdoD94NOU5fUPYrHZIa26l1w+y22BfW7zuWvitBcnnpKeJZ5tWmMijqpzTW2T8RBB v9/ZLCNXfoJCPVqOY000S6pHMovE+IDHJouQmhR6KR2ZjYAtHmgJcISwR8/kY3ESw+ cTvhL/H7nkTKjLz0FryNvH1qL4khOQKIgNyGy1b/Ygf2RyfL1stItYLsoFgFUCLJgg u5yjhlG30NShA== Date: Mon, 11 Jan 2021 12:23:40 -0800 From: Eric Biggers To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Theodore Ts'o Subject: Re: [PATCH v2 11/12] ext4: simplify i_state checks in __ext4_update_other_inode_time() Message-ID: References: <20210109075903.208222-1-ebiggers@kernel.org> <20210109075903.208222-12-ebiggers@kernel.org> <20210111105342.GE2502@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210111105342.GE2502@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Jan 11, 2021 at 11:53:42AM +0100, Christoph Hellwig wrote: > On Fri, Jan 08, 2021 at 11:59:02PM -0800, Eric Biggers wrote: > > if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > - I_DIRTY_INODE)) || > > - ((inode->i_state & I_DIRTY_TIME) == 0)) > > + I_DIRTY_TIME)) != I_DIRTY_TIME) > > return; > > > > spin_lock(&inode->i_lock); > > - if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > - I_DIRTY_INODE)) == 0) && > > - (inode->i_state & I_DIRTY_TIME)) { > > + if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > + I_DIRTY_TIME)) == I_DIRTY_TIME) { > > I think a descriptively named inline helper in fs.h would really improve > this.. Do you want this even though it is specific to how ext4 opportunisticly updates other inodes in the same inode block as the inode being updated? That's the only reason that I_FREEING|I_WILL_FREE|I_NEW need to be checked; everywhere else justs want I_DIRTY_TIME. We could add: static inline bool other_inode_has_dirtytime(struct inode *inode) { return (inode->state & (I_FREEING | I_WILL_FREE | I_NEW | I_DIRTY_TIME)) == I_DIRTY_TIME; } But it seems a bit weird when it's specific to ext4 at the moment. Are you thinking that other filesystems will implement the same sort of opportunistic update, so we should add the helper now? - Eric