aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2016-01-18 14:41:45 -0800
committerBrian Behlendorf <[email protected]>2016-01-20 11:38:31 -0800
commitd348f23a6a9b3017524b66c9f7c9d32ec283e178 (patch)
tree91f34681cae82c00f73213d8b6f5b90c506a506f /include
parente843553d0341c4edd880f5ad40da8211669348bd (diff)
Turn on both PF_FSTRANS and PF_MEMALLOC_NOIO in spl_fstrans_mark
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
Diffstat (limited to 'include')
-rw-r--r--include/sys/kmem.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/sys/kmem.h b/include/sys/kmem.h
index 8d5e72937..d4b3bf680 100644
--- a/include/sys/kmem.h
+++ b/include/sys/kmem.h
@@ -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);
}
@@ -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;
}