Re: [PATCH 3/6] EXT4: Remove ENOMEM/congestion_wait() loops.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 15 Sep 2021, Theodore Ts'o wrote:
> On Tue, Sep 14, 2021 at 10:13:04AM +1000, NeilBrown wrote:
> > 
> > Of particular interest is the ext4_journal_start family of calls which
> > can now have EXT4_EX_NOFAIL 'or'ed in to the 'type'.  This could be seen
> > as a blurring of types.  However 'type' is 8 bits, and EXT4_EX_NOFAIL is
> > a high bit, so it is safe in practice.
> 
> I'm really not fond of this type blurring.  What I'd suggeset doing
> instead is adding a "gfp_t gfp_mask" parameter to the
> __ext4_journal_start_sb().  With the exception of one call site in
> fs/ext4/ialloc.c, most of the callers of __ext4_journal_start_sb() are
> via #define helper macros or inline funcions.  So it would just
> require adding a GFP_NOFS as an extra parameter to the various macros
> and inline functions which call __ext4_journal_start_sb() in
> ext4_jbd2.h.
> 
> The function ext4_journal_start_with_revoke() is called exactly once
> so we could just bury the __GFP_NOFAIL in the definition of that
> macros, e.g.:
> 
> #define ext4_journal_start_with_revoke(inode, type, blocks, revoke_creds) \
> 	__ext4_journal_start((inode), __LINE__, (type), (blocks), 0,	\
> 			     GFP_NOFS | __GFP_NOFAIL, (revoke_creds))
> 
> but it's probably better to do something like this:
> 
> #define ext4_journal_start_with_revoke(gfp_mask, inode, type, blocks, revoke_creds) \
> 	__ext4_journal_start((inode), __LINE__, (type), (blocks), 0,	\
> 			     gfp_mask, (revoke_creds))
> 
> So it's explicit in the C function ext4_ext_remove_space() in
> fs/ext4/extents.c that we are explicitly requesting the __GFP_NOFAIL
> behavior.
> 
> Does that make sense?

Mostly.
Adding gfp_mask to __ext4_journal_start_sb() make perfect sense.
There doesn't seem much point adding one to __ext4_journal_start(),
we can have ext4_journal_start_with_revoke() call
__ext4_journal_start_sb() directly.
But I cannot see what it doesn't already do that.
i.e. why have the inline __ext4_journal_start() at all?
Is it OK if I don't use that for ext4_journal_start_with_revoke()?

Thanks,
NeilBrown





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux