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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 51DA5C433E3 for ; Tue, 25 Aug 2020 05:32:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 22475204FD for ; Tue, 25 Aug 2020 05:32:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22475204FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fromorbit.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 804C36B009F; Tue, 25 Aug 2020 01:32:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78B746B00A0; Tue, 25 Aug 2020 01:32:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 653408E000D; Tue, 25 Aug 2020 01:32:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 4C2E66B009F for ; Tue, 25 Aug 2020 01:32:38 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 10933362C for ; Tue, 25 Aug 2020 05:32:38 +0000 (UTC) X-FDA: 77187971196.04.soup23_0706bd727059 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id D89338007FE2 for ; Tue, 25 Aug 2020 05:32:37 +0000 (UTC) X-HE-Tag: soup23_0706bd727059 X-Filterd-Recvd-Size: 3584 Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Aug 2020 05:32:37 +0000 (UTC) Received: from dread.disaster.area (pa49-181-146-199.pa.nsw.optusnet.com.au [49.181.146.199]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id E86936ACCBE; Tue, 25 Aug 2020 15:32:34 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1kARZR-0006XV-WF; Tue, 25 Aug 2020 15:32:34 +1000 Date: Tue, 25 Aug 2020 15:32:33 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Andrew Morton , Yafang Shao , hch@infradead.org, darrick.wong@oracle.com, mhocko@kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v6 2/2] xfs: avoid transaction reservation recursion Message-ID: <20200825053233.GN12131@dread.disaster.area> References: <20200824014234.7109-1-laoar.shao@gmail.com> <20200824014234.7109-3-laoar.shao@gmail.com> <20200824130925.a3d2d2b75ac3a6b4eba72fb9@linux-foundation.org> <20200824205647.GG17456@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200824205647.GG17456@casper.infradead.org> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=QKgWuTDL c=1 sm=1 tr=0 cx=a_idp_d a=GorAHYkI+xOargNMzM6qxQ==:117 a=GorAHYkI+xOargNMzM6qxQ==:17 a=kj9zAlcOel0A:10 a=y4yBn9ojGxQA:10 a=pGLkceISAAAA:8 a=7-415B0cAAAA:8 a=Px2cqOF_wlCDMe8bkFsA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 X-Rspamd-Queue-Id: D89338007FE2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 24, 2020 at 09:56:47PM +0100, Matthew Wilcox wrote: > On Mon, Aug 24, 2020 at 01:09:25PM -0700, Andrew Morton wrote: > > On Mon, 24 Aug 2020 09:42:34 +0800 Yafang Shao wrote: > > > > > --- a/include/linux/iomap.h > > > +++ b/include/linux/iomap.h > > > @@ -271,4 +271,11 @@ int iomap_swapfile_activate(struct swap_info_struct *sis, > > > # define iomap_swapfile_activate(sis, swapfile, pagespan, ops) (-EIO) > > > #endif /* CONFIG_SWAP */ > > > > > > +/* Use the journal_info to indicate current is in a transaction */ > > > +static inline bool > > > +fstrans_context_active(void) > > > +{ > > > + return current->journal_info != NULL; > > > +} > > > > Why choose iomap.h for this? > > Because it gets used in iomap/buffered-io.c > > I don't think this is necessarily a useful abstraction, to be honest. > I'd just open-code 'if (current->journal_info)' or !current->journal_info, > whichever way round the code is: > > fs/btrfs/delalloc-space.c: if (current->journal_info) > fs/ceph/xattr.c: if (current->journal_info) { > fs/gfs2/bmap.c: if (current->journal_info) { > fs/jbd2/transaction.c: if (WARN_ON(current->journal_info)) { > fs/reiserfs/super.c: if (!current->journal_info) { /me wonders idly if any of the other filesystems that use current->journal_info can have an active transaction while calling ->writepages... .... and if so, whether this patchset has taken the wrong path in trying to use current->journal_info for XFS to re-implement this warning..... .... so we'll have to remove or rework this yet again when other filesystems are converted to use iomap.... /me suspects the btrfs_write_and_wait_transaction() is a path where this can actually happen... -Dave. -- Dave Chinner david@fromorbit.com