Skip to content

Commit

Permalink
[PATCH] clean up blkdev_get a little bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Dec 4, 2008
1 parent 1c92560 commit ebbefc0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ebbefc0

Please sign in to comment.