diff options
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r-- | block/blk-sysfs.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index a29cb788e408..b538ab8dbbd1 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page) | |||
130 | return queue_var_show(max_hw_sectors_kb, (page)); | 130 | return queue_var_show(max_hw_sectors_kb, (page)); |
131 | } | 131 | } |
132 | 132 | ||
133 | static ssize_t queue_nonrot_show(struct request_queue *q, char *page) | ||
134 | { | ||
135 | return queue_var_show(!blk_queue_nonrot(q), page); | ||
136 | } | ||
137 | |||
138 | static ssize_t queue_nonrot_store(struct request_queue *q, const char *page, | ||
139 | size_t count) | ||
140 | { | ||
141 | unsigned long nm; | ||
142 | ssize_t ret = queue_var_store(&nm, page, count); | ||
143 | |||
144 | spin_lock_irq(q->queue_lock); | ||
145 | if (nm) | ||
146 | queue_flag_clear(QUEUE_FLAG_NONROT, q); | ||
147 | else | ||
148 | queue_flag_set(QUEUE_FLAG_NONROT, q); | ||
149 | spin_unlock_irq(q->queue_lock); | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
133 | static ssize_t queue_nomerges_show(struct request_queue *q, char *page) | 154 | static ssize_t queue_nomerges_show(struct request_queue *q, char *page) |
134 | { | 155 | { |
135 | return queue_var_show(blk_queue_nomerges(q), page); | 156 | return queue_var_show(blk_queue_nomerges(q), page); |
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | |||
146 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); | 167 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
147 | else | 168 | else |
148 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); | 169 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); |
149 | |||
150 | spin_unlock_irq(q->queue_lock); | 170 | spin_unlock_irq(q->queue_lock); |
171 | |||
151 | return ret; | 172 | return ret; |
152 | } | 173 | } |
153 | 174 | ||
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw_sector_size_entry = { | |||
210 | .show = queue_hw_sector_size_show, | 231 | .show = queue_hw_sector_size_show, |
211 | }; | 232 | }; |
212 | 233 | ||
234 | static struct queue_sysfs_entry queue_nonrot_entry = { | ||
235 | .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR }, | ||
236 | .show = queue_nonrot_show, | ||
237 | .store = queue_nonrot_store, | ||
238 | }; | ||
239 | |||
213 | static struct queue_sysfs_entry queue_nomerges_entry = { | 240 | static struct queue_sysfs_entry queue_nomerges_entry = { |
214 | .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR }, | 241 | .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR }, |
215 | .show = queue_nomerges_show, | 242 | .show = queue_nomerges_show, |
@@ -229,6 +256,7 @@ static struct attribute *default_attrs[] = { | |||
229 | &queue_max_sectors_entry.attr, | 256 | &queue_max_sectors_entry.attr, |
230 | &queue_iosched_entry.attr, | 257 | &queue_iosched_entry.attr, |
231 | &queue_hw_sector_size_entry.attr, | 258 | &queue_hw_sector_size_entry.attr, |
259 | &queue_nonrot_entry.attr, | ||
232 | &queue_nomerges_entry.attr, | 260 | &queue_nomerges_entry.attr, |
233 | &queue_rq_affinity_entry.attr, | 261 | &queue_rq_affinity_entry.attr, |
234 | NULL, | 262 | NULL, |