Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Michal Hocko <mhocko@kernel.org>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v6 2/2] xfs: avoid transaction reservation recursion
Date: Wed, 26 Aug 2020 12:30:45 +0800	[thread overview]
Message-ID: <CALOAHbA1h1nmJrkFzb3FdyF3JL9Tws6=73vJ=v-ajzWoHsp7vQ@mail.gmail.com> (raw)
In-Reply-To: <20200825224721.GU12131@dread.disaster.area>

On Wed, Aug 26, 2020 at 6:47 AM Dave Chinner <david@fromorbit.com> wrote:
>
> On Tue, Aug 25, 2020 at 02:22:08PM +0800, Yafang Shao wrote:
> > On Tue, Aug 25, 2020 at 1:32 PM Dave Chinner <david@fromorbit.com> wrote:
> > >
> > > 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 <laoar.shao@gmail.com> 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...
> > >
> >
> > How about adding a flag in struct writeback_control ?
> > struct writeback_control {
> >     ...
> >     unsigned fstrans_check:1; /* Whether to check the current is in fstrans */
> > };
> >
> > Then we can set it in xfs_vm_writepage(s), for example,
> >
> > xfs_vm_writepage
> > {
> >     wbc->fstrans_check = 1;  // set it for XFS only.
> >     return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops);
> > }
>
> Yeah, but if we are doing that then I think we should just remove
> the check completely from iomap_writepage() and move it up into
> xfs_vm_writepage() and xfs_vm_writepages().
>

Sure.

-- 
Thanks
Yafang

      reply	other threads:[~2020-08-26  4:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  1:42 [PATCH v6 0/2] avoid xfs " Yafang Shao
2020-08-24  1:42 ` [PATCH v6 1/2] mm: Add become_kswapd and restore_kswapd Yafang Shao
2020-08-24  1:42 ` [PATCH v6 2/2] xfs: avoid transaction reservation recursion Yafang Shao
2020-08-24 20:09   ` Andrew Morton
2020-08-24 20:56     ` Matthew Wilcox
2020-08-25  1:39       ` Yafang Shao
2020-08-25  5:32       ` Dave Chinner
2020-08-25  6:22         ` Yafang Shao
2020-08-25 22:47           ` Dave Chinner
2020-08-26  4:30             ` Yafang Shao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALOAHbA1h1nmJrkFzb3FdyF3JL9Tws6=73vJ=v-ajzWoHsp7vQ@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=willy@infradead.org \
    --subject='Re: [PATCH v6 2/2] xfs: avoid transaction reservation recursion' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).