aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/elevator.c3
-rw-r--r--block/ll_rw_blk.c25
-rw-r--r--block/scsi_ioctl.c13
-rw-r--r--drivers/ide/ide-cd.c10
-rw-r--r--fs/bio.c1
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/elevator.h2
7 files changed, 11 insertions, 44 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 39dcccc82ada..99a4d7b2f8ad 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -64,7 +64,7 @@ inline int elv_rq_merge_ok(struct request *rq, struct bio *bio)
64} 64}
65EXPORT_SYMBOL(elv_rq_merge_ok); 65EXPORT_SYMBOL(elv_rq_merge_ok);
66 66
67inline int elv_try_merge(struct request *__rq, struct bio *bio) 67static inline int elv_try_merge(struct request *__rq, struct bio *bio)
68{ 68{
69 int ret = ELEVATOR_NO_MERGE; 69 int ret = ELEVATOR_NO_MERGE;
70 70
@@ -80,7 +80,6 @@ inline int elv_try_merge(struct request *__rq, struct bio *bio)
80 80
81 return ret; 81 return ret;
82} 82}
83EXPORT_SYMBOL(elv_try_merge);
84 83
85static struct elevator_type *elevator_find(const char *name) 84static struct elevator_type *elevator_find(const char *name)
86{ 85{
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8e136450abc2..8e27d0ab0d7c 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -26,7 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/swap.h> 27#include <linux/swap.h>
28#include <linux/writeback.h> 28#include <linux/writeback.h>
29#include <linux/blkdev.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31#include <linux/cpu.h> 30#include <linux/cpu.h>
32 31
@@ -2748,30 +2747,6 @@ static inline int attempt_front_merge(request_queue_t *q, struct request *rq)
2748 return 0; 2747 return 0;
2749} 2748}
2750 2749
2751/**
2752 * blk_attempt_remerge - attempt to remerge active head with next request
2753 * @q: The &request_queue_t belonging to the device
2754 * @rq: The head request (usually)
2755 *
2756 * Description:
2757 * For head-active devices, the queue can easily be unplugged so quickly
2758 * that proper merging is not done on the front request. This may hurt
2759 * performance greatly for some devices. The block layer cannot safely
2760 * do merging on that first request for these queues, but the driver can
2761 * call this function and make it happen any way. Only the driver knows
2762 * when it is safe to do so.
2763 **/
2764void blk_attempt_remerge(request_queue_t *q, struct request *rq)
2765{
2766 unsigned long flags;
2767
2768 spin_lock_irqsave(q->queue_lock, flags);
2769 attempt_back_merge(q, rq);
2770 spin_unlock_irqrestore(q->queue_lock, flags);
2771}
2772
2773EXPORT_SYMBOL(blk_attempt_remerge);
2774
2775static void init_request_from_bio(struct request *req, struct bio *bio) 2750static void init_request_from_bio(struct request *req, struct bio *bio)
2776{ 2751{
2777 req->flags |= REQ_CMD; 2752 req->flags |= REQ_CMD;
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index c2ac36dfe4f3..18de84c8ccd8 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -190,16 +190,21 @@ static int verify_command(struct file *file, unsigned char *cmd)
190 safe_for_write(GPCMD_SET_STREAMING), 190 safe_for_write(GPCMD_SET_STREAMING),
191 }; 191 };
192 unsigned char type = cmd_type[cmd[0]]; 192 unsigned char type = cmd_type[cmd[0]];
193 int has_write_perm = 0;
193 194
194 /* Anybody who can open the device can do a read-safe command */ 195 /* Anybody who can open the device can do a read-safe command */
195 if (type & CMD_READ_SAFE) 196 if (type & CMD_READ_SAFE)
196 return 0; 197 return 0;
197 198
199 /*
200 * file can be NULL from ioctl_by_bdev()...
201 */
202 if (file)
203 has_write_perm = file->f_mode & FMODE_WRITE;
204
198 /* Write-safe commands just require a writable open.. */ 205 /* Write-safe commands just require a writable open.. */
199 if (type & CMD_WRITE_SAFE) { 206 if ((type & CMD_WRITE_SAFE) && has_write_perm)
200 if (file->f_mode & FMODE_WRITE) 207 return 0;
201 return 0;
202 }
203 208
204 /* And root can do any command.. */ 209 /* And root can do any command.. */
205 if (capable(CAP_SYS_RAWIO)) 210 if (capable(CAP_SYS_RAWIO))
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index d31117eb95aa..e4d55ad32d2f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1332,8 +1332,6 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
1332 if (cdrom_read_from_buffer(drive)) 1332 if (cdrom_read_from_buffer(drive))
1333 return ide_stopped; 1333 return ide_stopped;
1334 1334
1335 blk_attempt_remerge(drive->queue, rq);
1336
1337 /* Clear the local sector buffer. */ 1335 /* Clear the local sector buffer. */
1338 info->nsectors_buffered = 0; 1336 info->nsectors_buffered = 0;
1339 1337
@@ -1874,14 +1872,6 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
1874 return ide_stopped; 1872 return ide_stopped;
1875 } 1873 }
1876 1874
1877 /*
1878 * for dvd-ram and such media, it's a really big deal to get
1879 * big writes all the time. so scour the queue and attempt to
1880 * remerge requests, often the plugging will not have had time
1881 * to do this properly
1882 */
1883 blk_attempt_remerge(drive->queue, rq);
1884
1885 info->nsectors_buffered = 0; 1875 info->nsectors_buffered = 0;
1886 1876
1887 /* use dma, if possible. we don't need to check more, since we 1877 /* use dma, if possible. we don't need to check more, since we
diff --git a/fs/bio.c b/fs/bio.c
index dfe242a21eb4..7b3069589951 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -126,6 +126,7 @@ static void bio_fs_destructor(struct bio *bio)
126inline void bio_init(struct bio *bio) 126inline void bio_init(struct bio *bio)
127{ 127{
128 bio->bi_next = NULL; 128 bio->bi_next = NULL;
129 bio->bi_bdev = NULL;
129 bio->bi_flags = 1 << BIO_UPTODATE; 130 bio->bi_flags = 1 << BIO_UPTODATE;
130 bio->bi_rw = 0; 131 bio->bi_rw = 0;
131 bio->bi_vcnt = 0; 132 bio->bi_vcnt = 0;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 804cc4ec9533..02a585faa62c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -595,7 +595,6 @@ extern void generic_make_request(struct bio *bio);
595extern void blk_put_request(struct request *); 595extern void blk_put_request(struct request *);
596extern void __blk_put_request(request_queue_t *, struct request *); 596extern void __blk_put_request(request_queue_t *, struct request *);
597extern void blk_end_sync_rq(struct request *rq, int error); 597extern void blk_end_sync_rq(struct request *rq, int error);
598extern void blk_attempt_remerge(request_queue_t *, struct request *);
599extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 598extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
600extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 599extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
601extern void blk_requeue_request(request_queue_t *, struct request *); 600extern void blk_requeue_request(request_queue_t *, struct request *);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index fb80fa44c4dd..4a6f50e31c73 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -114,8 +114,6 @@ extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t);
114extern int elevator_init(request_queue_t *, char *); 114extern int elevator_init(request_queue_t *, char *);
115extern void elevator_exit(elevator_t *); 115extern void elevator_exit(elevator_t *);
116extern int elv_rq_merge_ok(struct request *, struct bio *); 116extern int elv_rq_merge_ok(struct request *, struct bio *);
117extern int elv_try_merge(struct request *, struct bio *);
118extern int elv_try_last_merge(request_queue_t *, struct bio *);
119 117
120/* 118/*
121 * Return values from elevator merger 119 * Return values from elevator merger