Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1252984pxb; Thu, 7 Oct 2021 04:12:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKfIRZDMuN6l3slO337fpDMsmhTU6/t86fG2oC63ma7ZxsAC7zwMqzN/n2aso62U8xKanj X-Received: by 2002:a05:6a00:2449:b0:44c:2221:8c38 with SMTP id d9-20020a056a00244900b0044c22218c38mr3725154pfj.74.1633605136369; Thu, 07 Oct 2021 04:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633605136; cv=none; d=google.com; s=arc-20160816; b=a+F61RY8EB8XEvG+AG5VcmxiDgp8LOvG7yafBKOgLdbqPb8kfVDgtHJKfrE6yscGm3 gYp2UX0f6vJBmX5o2lqPlJ2wzoUviUn96b/d4UCpRqZMfzJpWT6FbG3R+O37MGNHty8v E+++nfhp2q9qUi4Wx/6R97wrayMcPuyYz0ql/itAPgoVbV5l86NeBwf5M+11lH2yWwbp BiUP9QU3c5eox4Wog27A+UF6fmkOzEk8pd/Nl3Z220DldScXPKXQqoxOqu30bbMKJlLJ rOF6h4gckNmWgRzGXybNEjPRfgiTpEq2neGctsOQexyXQiux2L5IfYLNRh9h1tUeByL8 ZChw== 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=HzsMoRJsH8Sqc/5QUEzazNk9LwUNPwGYQgI6XlOhwdM=; b=wcQW9JN51czojGabG2/GOqdI2fBrb7OpUFaD8s/nJqVmRD+0c62Pk77bvpSVFh6CQ+ ksAeqd/9bDGnaotTARuyY+C1NWIMai24Qphz+SPg73IsvM66etqotK/8dF/byEVy1GDV apPTL5447qH73xri9iFXMkDlmu2pwIM/KbvaiIP0Vn93auIvyN0bSBgeoxC6GlR066c/ X9G16B5DfaFFlt5z0dLsgz7xZRtuwyk39YOnqNMG2mHq4giUB7jZfG4gWxFVsil/sDtB cxyCHPYNH+yHUMnBu/DjCamQOT2RAatiS9lBvQ4QcRWpGseX7RHzg6VBtNwXQnblavFi Clzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=jjMWBQ2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 bj10si28529854plb.6.2021.10.07.04.12.01; Thu, 07 Oct 2021 04:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=jjMWBQ2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232781AbhJGLLw (ORCPT + 99 others); Thu, 7 Oct 2021 07:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbhJGLLv (ORCPT ); Thu, 7 Oct 2021 07:11:51 -0400 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EDEBC061746 for ; Thu, 7 Oct 2021 04:09:58 -0700 (PDT) Received: by mail-vs1-xe36.google.com with SMTP id 188so6414187vsv.0 for ; Thu, 07 Oct 2021 04:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HzsMoRJsH8Sqc/5QUEzazNk9LwUNPwGYQgI6XlOhwdM=; b=jjMWBQ2b9mG7NVaxJoDtibQ3OU6rQZ2zpfbaqAgq2HL5qORXLUX1Vi07dspO0J6aAE ICBr2srIBsmVhXWLi/2xcHtw0vRKfJqJudBZZkWofSZIHP70MUigU+lFODf0f10lqDtK UBD1UJGTDLuVUHTwzgYl9626fOtXaPkl82ihM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HzsMoRJsH8Sqc/5QUEzazNk9LwUNPwGYQgI6XlOhwdM=; b=3Zx5RAQs6r5OjU31a6zJMoHEPUbPd+D/T1+xdH5yFrHdQ50+490vTqKL5T2DIthN0v 96ctPdPr808NkSsmcRl5UONANoIdgw7VwAm0gI5cSM0YZbCAEs3l8iQozrgmiDecGyKJ qoHuZUf7laftdnnshcPepCBtWdPl0xz9CHWHg1kAO9ypezGzEp3lhCCp1A5ZYU9jMSJz 1akTvBB5OCPObBqTA+eEOxwPjo8T1gPfL7iv8oNHP52gcPEe7MVi5OEAWLFg0/W6p1Co fQsaOpEJ0fOut6O9ufas4O2uSZbVxHYnmJoL8/xRunpnh0vy0GiLWiEYG51zDsmWKpP3 OPXg== X-Gm-Message-State: AOAM53268RErLtm4C9g3zntWSeD8KMj65PhvTDRkzIzv8KlToxhRQcNK uBvXzeeV2nzcJAD75YBo2TcNz48yksOgQUjCVvUK7w== X-Received: by 2002:a05:6102:3c3:: with SMTP id n3mr3179780vsq.19.1633604997574; Thu, 07 Oct 2021 04:09:57 -0700 (PDT) MIME-Version: 1.0 References: <20210923130814.140814-1-cgxu519@mykernel.net> <20210923130814.140814-8-cgxu519@mykernel.net> In-Reply-To: <20210923130814.140814-8-cgxu519@mykernel.net> From: Miklos Szeredi Date: Thu, 7 Oct 2021 13:09:46 +0200 Message-ID: Subject: Re: [RFC PATCH v5 07/10] ovl: cache dirty overlayfs' inode To: Chengguang Xu Cc: Jan Kara , Amir Goldstein , linux-fsdevel@vger.kernel.org, overlayfs , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sept 2021 at 15:08, Chengguang Xu wrote: > > Now drop overlayfs' inode will sync dirty data, > so we change to only drop clean inode. > > The purpose of doing this is to keep compatible > behavior with before because without this change > dropping overlayfs inode will not trigger syncing > of underlying dirty inode. > > Signed-off-by: Chengguang Xu > --- > fs/overlayfs/super.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > index cddae3ca2fa5..bf4000eb9be8 100644 > --- a/fs/overlayfs/super.c > +++ b/fs/overlayfs/super.c > @@ -441,11 +441,25 @@ static int ovl_write_inode(struct inode *inode, > return ret; > } > > +/* > + * In iput_final(), clean inode will drop directly and dirty inode will > + * keep in the cache until write back to sync dirty data then add to lru > + * list to wait reclaim. > + */ > +static int ovl_drop_inode(struct inode *inode) > +{ > + struct inode *upper = ovl_inode_upper(inode); > + > + if (!upper || !(inode->i_state & I_DIRTY_ALL)) Could we check upper dirtyness here? That would give a more precise result. Alternatively don't set .drop_inode (i.e. use generic_drop_inode()) and set I_DONTCACHE on overlay inodes. That would cause the upper inode to be always written back before eviction. The latter would result in simpler logic, and I think performance-wise it wouldn't matter. But I may be missing something. Thanks, Miklos