#ifndef _SPL_KMEM_H
#define _SPL_KMEM_H
+#include <sys/debug.h>
#include <linux/slab.h>
#include <linux/sched.h>
return (lflags);
}
+typedef struct {
+ struct task_struct *fstrans_thread;
+ unsigned int saved_flags;
+} fstrans_cookie_t;
+
+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;
+
+ return (cookie);
+}
+
+static inline void
+spl_fstrans_unmark(fstrans_cookie_t cookie)
+{
+ ASSERT3P(cookie.fstrans_thread, ==, current);
+ ASSERT(current->flags & PF_FSTRANS);
+
+ current->flags &= ~(PF_FSTRANS);
+ current->flags |= cookie.saved_flags;
+}
+
+static inline int
+spl_fstrans_check(void)
+{
+ return (current->flags & PF_FSTRANS);
+}
+
#ifdef HAVE_ATOMIC64_T
#define kmem_alloc_used_add(size) atomic64_add(size, &kmem_alloc_used)
#define kmem_alloc_used_sub(size) atomic64_sub(size, &kmem_alloc_used)