Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333246
b: refs/heads/master
c: b1f3b64
h: refs/heads/master
v: v3
  • Loading branch information
Dave Reisner authored and Jens Axboe committed Sep 9, 2012
1 parent fa56e6c commit 7f63fec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 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: bf800ef1816b4283a885e55ad38068aec9711e4d
refs/heads/master: b1f3b64d76cf88cc250e5cdd1de783ba9737078e
25 changes: 23 additions & 2 deletions trunk/block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ queue_var_show(unsigned long var, char *page)
static ssize_t
queue_var_store(unsigned long *var, const char *page, size_t count)
{
char *p = (char *) page;
int err;
unsigned long v;

err = strict_strtoul(page, 10, &v);
if (err || v > UINT_MAX)
return -EINVAL;

*var = v;

*var = simple_strtoul(p, &p, 10);
return count;
}

Expand All @@ -48,6 +54,9 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
return -EINVAL;

ret = queue_var_store(&nr, page, count);
if (ret < 0)
return ret;

if (nr < BLKDEV_MIN_RQ)
nr = BLKDEV_MIN_RQ;

Expand Down Expand Up @@ -102,6 +111,9 @@ queue_ra_store(struct request_queue *q, const char *page, size_t count)
unsigned long ra_kb;
ssize_t ret = queue_var_store(&ra_kb, page, count);

if (ret < 0)
return ret;

q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10);

return ret;
Expand Down Expand Up @@ -176,6 +188,9 @@ queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
page_kb = 1 << (PAGE_CACHE_SHIFT - 10);
ssize_t ret = queue_var_store(&max_sectors_kb, page, count);

if (ret < 0)
return ret;

if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb)
return -EINVAL;

Expand Down Expand Up @@ -236,6 +251,9 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
unsigned long nm;
ssize_t ret = queue_var_store(&nm, page, count);

if (ret < 0)
return ret;

spin_lock_irq(q->queue_lock);
queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
queue_flag_clear(QUEUE_FLAG_NOXMERGES, q);
Expand Down Expand Up @@ -264,6 +282,9 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
unsigned long val;

ret = queue_var_store(&val, page, count);
if (ret < 0)
return ret;

spin_lock_irq(q->queue_lock);
if (val == 2) {
queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
Expand Down

0 comments on commit 7f63fec

Please sign in to comment.