Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-2.6-microblaze.git] / drivers / block / rbd.c
index e77eaab..59cfe71 100644 (file)
@@ -692,12 +692,9 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
        put_device(&rbd_dev->dev);
 }
 
-static int rbd_ioctl_set_ro(struct rbd_device *rbd_dev, unsigned long arg)
+static int rbd_set_read_only(struct block_device *bdev, bool ro)
 {
-       int ro;
-
-       if (get_user(ro, (int __user *)arg))
-               return -EFAULT;
+       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
 
        /*
         * Both images mapped read-only and snapshots can't be marked
@@ -710,43 +707,14 @@ static int rbd_ioctl_set_ro(struct rbd_device *rbd_dev, unsigned long arg)
                rbd_assert(!rbd_is_snap(rbd_dev));
        }
 
-       /* Let blkdev_roset() handle it */
-       return -ENOTTY;
-}
-
-static int rbd_ioctl(struct block_device *bdev, fmode_t mode,
-                       unsigned int cmd, unsigned long arg)
-{
-       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
-       int ret;
-
-       switch (cmd) {
-       case BLKROSET:
-               ret = rbd_ioctl_set_ro(rbd_dev, arg);
-               break;
-       default:
-               ret = -ENOTTY;
-       }
-
-       return ret;
-}
-
-#ifdef CONFIG_COMPAT
-static int rbd_compat_ioctl(struct block_device *bdev, fmode_t mode,
-                               unsigned int cmd, unsigned long arg)
-{
-       return rbd_ioctl(bdev, mode, cmd, arg);
+       return 0;
 }
-#endif /* CONFIG_COMPAT */
 
 static const struct block_device_operations rbd_bd_ops = {
        .owner                  = THIS_MODULE,
        .open                   = rbd_open,
        .release                = rbd_release,
-       .ioctl                  = rbd_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl           = rbd_compat_ioctl,
-#endif
+       .set_read_only          = rbd_set_read_only,
 };
 
 /*
@@ -3957,8 +3925,12 @@ static int find_watcher(struct rbd_device *rbd_dev,
 
        sscanf(locker->id.cookie, RBD_LOCK_COOKIE_PREFIX " %llu", &cookie);
        for (i = 0; i < num_watchers; i++) {
-               if (!memcmp(&watchers[i].addr, &locker->info.addr,
-                           sizeof(locker->info.addr)) &&
+               /*
+                * Ignore addr->type while comparing.  This mimics
+                * entity_addr_t::get_legacy_str() + strcmp().
+                */
+               if (ceph_addr_equal_no_type(&watchers[i].addr,
+                                           &locker->info.addr) &&
                    watchers[i].cookie == cookie) {
                        struct rbd_client_id cid = {
                                .gid = le64_to_cpu(watchers[i].name.num),
@@ -4010,10 +3982,10 @@ static int rbd_try_lock(struct rbd_device *rbd_dev)
                rbd_warn(rbd_dev, "breaking header lock owned by %s%llu",
                         ENTITY_NAME(lockers[0].id.name));
 
-               ret = ceph_monc_blacklist_add(&client->monc,
+               ret = ceph_monc_blocklist_add(&client->monc,
                                              &lockers[0].info.addr);
                if (ret) {
-                       rbd_warn(rbd_dev, "blacklist of %s%llu failed: %d",
+                       rbd_warn(rbd_dev, "blocklist of %s%llu failed: %d",
                                 ENTITY_NAME(lockers[0].id.name), ret);
                        goto out;
                }
@@ -4077,7 +4049,7 @@ static int rbd_try_acquire_lock(struct rbd_device *rbd_dev)
        ret = rbd_try_lock(rbd_dev);
        if (ret < 0) {
                rbd_warn(rbd_dev, "failed to lock header: %d", ret);
-               if (ret == -EBLACKLISTED)
+               if (ret == -EBLOCKLISTED)
                        goto out;
 
                ret = 1; /* request lock anyway */
@@ -4613,7 +4585,7 @@ static void rbd_reregister_watch(struct work_struct *work)
        ret = __rbd_register_watch(rbd_dev);
        if (ret) {
                rbd_warn(rbd_dev, "failed to reregister watch: %d", ret);
-               if (ret != -EBLACKLISTED && ret != -ENOENT) {
+               if (ret != -EBLOCKLISTED && ret != -ENOENT) {
                        queue_delayed_work(rbd_dev->task_wq,
                                           &rbd_dev->watch_dwork,
                                           RBD_RETRY_DELAY);
@@ -4920,8 +4892,7 @@ static void rbd_dev_update_size(struct rbd_device *rbd_dev)
            !test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
                size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE;
                dout("setting size to %llu sectors", (unsigned long long)size);
-               set_capacity(rbd_dev->disk, size);
-               revalidate_disk(rbd_dev->disk);
+               set_capacity_and_notify(rbd_dev->disk, size);
        }
 }
 
@@ -5022,7 +4993,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
        }
 
        if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC))
-               q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;
+               blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, q);
 
        /*
         * disk_release() expects a queue ref from add_disk() and will