diff options
Diffstat (limited to 'drivers/block/as-iosched.c')
-rw-r--r-- | drivers/block/as-iosched.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index a9575bb58a5e..95c0a3690b0f 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c | |||
@@ -1806,7 +1806,8 @@ static void as_put_request(request_queue_t *q, struct request *rq) | |||
1806 | rq->elevator_private = NULL; | 1806 | rq->elevator_private = NULL; |
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | static int as_set_request(request_queue_t *q, struct request *rq, int gfp_mask) | 1809 | static int as_set_request(request_queue_t *q, struct request *rq, |
1810 | struct bio *bio, int gfp_mask) | ||
1810 | { | 1811 | { |
1811 | struct as_data *ad = q->elevator->elevator_data; | 1812 | struct as_data *ad = q->elevator->elevator_data; |
1812 | struct as_rq *arq = mempool_alloc(ad->arq_pool, gfp_mask); | 1813 | struct as_rq *arq = mempool_alloc(ad->arq_pool, gfp_mask); |
@@ -1827,7 +1828,7 @@ static int as_set_request(request_queue_t *q, struct request *rq, int gfp_mask) | |||
1827 | return 1; | 1828 | return 1; |
1828 | } | 1829 | } |
1829 | 1830 | ||
1830 | static int as_may_queue(request_queue_t *q, int rw) | 1831 | static int as_may_queue(request_queue_t *q, int rw, struct bio *bio) |
1831 | { | 1832 | { |
1832 | int ret = ELV_MQUEUE_MAY; | 1833 | int ret = ELV_MQUEUE_MAY; |
1833 | struct as_data *ad = q->elevator->elevator_data; | 1834 | struct as_data *ad = q->elevator->elevator_data; |
@@ -1871,20 +1872,22 @@ static int as_init_queue(request_queue_t *q, elevator_t *e) | |||
1871 | if (!arq_pool) | 1872 | if (!arq_pool) |
1872 | return -ENOMEM; | 1873 | return -ENOMEM; |
1873 | 1874 | ||
1874 | ad = kmalloc(sizeof(*ad), GFP_KERNEL); | 1875 | ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); |
1875 | if (!ad) | 1876 | if (!ad) |
1876 | return -ENOMEM; | 1877 | return -ENOMEM; |
1877 | memset(ad, 0, sizeof(*ad)); | 1878 | memset(ad, 0, sizeof(*ad)); |
1878 | 1879 | ||
1879 | ad->q = q; /* Identify what queue the data belongs to */ | 1880 | ad->q = q; /* Identify what queue the data belongs to */ |
1880 | 1881 | ||
1881 | ad->hash = kmalloc(sizeof(struct list_head)*AS_HASH_ENTRIES,GFP_KERNEL); | 1882 | ad->hash = kmalloc_node(sizeof(struct list_head)*AS_HASH_ENTRIES, |
1883 | GFP_KERNEL, q->node); | ||
1882 | if (!ad->hash) { | 1884 | if (!ad->hash) { |
1883 | kfree(ad); | 1885 | kfree(ad); |
1884 | return -ENOMEM; | 1886 | return -ENOMEM; |
1885 | } | 1887 | } |
1886 | 1888 | ||
1887 | ad->arq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, arq_pool); | 1889 | ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, |
1890 | mempool_free_slab, arq_pool, q->node); | ||
1888 | if (!ad->arq_pool) { | 1891 | if (!ad->arq_pool) { |
1889 | kfree(ad->hash); | 1892 | kfree(ad->hash); |
1890 | kfree(ad); | 1893 | kfree(ad); |
@@ -1932,23 +1935,15 @@ struct as_fs_entry { | |||
1932 | static ssize_t | 1935 | static ssize_t |
1933 | as_var_show(unsigned int var, char *page) | 1936 | as_var_show(unsigned int var, char *page) |
1934 | { | 1937 | { |
1935 | var = (var * 1000) / HZ; | ||
1936 | return sprintf(page, "%d\n", var); | 1938 | return sprintf(page, "%d\n", var); |
1937 | } | 1939 | } |
1938 | 1940 | ||
1939 | static ssize_t | 1941 | static ssize_t |
1940 | as_var_store(unsigned long *var, const char *page, size_t count) | 1942 | as_var_store(unsigned long *var, const char *page, size_t count) |
1941 | { | 1943 | { |
1942 | unsigned long tmp; | ||
1943 | char *p = (char *) page; | 1944 | char *p = (char *) page; |
1944 | 1945 | ||
1945 | tmp = simple_strtoul(p, &p, 10); | 1946 | *var = simple_strtoul(p, &p, 10); |
1946 | if (tmp != 0) { | ||
1947 | tmp = (tmp * HZ) / 1000; | ||
1948 | if (tmp == 0) | ||
1949 | tmp = 1; | ||
1950 | } | ||
1951 | *var = tmp; | ||
1952 | return count; | 1947 | return count; |
1953 | } | 1948 | } |
1954 | 1949 | ||
@@ -2044,7 +2039,7 @@ as_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
2044 | struct as_fs_entry *entry = to_as(attr); | 2039 | struct as_fs_entry *entry = to_as(attr); |
2045 | 2040 | ||
2046 | if (!entry->show) | 2041 | if (!entry->show) |
2047 | return 0; | 2042 | return -EIO; |
2048 | 2043 | ||
2049 | return entry->show(e->elevator_data, page); | 2044 | return entry->show(e->elevator_data, page); |
2050 | } | 2045 | } |
@@ -2057,7 +2052,7 @@ as_attr_store(struct kobject *kobj, struct attribute *attr, | |||
2057 | struct as_fs_entry *entry = to_as(attr); | 2052 | struct as_fs_entry *entry = to_as(attr); |
2058 | 2053 | ||
2059 | if (!entry->store) | 2054 | if (!entry->store) |
2060 | return -EINVAL; | 2055 | return -EIO; |
2061 | 2056 | ||
2062 | return entry->store(e->elevator_data, page, length); | 2057 | return entry->store(e->elevator_data, page, length); |
2063 | } | 2058 | } |