summaryrefslogtreecommitdiff
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-02-25 12:02:51 +1100
committerNeilBrown <neilb@suse.de>2015-04-22 08:00:42 +1000
commita9683a795bcca6d0e7fe4c4c00e071218f3f4428 (patch)
treeb12c4448f266d843745864ab70e1874f38e423dd /drivers/md/raid5.c
parentd06f191f8ecaef4d524e765fdb455f96392fbd42 (diff)
downloadlwn-a9683a795bcca6d0e7fe4c4c00e071218f3f4428.tar.gz
lwn-a9683a795bcca6d0e7fe4c4c00e071218f3f4428.zip
md/raid5: pass gfp_t arg to grow_one_stripe()
This is needed for future improvement to stripe cache management. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index f78b1964543b..ed8e34153c3d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -497,7 +497,7 @@ static void shrink_buffers(struct stripe_head *sh)
}
}
-static int grow_buffers(struct stripe_head *sh)
+static int grow_buffers(struct stripe_head *sh, gfp_t gfp)
{
int i;
int num = sh->raid_conf->pool_size;
@@ -505,7 +505,7 @@ static int grow_buffers(struct stripe_head *sh)
for (i = 0; i < num; i++) {
struct page *page;
- if (!(page = alloc_page(GFP_KERNEL))) {
+ if (!(page = alloc_page(gfp))) {
return 1;
}
sh->dev[i].page = page;
@@ -1963,10 +1963,10 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
put_cpu();
}
-static int grow_one_stripe(struct r5conf *conf, int hash)
+static int grow_one_stripe(struct r5conf *conf, int hash, gfp_t gfp)
{
struct stripe_head *sh;
- sh = kmem_cache_zalloc(conf->slab_cache, GFP_KERNEL);
+ sh = kmem_cache_zalloc(conf->slab_cache, gfp);
if (!sh)
return 0;
@@ -1974,7 +1974,7 @@ static int grow_one_stripe(struct r5conf *conf, int hash)
spin_lock_init(&sh->stripe_lock);
- if (grow_buffers(sh)) {
+ if (grow_buffers(sh, gfp)) {
shrink_buffers(sh);
kmem_cache_free(conf->slab_cache, sh);
return 0;
@@ -2016,7 +2016,7 @@ static int grow_stripes(struct r5conf *conf, int num)
conf->pool_size = devs;
hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS;
while (num--) {
- if (!grow_one_stripe(conf, hash))
+ if (!grow_one_stripe(conf, hash, GFP_KERNEL))
return 1;
conf->max_nr_stripes++;
hash = (hash + 1) % NR_STRIPE_HASH_LOCKS;
@@ -5841,7 +5841,7 @@ raid5_set_cache_size(struct mddev *mddev, int size)
return err;
hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS;
while (size > conf->max_nr_stripes) {
- if (grow_one_stripe(conf, hash))
+ if (grow_one_stripe(conf, hash, GFP_KERNEL))
conf->max_nr_stripes++;
else break;
hash = (hash + 1) % NR_STRIPE_HASH_LOCKS;