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 /include | |
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 'include')
-rw-r--r-- | include/linux/fs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 1a033e8ebe4c..f48501563917 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2006,8 +2006,6 @@ extern struct block_device *bdgrab(struct block_device *bdev); | |||
2006 | extern void bd_set_size(struct block_device *, loff_t size); | 2006 | extern void bd_set_size(struct block_device *, loff_t size); |
2007 | extern void bd_forget(struct inode *inode); | 2007 | extern void bd_forget(struct inode *inode); |
2008 | extern void bdput(struct block_device *); | 2008 | extern void bdput(struct block_device *); |
2009 | extern struct block_device *open_by_devnum(dev_t dev, fmode_t mode, | ||
2010 | void *holder); | ||
2011 | extern void invalidate_bdev(struct block_device *); | 2009 | extern void invalidate_bdev(struct block_device *); |
2012 | extern int sync_blockdev(struct block_device *bdev); | 2010 | extern int sync_blockdev(struct block_device *bdev); |
2013 | extern struct super_block *freeze_bdev(struct block_device *); | 2011 | extern struct super_block *freeze_bdev(struct block_device *); |
@@ -2039,6 +2037,10 @@ extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | |||
2039 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | 2037 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
2040 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 2038 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
2041 | extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); | 2039 | extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); |
2040 | extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, | ||
2041 | void *holder); | ||
2042 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, | ||
2043 | void *holder); | ||
2042 | extern int blkdev_put(struct block_device *bdev, fmode_t mode); | 2044 | extern int blkdev_put(struct block_device *bdev, fmode_t mode); |
2043 | #ifdef CONFIG_SYSFS | 2045 | #ifdef CONFIG_SYSFS |
2044 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); | 2046 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
@@ -2083,7 +2085,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) | |||
2083 | extern const char *__bdevname(dev_t, char *buffer); | 2085 | extern const char *__bdevname(dev_t, char *buffer); |
2084 | extern const char *bdevname(struct block_device *bdev, char *buffer); | 2086 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
2085 | extern struct block_device *lookup_bdev(const char *); | 2087 | extern struct block_device *lookup_bdev(const char *); |
2086 | extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *); | ||
2087 | extern void blkdev_show(struct seq_file *,off_t); | 2088 | extern void blkdev_show(struct seq_file *,off_t); |
2088 | 2089 | ||
2089 | #else | 2090 | #else |