Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Turn on both PF_FSTRANS and PF_MEMALLOC_NOIO in spl_fstrans_mark
Browse files Browse the repository at this point in the history
In b4ad50a, we abandoned memalloc_noio_save in favor of spl_fstrans_mark
because earlier kernel with it doesn't turn off __GFP_FS. However, for newer
kernel, we would prefer PF_MEMALLOC_NOIO because it would work for allocation
in kernel which we cannot control otherwise. So in this patch, we turn on both
PF_FSTRANS and PF_MEMALLOC_NOIO in spl_fstrans_mark.

Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #523
  • Loading branch information
Chunwei Chen authored and behlendorf committed Jan 29, 2016
1 parent 89a2234 commit 5662ded
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions include/sys/kmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@ typedef struct {
unsigned int saved_flags;
} fstrans_cookie_t;

#ifdef PF_MEMALLOC_NOIO
#define SPL_FSTRANS (PF_FSTRANS|PF_MEMALLOC_NOIO)
#else
#define SPL_FSTRANS (PF_FSTRANS)
#endif

static inline fstrans_cookie_t
spl_fstrans_mark(void)
{
fstrans_cookie_t cookie;

cookie.fstrans_thread = current;
cookie.saved_flags = current->flags & PF_FSTRANS;
current->flags |= PF_FSTRANS;
cookie.saved_flags = current->flags & SPL_FSTRANS;
current->flags |= SPL_FSTRANS;

return (cookie);
}
Expand All @@ -94,9 +100,9 @@ static inline void
spl_fstrans_unmark(fstrans_cookie_t cookie)
{
ASSERT3P(cookie.fstrans_thread, ==, current);
ASSERT(current->flags & PF_FSTRANS);
ASSERT((current->flags & SPL_FSTRANS) == SPL_FSTRANS);

current->flags &= ~(PF_FSTRANS);
current->flags &= ~SPL_FSTRANS;
current->flags |= cookie.saved_flags;
}

Expand Down

0 comments on commit 5662ded

Please sign in to comment.