summaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/blkback.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-04-20 11:21:43 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-04-20 11:58:02 -0400
commit42c7841d171a2fe32005738dfebd724a90921496 (patch)
tree6cb19a9a61e98502eb7e3060f61781a6af016866 /drivers/block/xen-blkback/blkback.c
parent6cd0388cd600a51a8824dc5b34f1107b367b0cac (diff)
downloadblackbird-op-linux-42c7841d171a2fe32005738dfebd724a90921496.tar.gz
blackbird-op-linux-42c7841d171a2fe32005738dfebd724a90921496.zip
xen-blkback: Inline some of the functions that were moved from vbd/interface.c
Shuffling code around. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback/blkback.c')
-rw-r--r--drivers/block/xen-blkback/blkback.c78
1 files changed, 6 insertions, 72 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 63001fac9af2..806c2c947c63 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -170,75 +170,9 @@ static void free_req(struct pending_req *req)
* Routines for managing virtual block devices (vbds).
*/
-#define vbd_sz(_v) ((_v)->bdev->bd_part ? \
- (_v)->bdev->bd_part->nr_sects : \
- get_capacity((_v)->bdev->bd_disk))
-unsigned long long vbd_size(struct vbd *vbd)
-{
- return vbd_sz(vbd);
-}
-
-unsigned int vbd_info(struct vbd *vbd)
-{
- return vbd->type | (vbd->readonly ? VDISK_READONLY : 0);
-}
-
-unsigned long vbd_secsize(struct vbd *vbd)
-{
- return bdev_logical_block_size(vbd->bdev);
-}
-
-int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle, unsigned major,
- unsigned minor, int readonly, int cdrom)
-{
- struct vbd *vbd;
- struct block_device *bdev;
-
- vbd = &blkif->vbd;
- vbd->handle = handle;
- vbd->readonly = readonly;
- vbd->type = 0;
-
- vbd->pdevice = MKDEV(major, minor);
-
- bdev = blkdev_get_by_dev(vbd->pdevice, vbd->readonly ?
- FMODE_READ : FMODE_WRITE, NULL);
-
- if (IS_ERR(bdev)) {
- DPRINTK("vbd_creat: device %08x could not be opened.\n",
- vbd->pdevice);
- return -ENOENT;
- }
-
- vbd->bdev = bdev;
- vbd->size = vbd_size(vbd);
-
- if (vbd->bdev->bd_disk == NULL) {
- DPRINTK("vbd_creat: device %08x doesn't exist.\n",
- vbd->pdevice);
- vbd_free(vbd);
- return -ENOENT;
- }
-
- if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
- vbd->type |= VDISK_CDROM;
- if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE)
- vbd->type |= VDISK_REMOVABLE;
-
- DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
- handle, blkif->domid);
- return 0;
-}
-
-void vbd_free(struct vbd *vbd)
-{
- if (vbd->bdev)
- blkdev_put(vbd->bdev, vbd->readonly ? FMODE_READ : FMODE_WRITE);
- vbd->bdev = NULL;
-}
-
-int vbd_translate(struct phys_req *req, struct blkif_st *blkif, int operation)
+static int vbd_translate(struct phys_req *req, struct blkif_st *blkif,
+ int operation)
{
struct vbd *vbd = &blkif->vbd;
int rc = -EACCES;
@@ -257,13 +191,13 @@ int vbd_translate(struct phys_req *req, struct blkif_st *blkif, int operation)
return rc;
}
-void vbd_resize(struct blkif_st *blkif)
+static void vbd_resize(struct blkif_st *blkif)
{
struct vbd *vbd = &blkif->vbd;
struct xenbus_transaction xbt;
int err;
struct xenbus_device *dev = blkback_xenbus(blkif->be);
- unsigned long long new_size = vbd_size(vbd);
+ unsigned long long new_size = vbd_sz(vbd);
printk(KERN_INFO "VBD Resize: Domid: %d, Device: (%d, %d)\n",
blkif->domid, MAJOR(vbd->pdevice), MINOR(vbd->pdevice));
@@ -276,7 +210,7 @@ again:
return;
}
err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu",
- vbd_size(vbd));
+ (unsigned long long)vbd_sz(vbd));
if (err) {
printk(KERN_WARNING "Error writing new size");
goto abort;
@@ -344,7 +278,7 @@ int blkif_schedule(void *arg)
while (!kthread_should_stop()) {
if (try_to_freeze())
continue;
- if (unlikely(vbd->size != vbd_size(vbd)))
+ if (unlikely(vbd->size != vbd_sz(vbd)))
vbd_resize(blkif);
wait_event_interruptible(
OpenPOWER on IntegriCloud