[PATCH] clean up blkdev_get a little bit
authorChristoph Hellwig <hch@lst.de>
Wed, 5 Nov 2008 13:54:41 +0000 (14:54 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 4 Dec 2008 09:22:56 +0000 (04:22 -0500)
The way the bd_claim for the FMODE_EXCL case is implemented is rather
confusing.  Clean it up to the most logical style.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/block_dev.c

index db831efbdbbdcc0d2b1298af4e3055916357fee2..7c727523bc54a62bf6f7aa3c90a8bc7fe93b24f0 100644 (file)
@@ -1135,12 +1135,15 @@ static int blkdev_open(struct inode * inode, struct file * filp)
        if (res)
                return res;
 
-       if (!(filp->f_mode & FMODE_EXCL))
-               return 0;
+       if (filp->f_mode & FMODE_EXCL) {
+               res = bd_claim(bdev, filp);
+               if (res)
+                       goto out_blkdev_put;
+       }
 
-       if (!(res = bd_claim(bdev, filp)))
-               return 0;
+       return 0;
 
+ out_blkdev_put:
        blkdev_put(bdev, filp->f_mode);
        return res;
 }