From 2b1191af683d16a899c2b81b87b605841ceffdec Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 9 Oct 2006 13:04:35 +0200 Subject: [PATCH 1/6] [PATCH] elevator: elevator_type member not used elevator_type field in elevator_type structure is useless: it isn't used anywhere in kernel sources. Signed-off-by: Vasily Tarasov Signed-off-by: Jens Axboe --- include/linux/elevator.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/elevator.h b/include/linux/elevator.h index b3370ef5164d..2fa9f1144228 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -70,7 +70,6 @@ struct elevator_type { struct list_head list; struct elevator_ops ops; - struct elevator_type *elevator_type; struct elv_fs_entry *elevator_attrs; char elevator_name[ELV_NAME_MAX]; struct module *elevator_owner; From a22b169df1b9f259391cf3b8ad8bfeea3d7be3f1 Mon Sep 17 00:00:00 2001 From: Vasily Tarasov Date: Wed, 11 Oct 2006 09:24:27 +0200 Subject: [PATCH 2/6] [PATCH] block layer: elevator_find function cleanup We can easily produce search through the elevator list without introducing additional elevator_type variable. Signed-off-by: Vasily Tarasov Signed-off-by: Jens Axboe --- block/elevator.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 487dd3da8853..d8030a84773a 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -93,21 +93,18 @@ static inline int elv_try_merge(struct request *__rq, struct bio *bio) static struct elevator_type *elevator_find(const char *name) { - struct elevator_type *e = NULL; + struct elevator_type *e; struct list_head *entry; list_for_each(entry, &elv_list) { - struct elevator_type *__e; - __e = list_entry(entry, struct elevator_type, list); + e = list_entry(entry, struct elevator_type, list); - if (!strcmp(__e->elevator_name, name)) { - e = __e; - break; - } + if (!strcmp(e->elevator_name, name)) + return e; } - return e; + return NULL; } static void elevator_put(struct elevator_type *e) From e6e80f294c2688302f41959c57acfee7e131e489 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 11 Oct 2006 10:03:09 +0200 Subject: [PATCH 3/6] [PATCH] splice: fix pipe_to_file() ->prepare_write() error path Don't jump to the unlock+release path, we already did that. Signed-off-by: Jens Axboe --- fs/splice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 13e92dd19fbb..a567010b62ac 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -607,7 +607,7 @@ find_page: ret = -ENOMEM; page = page_cache_alloc_cold(mapping); if (unlikely(!page)) - goto out_nomem; + goto out_ret; /* * This will also lock the page @@ -666,7 +666,7 @@ find_page: if (sd->pos + this_len > isize) vmtruncate(mapping->host, isize); - goto out; + goto out_ret; } if (buf->page != page) { @@ -698,7 +698,7 @@ find_page: out: page_cache_release(page); unlock_page(page); -out_nomem: +out_ret: return ret; } From c5841642242e9ae817275e09b36b298456dc17d2 Mon Sep 17 00:00:00 2001 From: Vasily Tarasov Date: Wed, 11 Oct 2006 13:26:30 +0200 Subject: [PATCH 4/6] [PATCH] block layer: elv_iosched_show should get elv_list_lock elv_iosched_show function iterates other elv_list, hence elv_list_lock should be got. Signed-off-by: Vasily Tarasov Signed-off-by: Vasily Tarasov --- block/elevator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index d8030a84773a..8ccd163254b8 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -1085,7 +1085,7 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name) struct list_head *entry; int len = 0; - spin_lock_irq(q->queue_lock); + spin_lock_irq(&elv_list_lock); list_for_each(entry, &elv_list) { struct elevator_type *__e; @@ -1095,7 +1095,7 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name) else len += sprintf(name+len, "%s ", __e->elevator_name); } - spin_unlock_irq(q->queue_lock); + spin_unlock_irq(&elv_list_lock); len += sprintf(len+name, "\n"); return len; From cea2885a2e989d1dc19af1fc991717b33b7d1456 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 12 Oct 2006 15:08:45 +0200 Subject: [PATCH 5/6] [PATCH] ide-cd: fix breakage with internally queued commands We still need to maintain a private PC style command, since it isn't completely unified with REQ_TYPE_BLOCK_PC yet. Signed-off-by: Jens Axboe --- drivers/ide/ide-cd.c | 5 +++-- include/linux/blkdev.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 69bbb6206a00..e7513e55ace8 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -597,7 +597,7 @@ static void cdrom_prepare_request(ide_drive_t *drive, struct request *rq) struct cdrom_info *cd = drive->driver_data; ide_init_drive_cmd(rq); - rq->cmd_type = REQ_TYPE_BLOCK_PC; + rq->cmd_type = REQ_TYPE_ATA_PC; rq->rq_disk = cd->disk; } @@ -2023,7 +2023,8 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t block) } info->last_block = block; return action; - } else if (rq->cmd_type == REQ_TYPE_SENSE) { + } else if (rq->cmd_type == REQ_TYPE_SENSE || + rq->cmd_type == REQ_TYPE_ATA_PC) { return cdrom_do_packet_command(drive); } else if (blk_pc_request(rq)) { return cdrom_do_block_pc(drive, rq); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 26f7856ff812..d370d2cfe138 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -157,6 +157,7 @@ enum rq_cmd_type_bits { REQ_TYPE_ATA_CMD, REQ_TYPE_ATA_TASK, REQ_TYPE_ATA_TASKFILE, + REQ_TYPE_ATA_PC, }; /* From d58cdfb89ce0c6bd5f81ae931a984ef298dbda20 Mon Sep 17 00:00:00 2001 From: Vasily Tarasov Date: Thu, 12 Oct 2006 15:09:51 +0200 Subject: [PATCH 6/6] [PATCH] block layer: ioprio_best function fix Currently ioprio_best function first checks wethere aioprio or bioprio equals IOPRIO_CLASS_NONE (ioprio_valid() macros does that) and if it is so it returns bioprio/aioprio appropriately. Thus the next four lines, that set aclass/bclass to IOPRIO_CLASS_BE, if aclass/bclass == IOPRIO_CLASS_NONE, are never executed. The second problem: if aioprio from class IOPRIO_CLASS_NONE and bioprio from class IOPRIO_CLASS_IDLE are passed to ioprio_best function, it will return IOPRIO_CLASS_IDLE. It means that during __make_request we can merge two requests and set the priority of merged request to IDLE, while one of the initial requests originates from a process with NONE (default) priority. So we can get a situation when a process with default ioprio will experience IO starvation, while there is no process from real-time class in the system. Just removing ioprio_valid check should correct situation. Signed-off-by: Vasily Tarasov Signed-off-by: Jens Axboe --- fs/ioprio.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/ioprio.c b/fs/ioprio.c index 6dc6721d9e82..89e8da112a75 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c @@ -150,11 +150,6 @@ int ioprio_best(unsigned short aprio, unsigned short bprio) unsigned short aclass = IOPRIO_PRIO_CLASS(aprio); unsigned short bclass = IOPRIO_PRIO_CLASS(bprio); - if (!ioprio_valid(aprio)) - return bprio; - if (!ioprio_valid(bprio)) - return aprio; - if (aclass == IOPRIO_CLASS_NONE) aclass = IOPRIO_CLASS_BE; if (bclass == IOPRIO_CLASS_NONE)