Updated host/vhost/mic_blk.c, adding a `MIC_` prefix to the SECTOR_SHIFT and
authorAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 30 Apr 2021 21:48:41 +0000 (14:48 -0700)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 30 Apr 2021 21:48:41 +0000 (14:48 -0700)
SECTOR_SIZE macros since there is a conflicting definition in
`/usr/src/linux-headers-4.19.0-16-common/include/linux/blkdev.h`.

The definitions are nearly identical and that in host/vhost/mic_blk.c could
probably be removed instead of prefixed. I'm just being conservative since I'm
making a bunch of changes at once without the ability to build and test along
the way.

host/vhost/mic_blk.c

index 9ac2cb8..1a94a46 100644 (file)
@@ -41,8 +41,8 @@
 #include "vhost.h"
 #include "mic/mic_virtio.h"
 
 #include "vhost.h"
 #include "mic/mic_virtio.h"
 
-#define SECTOR_SHIFT           9
-#define SECTOR_SIZE            (1UL << SECTOR_SHIFT)
+#define MIC_SECTOR_SHIFT               9
+#define MIC_SECTOR_SIZE                        (1UL << MIC_SECTOR_SHIFT)
 #define VIRTIO_BLK_QUEUE_SIZE          128
 #define DISK_SEG_MAX                   (VIRTIO_BLK_QUEUE_SIZE - 2)
 
 #define VIRTIO_BLK_QUEUE_SIZE          128
 #define DISK_SEG_MAX                   (VIRTIO_BLK_QUEUE_SIZE - 2)
 
@@ -127,7 +127,7 @@ static void handle_io_work(struct work_struct *work)
        vbio = container_of(work, struct vhost_blk_io, work);
        blk = vbio->blk;
        vq = &blk->dev.vqs[0];
        vbio = container_of(work, struct vhost_blk_io, work);
        blk = vbio->blk;
        vq = &blk->dev.vqs[0];
-       pos = vbio->sector << SECTOR_SHIFT;
+       pos = vbio->sector << MIC_SECTOR_SHIFT;
        aper_va = blk->bd_info->bi_ctx.aper.va;
 
        vring = &((struct mic_virtblk *)blk->bd_info->bi_virtio)->vb_shared.vring;
        aper_va = blk->bd_info->bi_ctx.aper.va;
 
        vring = &((struct mic_virtblk *)blk->bd_info->bi_virtio)->vb_shared.vring;
@@ -258,7 +258,7 @@ static void start_io(struct list_head *queue)
                        vbio = entry;
                        continue;
                }
                        vbio = entry;
                        continue;
                }
-               if (vbio->sector + (vbio->len >> SECTOR_SHIFT) == entry->sector) {
+               if (vbio->sector + (vbio->len >> MIC_SECTOR_SHIFT) == entry->sector) {
                        vbio = entry;
                } else {
                        INIT_LIST_HEAD(&start);
                        vbio = entry;
                } else {
                        INIT_LIST_HEAD(&start);
@@ -473,7 +473,7 @@ static long vhost_blk_set_backend(struct vhost_blk *vblk)
 #endif
        writel(virtio_blk_features, &vb_shared->host_features);
        writel(DISK_SEG_MAX, &vb_shared->blk_config.seg_max);
 #endif
        writel(virtio_blk_features, &vb_shared->host_features);
        writel(DISK_SEG_MAX, &vb_shared->blk_config.seg_max);
-       writel(SECTOR_SIZE, &vb_shared->blk_config.blk_size);
+       writel(MIC_SECTOR_SIZE, &vb_shared->blk_config.blk_size);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
        ret = vfs_getattr(&vblk->virtblk_file->f_path, &stat);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
        ret = vfs_getattr(&vblk->virtblk_file->f_path, &stat);
@@ -485,10 +485,10 @@ static long vhost_blk_set_backend(struct vhost_blk *vblk)
                goto _exit_;
 
        if (S_ISBLK(stat.mode)) {
                goto _exit_;
 
        if (S_ISBLK(stat.mode)) {
-         writel(i_size_read(I_BDEV(vblk->virtblk_file->f_mapping->host)->bd_inode) / SECTOR_SIZE,
+         writel(i_size_read(I_BDEV(vblk->virtblk_file->f_mapping->host)->bd_inode) / MIC_SECTOR_SIZE,
                         &vb_shared->blk_config.capacity);
        } else {
                         &vb_shared->blk_config.capacity);
        } else {
-         writel(stat.size / SECTOR_SIZE, &vb_shared->blk_config.capacity);
+         writel(stat.size / MIC_SECTOR_SIZE, &vb_shared->blk_config.capacity);
        }
 
        ret = mic_reg_irqhandler(&bd_info->bi_ctx, MIC_IRQ_DB2, "Host DoorBell 2",
        }
 
        ret = mic_reg_irqhandler(&bd_info->bi_ctx, MIC_IRQ_DB2, "Host DoorBell 2",