Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1737186pxu; Thu, 8 Oct 2020 20:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGyNcsBHZgPVulW3wFK6Tej6VX2Oz5DyUV9HzxsURpQPL88frifqSPe77Wb53J5umkaCSf X-Received: by 2002:a17:906:8293:: with SMTP id h19mr11637817ejx.130.1602215899477; Thu, 08 Oct 2020 20:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602215899; cv=none; d=google.com; s=arc-20160816; b=j4ZzMJUW2tXgXxMKpS6NcyjR7jVzCsOMtt1fRxM6ZV2vQxti77FLspSwXp0chu9WJs ZWno7AycTojvuc05lo0NFmFSghOJPMFKN97L3Slk9AjfikvU7r75B0qX7ePIln4iK6n0 eZgmpJgo/Ck6fK5Sh1XMKGDeyXjpFK0uRzukFJdcNky8WYH/BmYeSxMYQNM6eo5lFVBr kq8Qunk3FFUXyT5SAqkh9+rxjlk7a726RS8Ox2+tl1jTGqEhXejUTsme4DMtPQwR7SK4 uDjUO4cQgxyIJ9rNXcsWPaN0g9lq0rsD+lTqZzNXrNvXlOxJZO8n5YlfKTxcGVDomQbf jyBw== 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; bh=WnYN2iMDHPSC0hF9MguzQzl49QIJdp+l2EdH37PujS0=; b=JOtZWF2UabcbWioU0ITaxUfknDi4BOVWi5W6Eg/5xmnGtHzbVGESE1Q5fIDZSnOZlJ DB4uzb2opidpdhBaSDfsPd+ENFkvwdQxPWYtczLVnhmZgXWzIJgIPCOgUuBzz/4A76rc 0szMfoZLNC9bEsI0HDc+Ow/IRnvVFtRHm4qJeEiBcuQYAoMxbEahIl52taFgjoWHyCwC T5KdeJtmndnEjJ9IDpB6S/AgECGQma51vkqYKqXmjPeJWuKguMGQQrTxXTE4uRBxxsou CPhXe56tMHrgOdarO11SEMSSAYkvKqG620lItoRB10TyzFgkF15YP7WjgOz/rgN/DTtL 1a6g== 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 k7si5080497ejj.732.2020.10.08.20.57.56; Thu, 08 Oct 2020 20:58:19 -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 S1727781AbgJICKZ (ORCPT + 99 others); Thu, 8 Oct 2020 22:10:25 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:45204 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726567AbgJICKZ (ORCPT ); Thu, 8 Oct 2020 22:10:25 -0400 Received: from callcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 0992ABgG003427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Oct 2020 22:10:12 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 8F0EA420107; Thu, 8 Oct 2020 22:10:11 -0400 (EDT) Date: Thu, 8 Oct 2020 22:10:11 -0400 From: "Theodore Y. Ts'o" To: Mauricio Faria de Oliveira Cc: linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com, Jan Kara , Andreas Dilger , dann frazier , Joseph Qi Subject: Re: [PATCH v5 3/4] ext4: data=journal: fixes for ext4_page_mkwrite() Message-ID: <20201009021011.GG235506@mit.edu> References: <20201006004841.600488-1-mfo@canonical.com> <20201006004841.600488-4-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201006004841.600488-4-mfo@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Oct 05, 2020 at 09:48:40PM -0300, Mauricio Faria de Oliveira wrote: > These are two fixes for data journalling required by > the next patch, discovered while testing it. > > First, the optimization to return early if all buffers > are mapped is not appropriate for the next patch: > > The inode _must_ be added to the transaction's list in > data=journal mode (so to write-protect pages on commit) > thus we cannot return early there. > > Second, once that optimization to reduce transactions > was disabled for data=journal mode, more transactions > happened, and occasionally hit this warning message: > 'JBD2: Spotted dirty metadata buffer'. > > Reason is, block_page_mkwrite() will set_buffer_dirty() > before do_journal_get_write_access() that is there to > prevent it. This issue was masked by the optimization. > > So, on data=journal use __block_write_begin() instead. > This also requires page locking and len recalculation. > (see block_page_mkwrite() for implementation details.) > > Finally, as Jan noted there is little sharing between > data=journal and other modes in ext4_page_mkwrite(). > > However, a prototype of ext4_journalled_page_mkwrite() > showed there still would be lots of duplicated lines > (tens of) that didn't seem worth it. > > Thus this patch ends up with an ugly goto to skip all > non-data journalling code (to avoid long indentations, > but that can be changed..) in the beginning, and just > a conditional in the transaction section. > > Well, we skip a common part to data journalling which > is the page truncated check, but we do it again after > ext4_journal_start() when we re-acquire the page lock > (so not to acquire the page lock twice needlessly for > data journalling.) > > Signed-off-by: Mauricio Faria de Oliveira > Suggested-by: Jan Kara > Reviewed-by: Jan Kara > Reviewed-by: Andreas Dilger Thanks, applied. - Ted