virtio_blk.c (ff005a066240efb73ae29a2bb9269ae726bc2eae) virtio_blk.c (5657a819a8d94426c76be04dcedfad0f64cfff00)
1//#define DEBUG
2#include <linux/spinlock.h>
3#include <linux/slab.h>
4#include <linux/blkdev.h>
5#include <linux/hdreg.h>
6#include <linux/module.h>
7#include <linux/mutex.h>
8#include <linux/interrupt.h>

--- 357 unchanged lines hidden (view full) ---

366 return strlen(buf);
367
368 if (err == -EIO) /* Unsupported? Make it empty. */
369 return 0;
370
371 return err;
372}
373
1//#define DEBUG
2#include <linux/spinlock.h>
3#include <linux/slab.h>
4#include <linux/blkdev.h>
5#include <linux/hdreg.h>
6#include <linux/module.h>
7#include <linux/mutex.h>
8#include <linux/interrupt.h>

--- 357 unchanged lines hidden (view full) ---

366 return strlen(buf);
367
368 if (err == -EIO) /* Unsupported? Make it empty. */
369 return 0;
370
371 return err;
372}
373
374static DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL);
374static DEVICE_ATTR(serial, 0444, virtblk_serial_show, NULL);
375
376/* The queue's logical block size must be set before calling this */
377static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
378{
379 struct virtio_device *vdev = vblk->vdev;
380 struct request_queue *q = vblk->disk->queue;
381 char cap_str_2[10], cap_str_10[10];
382 unsigned long long nblocks;

--- 188 unchanged lines hidden (view full) ---

571 struct virtio_blk *vblk = disk->private_data;
572 u8 writeback = virtblk_get_cache_mode(vblk->vdev);
573
574 BUG_ON(writeback >= ARRAY_SIZE(virtblk_cache_types));
575 return snprintf(buf, 40, "%s\n", virtblk_cache_types[writeback]);
576}
577
578static const struct device_attribute dev_attr_cache_type_ro =
375
376/* The queue's logical block size must be set before calling this */
377static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
378{
379 struct virtio_device *vdev = vblk->vdev;
380 struct request_queue *q = vblk->disk->queue;
381 char cap_str_2[10], cap_str_10[10];
382 unsigned long long nblocks;

--- 188 unchanged lines hidden (view full) ---

571 struct virtio_blk *vblk = disk->private_data;
572 u8 writeback = virtblk_get_cache_mode(vblk->vdev);
573
574 BUG_ON(writeback >= ARRAY_SIZE(virtblk_cache_types));
575 return snprintf(buf, 40, "%s\n", virtblk_cache_types[writeback]);
576}
577
578static const struct device_attribute dev_attr_cache_type_ro =
579 __ATTR(cache_type, S_IRUGO,
579 __ATTR(cache_type, 0444,
580 virtblk_cache_type_show, NULL);
581static const struct device_attribute dev_attr_cache_type_rw =
580 virtblk_cache_type_show, NULL);
581static const struct device_attribute dev_attr_cache_type_rw =
582 __ATTR(cache_type, S_IRUGO|S_IWUSR,
582 __ATTR(cache_type, 0644,
583 virtblk_cache_type_show, virtblk_cache_type_store);
584
585static int virtblk_init_request(struct blk_mq_tag_set *set, struct request *rq,
586 unsigned int hctx_idx, unsigned int numa_node)
587{
588 struct virtio_blk *vblk = set->driver_data;
589 struct virtblk_req *vbr = blk_mq_rq_to_pdu(rq);
590

--- 362 unchanged lines hidden ---
583 virtblk_cache_type_show, virtblk_cache_type_store);
584
585static int virtblk_init_request(struct blk_mq_tag_set *set, struct request *rq,
586 unsigned int hctx_idx, unsigned int numa_node)
587{
588 struct virtio_blk *vblk = set->driver_data;
589 struct virtblk_req *vbr = blk_mq_rq_to_pdu(rq);
590

--- 362 unchanged lines hidden ---