block: Expose stacked device queues in sysfs
Currently stacking devices do not have a queue directory in sysfs. However, many of the I/O characteristics like sector size, maximum request size, etc. are queue properties. This patch enables the queue directory for MD/DM devices. The elevator code has been modified to deal with queues that do not have an I/O scheduler. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
025146e13b
commit
cd43e26f07
@ -395,9 +395,6 @@ int blk_register_queue(struct gendisk *disk)
|
|||||||
if (WARN_ON(!q))
|
if (WARN_ON(!q))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
if (!q->request_fn)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
|
ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
|
||||||
"%s", "queue");
|
"%s", "queue");
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -405,6 +402,9 @@ int blk_register_queue(struct gendisk *disk)
|
|||||||
|
|
||||||
kobject_uevent(&q->kobj, KOBJ_ADD);
|
kobject_uevent(&q->kobj, KOBJ_ADD);
|
||||||
|
|
||||||
|
if (!q->request_fn)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ret = elv_register_queue(q);
|
ret = elv_register_queue(q);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kobject_uevent(&q->kobj, KOBJ_REMOVE);
|
kobject_uevent(&q->kobj, KOBJ_REMOVE);
|
||||||
|
@ -575,6 +575,9 @@ void elv_drain_elevator(struct request_queue *q)
|
|||||||
*/
|
*/
|
||||||
void elv_quiesce_start(struct request_queue *q)
|
void elv_quiesce_start(struct request_queue *q)
|
||||||
{
|
{
|
||||||
|
if (!q->elevator)
|
||||||
|
return;
|
||||||
|
|
||||||
queue_flag_set(QUEUE_FLAG_ELVSWITCH, q);
|
queue_flag_set(QUEUE_FLAG_ELVSWITCH, q);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1050,6 +1053,9 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
|
|||||||
char elevator_name[ELV_NAME_MAX];
|
char elevator_name[ELV_NAME_MAX];
|
||||||
struct elevator_type *e;
|
struct elevator_type *e;
|
||||||
|
|
||||||
|
if (!q->elevator)
|
||||||
|
return count;
|
||||||
|
|
||||||
strlcpy(elevator_name, name, sizeof(elevator_name));
|
strlcpy(elevator_name, name, sizeof(elevator_name));
|
||||||
strstrip(elevator_name);
|
strstrip(elevator_name);
|
||||||
|
|
||||||
@ -1073,10 +1079,15 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
|
|||||||
ssize_t elv_iosched_show(struct request_queue *q, char *name)
|
ssize_t elv_iosched_show(struct request_queue *q, char *name)
|
||||||
{
|
{
|
||||||
struct elevator_queue *e = q->elevator;
|
struct elevator_queue *e = q->elevator;
|
||||||
struct elevator_type *elv = e->elevator_type;
|
struct elevator_type *elv;
|
||||||
struct elevator_type *__e;
|
struct elevator_type *__e;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
if (!q->elevator)
|
||||||
|
return sprintf(name, "none\n");
|
||||||
|
|
||||||
|
elv = e->elevator_type;
|
||||||
|
|
||||||
spin_lock(&elv_list_lock);
|
spin_lock(&elv_list_lock);
|
||||||
list_for_each_entry(__e, &elv_list, list) {
|
list_for_each_entry(__e, &elv_list, list) {
|
||||||
if (!strcmp(elv->elevator_name, __e->elevator_name))
|
if (!strcmp(elv->elevator_name, __e->elevator_name))
|
||||||
|
Loading…
Reference in New Issue
Block a user