diff options
author | Tejun Heo <tj@kernel.org> | 2010-11-13 05:55:18 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-11-13 05:55:18 -0500 |
commit | d4d77629953eabd3c14f6fa5746f6b28babfc55f (patch) | |
tree | 38cce0d4764ecb34a9f7f49332959780e28bb786 /fs/nilfs2/super.c | |
parent | 75f1dc0d076d1c1168f2115f1941ea627d38bd5a (diff) |
block: clean up blkdev_get() wrappers and their users
After recent blkdev_get() modifications, open_by_devnum() and
open_bdev_exclusive() are simple wrappers around blkdev_get().
Replace them with blkdev_get_by_dev() and blkdev_get_by_path().
blkdev_get_by_dev() is identical to open_by_devnum().
blkdev_get_by_path() is slightly different in that it doesn't
automatically add %FMODE_EXCL to @mode.
All users are converted. Most conversions are mechanical and don't
introduce any behavior difference. There are several exceptions.
* btrfs now sets FMODE_EXCL in btrfs_device->mode, so there's no
reason to OR it explicitly on blkdev_put().
* gfs2, nilfs2 and the generic mount_bdev() now set FMODE_EXCL in
sb->s_mode.
* With the above changes, sb->s_mode now always should contain
FMODE_EXCL. WARN_ON_ONCE() added to kill_block_super() to detect
errors.
The new blkdev_get_*() functions are with proper docbook comments.
While at it, add function description to blkdev_get() too.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Joern Engel <joern@lazybastard.org>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Jan Kara <jack@suse.cz>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
Cc: reiserfs-devel@vger.kernel.org
Cc: xfs-masters@oss.sgi.com
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r-- | fs/nilfs2/super.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 756a6798d7c..0030640e2d7 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1147,14 +1147,14 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1147 | { | 1147 | { |
1148 | struct nilfs_super_data sd; | 1148 | struct nilfs_super_data sd; |
1149 | struct super_block *s; | 1149 | struct super_block *s; |
1150 | fmode_t mode = FMODE_READ; | 1150 | fmode_t mode = FMODE_READ | FMODE_EXCL; |
1151 | struct dentry *root_dentry; | 1151 | struct dentry *root_dentry; |
1152 | int err, s_new = false; | 1152 | int err, s_new = false; |
1153 | 1153 | ||
1154 | if (!(flags & MS_RDONLY)) | 1154 | if (!(flags & MS_RDONLY)) |
1155 | mode |= FMODE_WRITE; | 1155 | mode |= FMODE_WRITE; |
1156 | 1156 | ||
1157 | sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type); | 1157 | sd.bdev = blkdev_get_by_path(dev_name, mode, fs_type); |
1158 | if (IS_ERR(sd.bdev)) | 1158 | if (IS_ERR(sd.bdev)) |
1159 | return ERR_CAST(sd.bdev); | 1159 | return ERR_CAST(sd.bdev); |
1160 | 1160 | ||
@@ -1233,7 +1233,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | if (!s_new) | 1235 | if (!s_new) |
1236 | blkdev_put(sd.bdev, mode | FMODE_EXCL); | 1236 | blkdev_put(sd.bdev, mode); |
1237 | 1237 | ||
1238 | return root_dentry; | 1238 | return root_dentry; |
1239 | 1239 | ||
@@ -1242,7 +1242,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1242 | 1242 | ||
1243 | failed: | 1243 | failed: |
1244 | if (!s_new) | 1244 | if (!s_new) |
1245 | blkdev_put(sd.bdev, mode | FMODE_EXCL); | 1245 | blkdev_put(sd.bdev, mode); |
1246 | return ERR_PTR(err); | 1246 | return ERR_PTR(err); |
1247 | } | 1247 | } |
1248 | 1248 | ||