Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp367175pxa; Wed, 19 Aug 2020 03:43:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ3/nDLJ8nUcR0PcYYxWItBw3gw0WLzpxmVp0bnBgbkv/WC+Rjbyq+gfoLAIXPcwkZcLZG X-Received: by 2002:a17:906:38c7:: with SMTP id r7mr25449897ejd.118.1597833805103; Wed, 19 Aug 2020 03:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597833805; cv=none; d=google.com; s=arc-20160816; b=OIbJJyCs6LvOT04TL96BPMJ7Y5zv+Zo8e0/tVsC8Aqz6l0WA9yj3NExepIyhcCmFPH L3G1FYbKY98xT1Z8g7wKZ/QJU3Yk4vI7g9bEg0ZiSVQF8BSey2dVdyFt3nQL3Ulm3ujw rbeYIbfHl9sTE6k6Zl5ZlY2tqfwvZQnocTbDuLlEtbOYOLvaHW4/J8393j3CPZUQ6GYn 7tsHGdvNRB97XrRV/22g3EMSZz3ere5HjmFA9oLAc6JqjhOSOQqRJRJLLimF8igX+J4z AkUnJeP/RcwtuwLqdIiUqalhXw9lcWTnUIh60hrT9HLdlM1LGyXc80bfB0lTF2qRbSi2 ZSLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cKnSjynuYqjjY50OAhGkLJC/LrZZgZ15/kmxGYfY2e8=; b=OmgjVzWGv8v+zJ3n92mOW/jP0GlBjaC5JPuljzuwx46aVK0GYxaKLzxJCRfDdFY81C w1yrbwNxhI0W87fVt0fwYoVOKLYcAs7fvhwN24+p5GiV8xCGuCxa3V3jr3/TeDGeAfcX 7nNGV6fC1Ic4qWTVTpENFdc+dBrYtbzYn2TCA2LqgF7q+0lw42HxyyvbYzwbHjs2cxOW U3dhxEQzvp5wei+YHVTYqPrQm5TJtcv3NkvYSD1Wd/4f2Q6V5rvDeViGx2iPKOozK2cl x98Twq2OpujHfo0WZXnKVWcVyQ4/EvX2WCe9aAG5KyheFHSUHr2UtH2zejEYbWPO/fJj Qs3A== ARC-Authentication-Results: i=1; mx.google.com; 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 96si16076541edq.96.2020.08.19.03.42.51; Wed, 19 Aug 2020 03:43:25 -0700 (PDT) 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; 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 S1727116AbgHSKmA (ORCPT + 99 others); Wed, 19 Aug 2020 06:42:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:56726 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbgHSKlm (ORCPT ); Wed, 19 Aug 2020 06:41:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B198CAC98; Wed, 19 Aug 2020 10:42:05 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 2A2AA1E1312; Wed, 19 Aug 2020 12:41:39 +0200 (CEST) Date: Wed, 19 Aug 2020 12:41:39 +0200 From: Jan Kara To: Mauricio Faria de Oliveira Cc: Jan Kara , linux-ext4@vger.kernel.org, dann frazier , Mauricio Faria de Oliveira , Jan Kara Subject: Re: [RFC PATCH v2 3/5] ext4: data=journal: write-protect pages on submit inode data buffers callback Message-ID: <20200819104139.GJ1902@quack2.suse.cz> References: <20200810010210.3305322-1-mfo@canonical.com> <20200810010210.3305322-4-mfo@canonical.com> <20200819084421.GD1902@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819084421.GD1902@quack2.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 19-08-20 10:44:21, Jan Kara wrote: > I was thinking about this and we may need to do this somewhat differently. > I've realized that there's the slight trouble that we now use page dirty > bit for two purposes in data=journal mode - to track pages that need write > protection during commit and also to track pages which have buffers that > need checkpointing. And this mixing is making things complex. So I was > thinking that we could simply leave PageDirty bit for checkpointing > purposes and always make sure buffers are appropriately attached to a > transaction as dirty in ext4_page_mkwrite(). This will make mmap writes in > data=journal mode somewhat less efficient (all the pages written through > mmap while transaction T was running will be written to the journal during > transaction T commit while currently, we write only pages that also went > through __ext4_journalled_writepage() while T was running which usually > happens less frequently). But the code should be simpler and we don't care > about mmap write performance for data=journal mode much. Furthermore I > don't think that the tricks with PageChecked logic we play in data=journal > mode are really needed as well which should bring further simplifications. > I'll try to code this cleanup. I was looking more into this but it isn't as simple as I thought because get_user_pages() users can still modify data and call set_page_dirty() when the page is no longer writeably mapped. And by the time set_page_dirty() is called page buffers are not necessarily part of any transaction so we need to do effectively what's in ext4_journalled_writepage(). To handle this corner case I didn't find anything considerably simpler than the current code. So let's stay with what we have in ext4_journalled_submit_inode_data_buffers(), we just have to also redirty the page if we find any dirty buffers. Honza -- Jan Kara SUSE Labs, CR