From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEA34C433DF for ; Fri, 9 Oct 2020 02:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79C4F22255 for ; Fri, 9 Oct 2020 02:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729724AbgJICKZ (ORCPT ); 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