]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - lib/rhashtable.c
xfs: add support for passing in write hints for buffered writes
[karo-tx-linux.git] / lib / rhashtable.c
index a930e436db5d8ff6b3e4959ae60761607bcd47cc..d9e7274a04cd98d14456b1bba9ad2e241eae8895 100644 (file)
@@ -86,16 +86,9 @@ static int alloc_bucket_locks(struct rhashtable *ht, struct bucket_table *tbl,
                size = min(size, 1U << tbl->nest);
 
        if (sizeof(spinlock_t) != 0) {
-               tbl->locks = NULL;
-#ifdef CONFIG_NUMA
-               if (size * sizeof(spinlock_t) > PAGE_SIZE &&
-                   gfp == GFP_KERNEL)
-                       tbl->locks = vmalloc(size * sizeof(spinlock_t));
-#endif
-               if (gfp != GFP_KERNEL)
-                       gfp |= __GFP_NOWARN | __GFP_NORETRY;
-
-               if (!tbl->locks)
+               if (gfpflags_allow_blocking(gfp))
+                       tbl->locks = kvmalloc(size * sizeof(spinlock_t), gfp);
+               else
                        tbl->locks = kmalloc_array(size, sizeof(spinlock_t),
                                                   gfp);
                if (!tbl->locks)