Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>,
	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 v3] xfs: introduce task->in_fstrans for transaction reservation recursion protection
Date: Mon, 27 Jul 2020 18:02:42 +0800	[thread overview]
Message-ID: <CALOAHbBVK2qK0y3vtU7VgxaWOGTk1VAV_k9LSgGcXgy85dJDhQ@mail.gmail.com> (raw)
In-Reply-To: <20200726160400.GF23808@casper.infradead.org>

On Mon, Jul 27, 2020 at 12:04 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Sun, Jul 26, 2020 at 10:57:26AM -0400, Yafang Shao wrote:
> > Bellow comment is quoted from Dave,
>
> FYI, you mean "Below", not "Bellow".  Dave doesn't often bellow.

Ah, thanks for pointing that out. I often make that kind of misstake.

>
> > As a result, we should reintroduce PF_FSTRANS. Because PF_FSTRANS is only
> > set by current, we can move it out of task->flags to avoid being out of PF_
> > flags. So a new flag in_fstrans is introduced.
>
> I don't think we need a new flag for this.  I think you can just set
> current->journal_info to a non-NULL value.

Seems like a good suggestion.
I will think about it.

>
> > +++ b/fs/xfs/xfs_linux.h
> > @@ -111,6 +111,20 @@ typedef __u32                    xfs_nlink_t;
> >  #define current_restore_flags_nested(sp, f)  \
> >               (current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
> >
> > +static inline unsigned int xfs_trans_context_start(void)
> > +{
> > +     unsigned int flags = current->in_fstrans;
> > +
> > +     current->in_fstrans = 1;
> > +
> > +     return flags;
> > +}
> > +
> > +static inline void xfs_trans_context_end(unsigned int flags)
> > +{
> > +     current->in_fstrans = flags ? 1 : 0;
> > +}
>
> Does XFS support nested transactions?  If we're just using
> current->journal_info, we can pretend its an unsigned long and use it
> as a counter rather than handle the nesting the same way as the GFP flags.
>


-- 
Thanks
Yafang

      parent reply	other threads:[~2020-07-27 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 14:57 Yafang Shao
2020-07-26 16:04 ` Matthew Wilcox
2020-07-27  2:10   ` Darrick J. Wong
2020-07-27 10:02   ` 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=CALOAHbBVK2qK0y3vtU7VgxaWOGTk1VAV_k9LSgGcXgy85dJDhQ@mail.gmail.com \
    --to=laoar.shao@gmail.com \
    --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 v3] xfs: introduce task->in_fstrans for transaction reservation recursion protection' \
    /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).