WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [BLKBACK] Output statistics to sysfs.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [BLKBACK] Output statistics to sysfs.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Jun 2006 13:50:22 +0000
Delivery-date: Wed, 28 Jun 2006 06:53:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID b217e03e1db5bcde98fb15ca9d5df303ea067bc4
# Parent  7a7066ae2e778036c5db84c5ffe35d8206b6edb6
[BLKBACK] Output statistics to sysfs.

The location is 'statistics' directory under each VBD directory, for
example, /sys/devices/xen-backend/vbd-x-xxxx/statistics.

The 'statistics' directory includes the following three statistical
information:
  oo_req
       is the number of requests held up due to full pipeline.
  rd_req
       is the number of processed READ requests.
  wr_req
       is the number of processed WRITE requests.

Signed-off-by: Satoshi UCHIDA <s-uchida@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c |   67 +++++++++++++++++++++-
 1 files changed, 66 insertions(+), 1 deletion(-)

diff -r 7a7066ae2e77 -r b217e03e1db5 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Jun 28 10:24:05 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Jun 28 10:32:43 
2006 +0100
@@ -42,7 +42,6 @@ static int connect_ring(struct backend_i
 static int connect_ring(struct backend_info *);
 static void backend_changed(struct xenbus_watch *, const char **,
                            unsigned int);
-
 
 static void update_blkif_status(blkif_t *blkif)
 { 
@@ -73,6 +72,70 @@ static void update_blkif_status(blkif_t 
 }
 
 
+/****************************************************************
+ *  sysfs interface for VBD I/O requests
+ */
+
+#ifdef CONFIG_SYSFS
+
+#define VBD_SHOW(name, format, args...)                                        
\
+       static ssize_t show_##name(struct device *_dev,                 \
+                                  struct device_attribute *attr,       \
+                                  char *buf)                           \
+       {                                                               \
+               struct xenbus_device *dev = to_xenbus_device(_dev);     \
+               struct backend_info *be = dev->dev.driver_data;         \
+                                                                       \
+               return sprintf(buf, format, ##args);                    \
+       }                                                               \
+       DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
+
+VBD_SHOW(oo_req, "%d\n", be->blkif->st_oo_req);
+VBD_SHOW(rd_req, "%d\n", be->blkif->st_rd_req);
+VBD_SHOW(wr_req, "%d\n", be->blkif->st_wr_req);
+
+static struct attribute *vbdstat_attrs[] = {
+       &dev_attr_oo_req.attr,
+       &dev_attr_rd_req.attr,
+       &dev_attr_wr_req.attr,
+       NULL
+};
+
+static struct attribute_group vbdstat_group = {
+       .name = "statistics",
+       .attrs = vbdstat_attrs,
+};
+
+int xenvbd_sysfs_addif(struct xenbus_device *dev)
+{
+       int error = 0;
+       
+       error = sysfs_create_group(&dev->dev.kobj,
+                                  &vbdstat_group);
+       if (error)
+               goto fail;
+       
+       return 0;
+       
+fail:
+       sysfs_remove_group(&dev->dev.kobj,
+                          &vbdstat_group);
+       return error;
+}
+
+void xenvbd_sysfs_delif(struct xenbus_device *dev)
+{
+       sysfs_remove_group(&dev->dev.kobj,
+                          &vbdstat_group);
+}
+
+#else
+
+#define xenvbd_sysfs_addif(dev) (0)
+#define xenvbd_sysfs_delif(dev) ((void)0)
+
+#endif /* CONFIG_SYSFS */
+
 static ssize_t show_physical_device(struct device *_dev,
                                    struct device_attribute *attr, char *buf)
 {
@@ -115,6 +178,7 @@ static int blkback_remove(struct xenbus_
 
        device_remove_file(&dev->dev, &dev_attr_physical_device);
        device_remove_file(&dev->dev, &dev_attr_mode);
+       xenvbd_sysfs_delif(dev);
 
        kfree(be);
        dev->dev.driver_data = NULL;
@@ -237,6 +301,7 @@ static void backend_changed(struct xenbu
 
                device_create_file(&dev->dev, &dev_attr_physical_device);
                device_create_file(&dev->dev, &dev_attr_mode);
+               xenvbd_sysfs_addif(dev);
 
                /* We're potentially connected now */
                update_blkif_status(be->blkif); 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [BLKBACK] Output statistics to sysfs., Xen patchbot-unstable <=