Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208365
b: refs/heads/master
c: c41d4ac
h: refs/heads/master
i:
  208363: ade7093
v: v3
  • Loading branch information
NeilBrown committed Jul 21, 2010
1 parent f5307a5 commit 900b424
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 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: 00bcb4ac7ee7e557a491b614219142cea0ef16f4
refs/heads/master: c41d4ac40df0d01bf9c383ff28f194d1df2d4fd9
39 changes: 26 additions & 13 deletions trunk/drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -4566,23 +4566,15 @@ raid5_show_stripe_cache_size(mddev_t *mddev, char *page)
return 0;
}

static ssize_t
raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
int
raid5_set_cache_size(mddev_t *mddev, int size)
{
raid5_conf_t *conf = mddev->private;
unsigned long new;
int err;

if (len >= PAGE_SIZE)
if (size <= 16 || size > 32768)
return -EINVAL;
if (!conf)
return -ENODEV;

if (strict_strtoul(page, 10, &new))
return -EINVAL;
if (new <= 16 || new > 32768)
return -EINVAL;
while (new < conf->max_nr_stripes) {
while (size < conf->max_nr_stripes) {
if (drop_one_stripe(conf))
conf->max_nr_stripes--;
else
Expand All @@ -4591,11 +4583,32 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
err = md_allow_write(mddev);
if (err)
return err;
while (new > conf->max_nr_stripes) {
while (size > conf->max_nr_stripes) {
if (grow_one_stripe(conf))
conf->max_nr_stripes++;
else break;
}
return 0;
}
EXPORT_SYMBOL(raid5_set_cache_size);

static ssize_t
raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
{
raid5_conf_t *conf = mddev->private;
unsigned long new;
int err;

if (len >= PAGE_SIZE)
return -EINVAL;
if (!conf)
return -ENODEV;

if (strict_strtoul(page, 10, &new))
return -EINVAL;
err = raid5_set_cache_size(mddev, new);
if (err)
return err;
return len;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/md/raid5.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,5 @@ static inline int algorithm_is_DDF(int layout)
{
return layout >= 8 && layout <= 10;
}
extern int raid5_set_cache_size(mddev_t *mddev, int size);
#endif

0 comments on commit 900b424

Please sign in to comment.