On Sun, Jul 26, 2020 at 05:04:00PM +0100, Matthew Wilcox 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. > > > 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. Not currently. --D