aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-02-24 20:02:51 -0500
committerNeilBrown <neilb@suse.de>2015-04-21 18:00:42 -0400
commita9683a795bcca6d0e7fe4c4c00e071218f3f4428 (patch)
treeb12c4448f266d843745864ab70e1874f38e423dd /drivers/md
parentd06f191f8ecaef4d524e765fdb455f96392fbd42 (diff)
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')
-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)
497 } 497 }
498} 498}
499 499
500static int grow_buffers(struct stripe_head *sh) 500static int grow_buffers(struct stripe_head *sh, gfp_t gfp)
501{ 501{
502 int i; 502 int i;
503 int num = sh->raid_conf->pool_size; 503 int num = sh->raid_conf->pool_size;
@@ -505,7 +505,7 @@ static int grow_buffers(struct stripe_head *sh)
505 for (i = 0; i < num; i++) { 505 for (i = 0; i < num; i++) {
506 struct page *page; 506 struct page *page;
507 507
508 if (!(page = alloc_page(GFP_KERNEL))) { 508 if (!(page = alloc_page(gfp))) {
509 return 1; 509 return 1;
510 } 510 }
511 sh->dev[i].page = page; 511 sh->dev[i].page = page;
@@ -1963,10 +1963,10 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
1963 put_cpu(); 1963 put_cpu();
1964} 1964}
1965 1965
1966static int grow_one_stripe(struct r5conf *conf, int hash) 1966static int grow_one_stripe(struct r5conf *conf, int hash, gfp_t gfp)
1967{ 1967{
1968 struct stripe_head *sh; 1968 struct stripe_head *sh;
1969 sh = kmem_cache_zalloc(conf->slab_cache, GFP_KERNEL); 1969 sh = kmem_cache_zalloc(conf->slab_cache, gfp);
1970 if (!sh) 1970 if (!sh)
1971 return 0; 1971 return 0;
1972 1972
@@ -1974,7 +1974,7 @@ static int grow_one_stripe(struct r5conf *conf, int hash)
1974 1974
1975 spin_lock_init(&sh->stripe_lock); 1975 spin_lock_init(&sh->stripe_lock);
1976 1976
1977 if (grow_buffers(sh)) { 1977 if (grow_buffers(sh, gfp)) {
1978 shrink_buffers(sh); 1978 shrink_buffers(sh);
1979 kmem_cache_free(conf->slab_cache, sh); 1979 kmem_cache_free(conf->slab_cache, sh);
1980 return 0; 1980 return 0;
@@ -2016,7 +2016,7 @@ static int grow_stripes(struct r5conf *conf, int num)
2016 conf->pool_size = devs; 2016 conf->pool_size = devs;
2017 hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS; 2017 hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS;
2018 while (num--) { 2018 while (num--) {
2019 if (!grow_one_stripe(conf, hash)) 2019 if (!grow_one_stripe(conf, hash, GFP_KERNEL))
2020 return 1; 2020 return 1;
2021 conf->max_nr_stripes++; 2021 conf->max_nr_stripes++;
2022 hash = (hash + 1) % NR_STRIPE_HASH_LOCKS; 2022 hash = (hash + 1) % NR_STRIPE_HASH_LOCKS;
@@ -5841,7 +5841,7 @@ raid5_set_cache_size(struct mddev *mddev, int size)
5841 return err; 5841 return err;
5842 hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS; 5842 hash = conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS;
5843 while (size > conf->max_nr_stripes) { 5843 while (size > conf->max_nr_stripes) {
5844 if (grow_one_stripe(conf, hash)) 5844 if (grow_one_stripe(conf, hash, GFP_KERNEL))
5845 conf->max_nr_stripes++; 5845 conf->max_nr_stripes++;
5846 else break; 5846 else break;
5847 hash = (hash + 1) % NR_STRIPE_HASH_LOCKS; 5847 hash = (hash + 1) % NR_STRIPE_HASH_LOCKS;