mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
bitkeeper revision 1.1236.1.173 (424bd85e5lo6-hlVKAhgf-Zu85iruw)
Clean up ctrl msg handling in Linux. Remove VBD_GROW/SHRINK -- a VBD now maps onto a single complete major/minor that is specified at VBD_CREATE time. Also improve blkdev request_queue unplugging in the 2.6 backend driver to promote better batching. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
dacaf11601
commit
7b7eedda27
17 files changed
+135
-635
No files matched your search
@@ -659,6 +659,7 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
|
||||
C2P(blkif_be_vbd_create_t, domid, Int, Long);
|
||||
C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long);
|
||||
C2P(blkif_be_vbd_create_t, pdevice, Int, Long);
|
||||
C2P(blkif_be_vbd_create_t, vdevice, Int, Long);
|
||||
C2P(blkif_be_vbd_create_t, readonly, Int, Long);
|
||||
C2P(blkif_be_vbd_create_t, status, Int, Long);
|
||||
@@ -669,23 +670,6 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
|
||||
C2P(blkif_be_vbd_destroy_t, vdevice, Int, Long);
|
||||
C2P(blkif_be_vbd_destroy_t, status, Int, Long);
|
||||
return dict;
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
|
||||
C2P(blkif_be_vbd_grow_t, domid, Int, Long);
|
||||
C2P(blkif_be_vbd_grow_t, blkif_handle, Int, Long);
|
||||
C2P(blkif_be_vbd_grow_t, vdevice, Int, Long);
|
||||
C2P(blkif_be_vbd_grow_t, extent.sector_start,
|
||||
Long, UnsignedLongLong);
|
||||
C2P(blkif_be_vbd_grow_t, extent.sector_length,
|
||||
Long, UnsignedLongLong);
|
||||
C2P(blkif_be_vbd_grow_t, extent.device, Int, Long);
|
||||
C2P(blkif_be_vbd_grow_t, status, Int, Long);
|
||||
return dict;
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
|
||||
C2P(blkif_be_vbd_shrink_t, domid, Int, Long);
|
||||
C2P(blkif_be_vbd_shrink_t, blkif_handle, Int, Long);
|
||||
C2P(blkif_be_vbd_shrink_t, vdevice, Int, Long);
|
||||
C2P(blkif_be_vbd_shrink_t, status, Int, Long);
|
||||
return dict;
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DRIVER_STATUS):
|
||||
C2P(blkif_be_driver_status_t, status, Int, Long);
|
||||
return dict;
|
||||
@@ -894,6 +878,7 @@ static PyObject *xu_message_new(PyObject *self, PyObject *args)
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
|
||||
P2C(blkif_be_vbd_create_t, domid, u32);
|
||||
P2C(blkif_be_vbd_create_t, blkif_handle, u32);
|
||||
P2C(blkif_be_vbd_create_t, pdevice, blkif_pdev_t);
|
||||
P2C(blkif_be_vbd_create_t, vdevice, blkif_vdev_t);
|
||||
P2C(blkif_be_vbd_create_t, readonly, u16);
|
||||
break;
|
||||
@@ -902,19 +887,6 @@ static PyObject *xu_message_new(PyObject *self, PyObject *args)
|
||||
P2C(blkif_be_vbd_destroy_t, blkif_handle, u32);
|
||||
P2C(blkif_be_vbd_destroy_t, vdevice, blkif_vdev_t);
|
||||
break;
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
|
||||
P2C(blkif_be_vbd_grow_t, domid, u32);
|
||||
P2C(blkif_be_vbd_grow_t, blkif_handle, u32);
|
||||
P2C(blkif_be_vbd_grow_t, vdevice, blkif_vdev_t);
|
||||
P2C(blkif_be_vbd_grow_t, extent.sector_start, blkif_sector_t);
|
||||
P2C(blkif_be_vbd_grow_t, extent.sector_length, blkif_sector_t);
|
||||
P2C(blkif_be_vbd_grow_t, extent.device, blkif_pdev_t);
|
||||
break;
|
||||
case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
|
||||
P2C(blkif_be_vbd_shrink_t, domid, u32);
|
||||
P2C(blkif_be_vbd_shrink_t, blkif_handle, u32);
|
||||
P2C(blkif_be_vbd_shrink_t, vdevice, blkif_vdev_t);
|
||||
break;
|
||||
case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_STATUS):
|
||||
P2C(netif_fe_interface_status_t, handle, u32);
|
||||
P2C(netif_fe_interface_status_t, status, u32);
|
||||
|
||||
@@ -449,46 +449,17 @@ class BlkDev(controller.SplitDev):
|
||||
msg = packMsg('blkif_be_vbd_create_t',
|
||||
{ 'domid' : self.controller.dom,
|
||||
'blkif_handle' : backend.handle,
|
||||
'pdevice' : self.device,
|
||||
'vdevice' : self.vdev,
|
||||
'readonly' : self.readonly() })
|
||||
backend.writeRequest(msg, response=d)
|
||||
return d
|
||||
|
||||
def respond_be_vbd_create(self, msg):
|
||||
"""Response handler for a be_vbd_create message.
|
||||
Tries to grow the vbd.
|
||||
|
||||
@param msg: message
|
||||
@type msg: xu message
|
||||
"""
|
||||
val = unpackMsg('blkif_be_vbd_create_t', msg)
|
||||
d = self.send_be_vbd_grow()
|
||||
d.addCallback(self.respond_be_vbd_grow)
|
||||
return d
|
||||
|
||||
def send_be_vbd_grow(self):
|
||||
d = defer.Deferred()
|
||||
backend = self.getBackendInterface()
|
||||
msg = packMsg('blkif_be_vbd_grow_t',
|
||||
{ 'domid' : self.controller.dom,
|
||||
'blkif_handle' : backend.handle,
|
||||
'vdevice' : self.vdev,
|
||||
'extent.device' : self.device,
|
||||
'extent.sector_start' : self.start_sector,
|
||||
'extent.sector_length' : self.nr_sectors })
|
||||
backend.writeRequest(msg, response=d)
|
||||
return d
|
||||
|
||||
def respond_be_vbd_grow(self, msg):
|
||||
"""Response handler for a be_vbd_grow message.
|
||||
|
||||
@param msg: message
|
||||
@type msg: xu message
|
||||
"""
|
||||
val = unpackMsg('blkif_be_vbd_grow_t', msg)
|
||||
status = val['status']
|
||||
if status != BLKIF_BE_STATUS_OKAY:
|
||||
raise XendError("Adding extent to vbd failed: device %s, error %d"
|
||||
raise XendError("Creating vbd failed: device %s, error %d"
|
||||
% (sxp.to_string(self.config), status))
|
||||
return self
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ CMSG_BLKIF_BE_CONNECT = 2
|
||||
CMSG_BLKIF_BE_DISCONNECT = 3
|
||||
CMSG_BLKIF_BE_VBD_CREATE = 4
|
||||
CMSG_BLKIF_BE_VBD_DESTROY = 5
|
||||
CMSG_BLKIF_BE_VBD_GROW = 6
|
||||
CMSG_BLKIF_BE_VBD_SHRINK = 7
|
||||
CMSG_BLKIF_BE_DRIVER_STATUS = 32
|
||||
|
||||
BLKIF_DRIVER_STATUS_DOWN = 0
|
||||
@@ -61,7 +59,7 @@ BLKIF_BE_STATUS_INTERFACE_CONNECTED = 4
|
||||
BLKIF_BE_STATUS_VBD_EXISTS = 5
|
||||
BLKIF_BE_STATUS_VBD_NOT_FOUND = 6
|
||||
BLKIF_BE_STATUS_OUT_OF_MEMORY = 7
|
||||
BLKIF_BE_STATUS_EXTENT_NOT_FOUND = 8
|
||||
BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND = 8
|
||||
BLKIF_BE_STATUS_MAPPING_ERROR = 9
|
||||
|
||||
blkif_formats = {
|
||||
@@ -86,11 +84,6 @@ blkif_formats = {
|
||||
(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE),
|
||||
# Create a vbd device.
|
||||
|
||||
'blkif_be_vbd_grow_t':
|
||||
(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW),
|
||||
# Change the size of a vbd device. Remove?
|
||||
# Do in one go in blkif_be_vbd_create_t.
|
||||
|
||||
'blkif_be_vbd_destroy_t':
|
||||
(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_DESTROY),
|
||||
# Destroy a vbd.
|
||||
|
||||