compat_ioctl: move common block ioctls to compat_blkdev_ioctl
[firefly-linux-kernel-4.4.55.git] / fs / block_dev.c
index 75c47a21b2f0507968cbcf0921fc918906fe3e68..6339a30879b72bedd833f9329b602cf2e3337698 100644 (file)
@@ -172,7 +172,7 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 }
 
 #if 0
-static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error)
+static void blk_end_aio(struct bio *bio, int error)
 {
        struct kiocb *iocb = bio->bi_private;
        atomic_t *bio_count = &iocb->ki_bio_count;
@@ -517,7 +517,7 @@ void __init bdev_cache_init(void)
        bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
                        0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
                                SLAB_MEM_SPREAD|SLAB_PANIC),
-                       init_once, NULL);
+                       init_once);
        err = register_filesystem(&bd_type);
        if (err)
                panic("Cannot register bdev pseudo-fs");
@@ -963,20 +963,20 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
 
        err = bd_claim(bdev, holder);
        if (err)
-               goto out;
+               goto fail;
 
        found = find_bd_holder(bdev, bo);
        if (found)
-               goto out;
+               goto fail;
 
        err = add_bd_holder(bdev, bo);
        if (err)
                bd_release(bdev);
-
-out:
-       if (err || found)
-               free_bd_holder(bo);
+       else
+               bo = NULL;
+fail:
        mutex_unlock(&bdev->bd_mutex);
+       free_bd_holder(bo);
        return err;
 }
 
@@ -991,15 +991,12 @@ out:
 static void bd_release_from_kobject(struct block_device *bdev,
                                        struct kobject *kobj)
 {
-       struct bd_holder *bo;
-
        if (!kobj)
                return;
 
        mutex_lock(&bdev->bd_mutex);
        bd_release(bdev);
-       if ((bo = del_bd_holder(bdev, kobj)))
-               free_bd_holder(bo);
+       free_bd_holder(del_bd_holder(bdev, kobj));
        mutex_unlock(&bdev->bd_mutex);
 }