[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 15/16] blkfront: Remove obsolete info->users



From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

This is just bd_openers, protected by the bd_mutex.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
 drivers/block/xen-blkfront.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 96ff225..2c8de1b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -95,12 +95,6 @@ struct blkfront_info
        unsigned long shadow_free;
        int feature_barrier;
        int is_ready;
-
-       /**
-        * The number of people holding this device open.  We won't allow a
-        * hot-unplug unless this is 0.
-        */
-       int users;
 };
 
 static DEFINE_SPINLOCK(blkif_io_lock);
@@ -977,7 +971,7 @@ blkfront_closing(struct blkfront_info *info)
 
        mutex_lock(&bdev->bd_mutex);
 
-       if (info->users) {
+       if (bdev->bd_openers) {
                xenbus_dev_error(xbdev, -EBUSY,
                                 "Device in use; refusing to close");
                xenbus_switch_state(xbdev, XenbusStateClosing);
@@ -1126,7 +1120,7 @@ static int blkfront_remove(struct xenbus_device *xbdev)
        mutex_lock(&bdev->bd_mutex);
        info = disk->private_data;
 
-       if (info && !info->users) {
+       if (info && !bdev->bd_openers) {
                xlvbd_release_gendisk(info);
                disk->private_data = NULL;
                kfree(info);
@@ -1164,9 +1158,6 @@ static int blkif_open(struct block_device *bdev, fmode_t 
mode)
 
        mutex_unlock(&info->mutex);
 
-       if (!err)
-               ++info->users;
-
        return err;
 }
 
@@ -1176,12 +1167,12 @@ static int blkif_release(struct gendisk *disk, fmode_t 
mode)
        struct block_device *bdev;
        struct xenbus_device *xbdev;
 
-       if (--info->users)
-               return 0;
-
        bdev = bdget_disk(disk, 0);
        bdput(bdev);
 
+       if (bdev->bd_openers)
+               return 0;
+
        /*
         * Check if we have been instructed to close. We will have
         * deferred this request, because the bdev was still open.
-- 
1.7.1.1


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.