diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-11-03 15:14:39 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-11-03 15:14:39 -0500 |
commit | 2058297d2d045cb57138c33b87cfabcc80e65186 (patch) | |
tree | 7ccffd0e162cbd7471f643561e79f23abb989a62 /drivers/block | |
parent | 150e6c67f4bf6ab51e62defc41bd19a2eefe5709 (diff) | |
parent | 4b27e1bb442e964903f8a3fa6bdf33a602dc0941 (diff) |
Merge branch 'for-linus' into for-2.6.33
Conflicts:
block/cfq-iosched.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/loop.c | 2 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 39 |
2 files changed, 4 insertions, 37 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index edda9ea7c62..bd112c8c7bc 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -949,7 +949,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | |||
949 | lo->lo_state = Lo_unbound; | 949 | lo->lo_state = Lo_unbound; |
950 | /* This is safe: open() is still holding a reference. */ | 950 | /* This is safe: open() is still holding a reference. */ |
951 | module_put(THIS_MODULE); | 951 | module_put(THIS_MODULE); |
952 | if (max_part > 0) | 952 | if (max_part > 0 && bdev) |
953 | ioctl_by_bdev(bdev, BLKRRPART, 0); | 953 | ioctl_by_bdev(bdev, BLKRRPART, 0); |
954 | mutex_unlock(&lo->lo_ctl_mutex); | 954 | mutex_unlock(&lo->lo_ctl_mutex); |
955 | /* | 955 | /* |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43f19389647..51042f0ba7e 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -3,7 +3,6 @@ | |||
3 | #include <linux/blkdev.h> | 3 | #include <linux/blkdev.h> |
4 | #include <linux/hdreg.h> | 4 | #include <linux/hdreg.h> |
5 | #include <linux/virtio.h> | 5 | #include <linux/virtio.h> |
6 | #include <linux/virtio_ids.h> | ||
7 | #include <linux/virtio_blk.h> | 6 | #include <linux/virtio_blk.h> |
8 | #include <linux/scatterlist.h> | 7 | #include <linux/scatterlist.h> |
9 | 8 | ||
@@ -183,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q) | |||
183 | vblk->vq->vq_ops->kick(vblk->vq); | 182 | vblk->vq->vq_ops->kick(vblk->vq); |
184 | } | 183 | } |
185 | 184 | ||
186 | /* return ATA identify data | ||
187 | */ | ||
188 | static int virtblk_identify(struct gendisk *disk, void *argp) | ||
189 | { | ||
190 | struct virtio_blk *vblk = disk->private_data; | ||
191 | void *opaque; | ||
192 | int err = -ENOMEM; | ||
193 | |||
194 | opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL); | ||
195 | if (!opaque) | ||
196 | goto out; | ||
197 | |||
198 | err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, | ||
199 | offsetof(struct virtio_blk_config, identify), opaque, | ||
200 | VIRTIO_BLK_ID_BYTES); | ||
201 | |||
202 | if (err) | ||
203 | goto out_kfree; | ||
204 | |||
205 | if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES)) | ||
206 | err = -EFAULT; | ||
207 | |||
208 | out_kfree: | ||
209 | kfree(opaque); | ||
210 | out: | ||
211 | return err; | ||
212 | } | ||
213 | |||
214 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) | 185 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) |
215 | { | 186 | { |
216 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; | 187 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; |
@@ -222,10 +193,6 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
222 | { | 193 | { |
223 | struct gendisk *disk = bdev->bd_disk; | 194 | struct gendisk *disk = bdev->bd_disk; |
224 | struct virtio_blk *vblk = disk->private_data; | 195 | struct virtio_blk *vblk = disk->private_data; |
225 | void __user *argp = (void __user *)data; | ||
226 | |||
227 | if (cmd == HDIO_GET_IDENTITY) | ||
228 | return virtblk_identify(disk, argp); | ||
229 | 196 | ||
230 | /* | 197 | /* |
231 | * Only allow the generic SCSI ioctls if the host can support it. | 198 | * Only allow the generic SCSI ioctls if the host can support it. |
@@ -233,7 +200,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
233 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) | 200 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) |
234 | return -ENOTTY; | 201 | return -ENOTTY; |
235 | 202 | ||
236 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); | 203 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, |
204 | (void __user *)data); | ||
237 | } | 205 | } |
238 | 206 | ||
239 | /* We provide getgeo only to please some old bootloader/partitioning tools */ | 207 | /* We provide getgeo only to please some old bootloader/partitioning tools */ |
@@ -332,7 +300,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
332 | } | 300 | } |
333 | 301 | ||
334 | vblk->disk->queue->queuedata = vblk; | 302 | vblk->disk->queue->queuedata = vblk; |
335 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue); | ||
336 | 303 | ||
337 | if (index < 26) { | 304 | if (index < 26) { |
338 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | 305 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); |
@@ -445,7 +412,7 @@ static struct virtio_device_id id_table[] = { | |||
445 | static unsigned int features[] = { | 412 | static unsigned int features[] = { |
446 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 413 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
447 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, | 414 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, |
448 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH | 415 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH |
449 | }; | 416 | }; |
450 | 417 | ||
451 | /* | 418 | /* |