Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp667845pxk; Wed, 16 Sep 2020 13:53:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIwE+XUitDbRzb4BwOq1VbrMb2Pjp9/Y7A6u21k99unZl9s7NVcfbX5KuIkqSdV2t0rgOg X-Received: by 2002:a05:6402:17ec:: with SMTP id t12mr28522657edy.328.1600289626055; Wed, 16 Sep 2020 13:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600289626; cv=none; d=google.com; s=arc-20160816; b=lghp7iYTdulG3WmFFor4Vi44QqjZVlem13rt7PcF0yxNVX37nabp07TJyX/nhIArlZ R1sXx/M9QEY3yKHdRsZrwQiHs5NiwlZCzgEmbh3m+YjFdKgm552G3Yhal+hA+PJ5E000 QPFyLJGlq6UPk2i397cRvNqb9CXFM1bjq8ZlMH3Sodm5IWvqficmypRdZGkig+oQKaic rjU35kNNijZn7jFOy06xqt80PIXc8brmAOPh4DC2taDoCMM7/tbQyfzNDvNz618X+J4R rKTdp8HVDX/CWydWF0p2GLGKLBWrUYf/H/k8QtSV4PoRomDdF30f0oZPy4ZYGmvAjzBe lvnA== 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=ego2djEL4YrMFyxHrj18in8anP2XXOeS+zyikD8bfe8=; b=BCb35uM2eiDrnar//ZhZWYmego1OFY8kf7k5w4uxbxGTy3WgUp1HOu9z+3JYRR1w0G 7YHbOR3i+2c4q+PinARdGtTkeqZVmOCVwT0NjEXdtP9Y9rQSeBNJwBAEzIxSQz63LhKS CPVhtfPmsTR8umqltGwdX9d1Sq0vjHKl6gXWnsLiTL6dLxjWZdKlfuAV0xeHOBRPLrpx QrGTir8B7kRpdUIXu7pnuc3N32bXqGJqX5heBLGz5oZKutDWK39/yN84sges3usMjj+J cP/+wtpCuWHo/HWrEWPamuhR2OSzj0kRV8naVQkpWnly3UCRLELdEtYdQzkPjDObyEA2 Qn/g== 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 ba30si13059036edb.44.2020.09.16.13.52.55; Wed, 16 Sep 2020 13:53:46 -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 S1726450AbgIPUwo (ORCPT + 99 others); Wed, 16 Sep 2020 16:52:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:45008 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgIPQyY (ORCPT ); Wed, 16 Sep 2020 12:54:24 -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 CF740B011; Wed, 16 Sep 2020 16:22:55 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 283551E12E1; Wed, 16 Sep 2020 18:22:40 +0200 (CEST) Date: Wed, 16 Sep 2020 18:22:40 +0200 From: Jan Kara To: Mauricio Faria de Oliveira Cc: Jan Kara , linux-ext4@vger.kernel.org, dann frazier , Mauricio Faria de Oliveira Subject: Re: [RFC PATCH v3 2/3] jbd2, ext4, ocfs2: introduce/use journal callbacks j_submit|finish_inode_data_buffers() Message-ID: <20200916162240.GM3607@quack2.suse.cz> References: <20200910193127.276214-1-mfo@canonical.com> <20200910193127.276214-3-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910193127.276214-3-mfo@canonical.com> 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 Thu 10-09-20 16:31:26, Mauricio Faria de Oliveira wrote: > Introduce journal callbacks to allow different behaviors > for an inode in journal_submit|finish_inode_data_buffers(). > > The existing users of the current behavior (ext4, ocfs2) > are adapted to use the previously exported functions > that implement the current behavior. > > Users are callers of jbd2_journal_inode_ranged_write|wait(), > which adds the inode to the transaction's inode list with > the JI_WRITE|WAIT_DATA flags. Only ext4 and ocfs2 in-tree. > > Signed-off-by: Mauricio Faria de Oliveira > Suggested-by: Jan Kara > --- > fs/ext4/super.c | 14 ++++++++++++++ > fs/jbd2/commit.c | 30 ++++++++++++++++++------------ > fs/ocfs2/super.c | 15 +++++++++++++++ > include/linux/jbd2.h | 25 ++++++++++++++++++++++++- > 4 files changed, 71 insertions(+), 13 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index ea425b49b345..7303839d7ad9 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -472,6 +472,16 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) > spin_unlock(&sbi->s_md_lock); > } > > +static int ext4_journal_submit_inode_data_buffers(struct jbd2_inode *jinode) > +{ > + return jbd2_journal_submit_inode_data_buffers(jinode); > +} > + > +static int ext4_journal_finish_inode_data_buffers(struct jbd2_inode *jinode) > +{ > + return jbd2_journal_finish_inode_data_buffers(jinode); > +} > + No need for these ext4 wrappers. They just obfuscate code... Ditto for ocfs2 below. > @@ -1111,6 +1113,27 @@ struct journal_s > void (*j_commit_callback)(journal_t *, > transaction_t *); > > + /** > + * @j_submit_inode_data_buffers: > + * > + * This function is called for all inodes associated with the > + * committing transaction marked with JI_WRITE_DATA flag > + * before we start to write out the transaction to the journal. > + */ > + int (*j_submit_inode_data_buffers) > + (struct jbd2_inode *); > + > + /** > + * @j_finish_inode_data_buffers: > + * > + * This function is called for all inodes associated with the > + * committing transaction marked with JI_WAIT_DATA flag > + * after we have written the transaction to the journal > + * but before we write out the commit block. > + */ > + int (*j_finish_inode_data_buffers) > + (struct jbd2_inode *); > + Having the callbacks in the journal_s will not work if we have inodes with data journalling on a filesystem mounted in data=ordered mode. The callbacks really need to be a per-inode thing so I'd add them to struct jbd2_inode. Honza -- Jan Kara SUSE Labs, CR