summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4cf8c8e1b7e3..f02c45e6c192 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -2065,8 +2065,12 @@ __xfs_alloc_buftarg(
xfs_km_flags_t km_flags)
{
struct xfs_buftarg *btp;
+ gfp_t gfp = GFP_KERNEL;
int error;
+ if (km_flags & KM_MAYFAIL)
+ gfp |= __GFP_RETRY_MAYFAIL;
+
btp = kmem_zalloc(sizeof(*btp), KM_NOFS | km_flags);
if (!btp)
return NULL;
@@ -2084,7 +2088,7 @@ __xfs_alloc_buftarg(
if (list_lru_init(&btp->bt_lru))
goto error_free;
- if (percpu_counter_init(&btp->bt_io_count, 0, GFP_KERNEL))
+ if (percpu_counter_init(&btp->bt_io_count, 0, gfp))
goto error_lru;
btp->bt_shrinker.count_objects = xfs_buftarg_shrink_count;