From: Matthew Wilcox <willy@infradead.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: david@fromorbit.com, 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 v3] xfs: introduce task->in_fstrans for transaction reservation recursion protection
Date: Sun, 26 Jul 2020 17:04:00 +0100 [thread overview]
Message-ID: <20200726160400.GF23808@casper.infradead.org> (raw)
In-Reply-To: <20200726145726.1484-1-laoar.shao@gmail.com>
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.
> 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.
> +++ 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.
next prev parent reply other threads:[~2020-07-26 16:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-26 14:57 [PATCH v3] xfs: introduce task->in_fstrans for transaction reservation recursion protection Yafang Shao
2020-07-26 16:04 ` Matthew Wilcox [this message]
2020-07-27 2:10 ` Darrick J. Wong
2020-07-27 10:02 ` Yafang Shao
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=20200726160400.GF23808@casper.infradead.org \
--to=willy@infradead.org \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=laoar.shao@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mhocko@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).