aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-11-05 08:54:41 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-12-04 04:22:56 -0500
commitebbefc011e56bd85b4745d01e5b8d7d05d95ed5d (patch)
tree72fbb3af072efa57f4d0562b3be512edf280fcf7 /fs/block_dev.c
parent1c925604e1038c7c65b91a92d14dc972b3a70a97 (diff)
[PATCH] clean up blkdev_get a little bit
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>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index db831efbdbbd..7c727523bc54 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1135,12 +1135,15 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1135 if (res) 1135 if (res)
1136 return res; 1136 return res;
1137 1137
1138 if (!(filp->f_mode & FMODE_EXCL)) 1138 if (filp->f_mode & FMODE_EXCL) {
1139 return 0; 1139 res = bd_claim(bdev, filp);
1140 if (res)
1141 goto out_blkdev_put;
1142 }
1140 1143
1141 if (!(res = bd_claim(bdev, filp))) 1144 return 0;
1142 return 0;
1143 1145
1146 out_blkdev_put:
1144 blkdev_put(bdev, filp->f_mode); 1147 blkdev_put(bdev, filp->f_mode);
1145 return res; 1148 return res;
1146} 1149}