Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200571
b: refs/heads/master
c: e4e11e3
h: refs/heads/master
i:
  200569: 1d88c09
  200567: 8674761
v: v3
  • Loading branch information
NeilBrown committed Jun 24, 2010
1 parent b219911 commit de1c997
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 049d6c1ef983c9ac43aa423dfd752071a5b0002d
refs/heads/master: e4e11e385d1e5516ac76c956d6c25e6c2fa1b8d0
19 changes: 10 additions & 9 deletions trunk/drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,13 @@ static struct stripe_head *get_free_stripe(raid5_conf_t *conf)
return sh;
}

static void shrink_buffers(struct stripe_head *sh, int num)
static void shrink_buffers(struct stripe_head *sh)
{
struct page *p;
int i;
int num = sh->raid_conf->pool_size;

for (i=0; i<num ; i++) {
for (i = 0; i < num ; i++) {
p = sh->dev[i].page;
if (!p)
continue;
Expand All @@ -291,11 +292,12 @@ static void shrink_buffers(struct stripe_head *sh, int num)
}
}

static int grow_buffers(struct stripe_head *sh, int num)
static int grow_buffers(struct stripe_head *sh)
{
int i;
int num = sh->raid_conf->pool_size;

for (i=0; i<num; i++) {
for (i = 0; i < num; i++) {
struct page *page;

if (!(page = alloc_page(GFP_KERNEL))) {
Expand Down Expand Up @@ -1240,19 +1242,18 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
static int grow_one_stripe(raid5_conf_t *conf)
{
struct stripe_head *sh;
int disks = max(conf->raid_disks, conf->previous_raid_disks);
sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL);
if (!sh)
return 0;
memset(sh, 0, sizeof(*sh) + (disks-1)*sizeof(struct r5dev));
memset(sh, 0, sizeof(*sh) + (conf->pool_size-1)*sizeof(struct r5dev));
sh->raid_conf = conf;
spin_lock_init(&sh->lock);
#ifdef CONFIG_MULTICORE_RAID456
init_waitqueue_head(&sh->ops.wait_for_ops);
#endif

if (grow_buffers(sh, disks)) {
shrink_buffers(sh, disks);
if (grow_buffers(sh)) {
shrink_buffers(sh);
kmem_cache_free(conf->slab_cache, sh);
return 0;
}
Expand Down Expand Up @@ -1468,7 +1469,7 @@ static int drop_one_stripe(raid5_conf_t *conf)
if (!sh)
return 0;
BUG_ON(atomic_read(&sh->count));
shrink_buffers(sh, conf->pool_size);
shrink_buffers(sh);
kmem_cache_free(conf->slab_cache, sh);
atomic_dec(&conf->active_stripes);
return 1;
Expand Down

0 comments on commit de1c997

Please sign in to comment.