aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/elevator.c3
-rw-r--r--block/ll_rw_blk.c25
-rw-r--r--block/scsi_ioctl.c13
3 files changed, 10 insertions, 31 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))