Commit b23c4682 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Remove BDEV_RAW and friends

These no longer do anything.

This patch changes modules API.  It was acked by Arjan@RH and Hubert@Suse.
parent 80c085f9
......@@ -305,7 +305,7 @@ static void __exit rd_cleanup (void)
rd_bdev[i] = NULL;
if (bdev) {
invalidate_bdev(bdev, 1);
blkdev_put(bdev, BDEV_FILE);
blkdev_put(bdev);
}
del_gendisk(rd_disks[i]);
put_disk(rd_disks[i]);
......
......@@ -60,7 +60,7 @@ static int raw_open(struct inode *inode, struct file *filp)
if (!bdev)
goto out;
igrab(bdev->bd_inode);
err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
err = blkdev_get(bdev, filp->f_mode, 0);
if (err)
goto out;
err = bd_claim(bdev, raw_open);
......@@ -81,7 +81,7 @@ static int raw_open(struct inode *inode, struct file *filp)
out2:
bd_release(bdev);
out1:
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
out:
up(&raw_mutex);
return err;
......@@ -106,7 +106,7 @@ static int raw_release(struct inode *inode, struct file *filp)
up(&raw_mutex);
bd_release(bdev);
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
return 0;
}
......
......@@ -353,12 +353,12 @@ static int open_dev(struct dm_dev *d, dev_t dev)
if (d->bdev)
BUG();
bdev = open_by_devnum(dev, d->mode, BDEV_RAW);
bdev = open_by_devnum(dev, d->mode);
if (IS_ERR(bdev))
return PTR_ERR(bdev);
r = bd_claim(bdev, _claim_ptr);
if (r)
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
else
d->bdev = bdev;
return r;
......@@ -373,7 +373,7 @@ static void close_dev(struct dm_dev *d)
return;
bd_release(d->bdev);
blkdev_put(d->bdev, BDEV_RAW);
blkdev_put(d->bdev);
d->bdev = NULL;
}
......
......@@ -1045,12 +1045,12 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev)
int err = 0;
struct block_device *bdev;
bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE, BDEV_RAW);
bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
if (IS_ERR(bdev))
return PTR_ERR(bdev);
err = bd_claim(bdev, rdev);
if (err) {
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
return err;
}
rdev->bdev = bdev;
......@@ -1064,7 +1064,7 @@ static void unlock_rdev(mdk_rdev_t *rdev)
if (!bdev)
MD_BUG();
bd_release(bdev);
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
}
void md_autodetect_dev(dev_t dev);
......
......@@ -550,7 +550,7 @@ static void free_device(struct blkmtd_dev *dev)
if(dev->blkdev) {
invalidate_inode_pages(dev->blkdev->bd_inode->i_mapping);
close_bdev_excl(dev->blkdev, BDEV_RAW);
close_bdev_excl(dev->blkdev);
}
kfree(dev);
}
......@@ -637,10 +637,10 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
#ifdef MODULE
mode = (readonly) ? O_RDONLY : O_RDWR;
bdev = open_bdev_excl(devname, mode, BDEV_RAW, NULL);
bdev = open_bdev_excl(devname, mode, NULL);
#else
mode = (readonly) ? FMODE_READ : FMODE_WRITE;
bdev = open_by_devnum(name_to_dev_t(devname), mode, BDEV_RAW);
bdev = open_by_devnum(name_to_dev_t(devname), mode);
#endif
if(IS_ERR(bdev)) {
err("error: cannot open device %s", devname);
......@@ -653,13 +653,13 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
if(MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
err("attempting to use an MTD device as a block device");
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
return NULL;
}
dev = kmalloc(sizeof(struct blkmtd_dev), GFP_KERNEL);
if(dev == NULL) {
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
return NULL;
}
......
......@@ -85,10 +85,10 @@ dasd_scan_partitions(struct dasd_device * device)
/* See fs/partition/check.c:register_disk,rescan_partitions */
bdev = bdget_disk(device->gdp, 0);
if (bdev) {
if (blkdev_get(bdev, FMODE_READ, 1, BDEV_RAW) >= 0) {
if (blkdev_get(bdev, FMODE_READ, 1) >= 0) {
/* Can't call rescan_partitions directly. Use ioctl. */
ioctl_by_bdev(bdev, BLKRRPART, 0);
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
}
}
}
......
......@@ -479,13 +479,13 @@ EXPORT_SYMBOL(bd_release);
* to be used for internal purposes. If you ever need it - reconsider
* your API.
*/
struct block_device *open_by_devnum(dev_t dev, unsigned mode, int kind)
struct block_device *open_by_devnum(dev_t dev, unsigned mode)
{
struct block_device *bdev = bdget(dev);
int err = -ENOMEM;
int flags = mode & FMODE_WRITE ? O_RDWR : O_RDONLY;
if (bdev)
err = blkdev_get(bdev, mode, flags, kind);
err = blkdev_get(bdev, mode, flags);
return err ? ERR_PTR(err) : bdev;
}
......@@ -579,7 +579,7 @@ static int do_open(struct block_device *bdev, struct file *file)
ret = -ENOMEM;
if (!whole)
goto out_first;
ret = blkdev_get(whole, file->f_mode, file->f_flags, BDEV_RAW);
ret = blkdev_get(whole, file->f_mode, file->f_flags);
if (ret)
goto out_first;
bdev->bd_contains = whole;
......@@ -625,7 +625,7 @@ static int do_open(struct block_device *bdev, struct file *file)
bdev->bd_disk = NULL;
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
if (bdev != bdev->bd_contains)
blkdev_put(bdev->bd_contains, BDEV_RAW);
blkdev_put(bdev->bd_contains);
bdev->bd_contains = NULL;
put_disk(disk);
module_put(owner);
......@@ -637,7 +637,7 @@ static int do_open(struct block_device *bdev, struct file *file)
return ret;
}
int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, int kind)
int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
{
/*
* This crockload is due to bad choice of ->open() type.
......@@ -682,13 +682,13 @@ int blkdev_open(struct inode * inode, struct file * filp)
if (!(res = bd_claim(bdev, filp)))
return 0;
blkdev_put(bdev, BDEV_FILE);
blkdev_put(bdev);
return res;
}
EXPORT_SYMBOL(blkdev_open);
int blkdev_put(struct block_device *bdev, int kind)
int blkdev_put(struct block_device *bdev)
{
int ret = 0;
struct inode *bd_inode = bdev->bd_inode;
......@@ -721,7 +721,7 @@ int blkdev_put(struct block_device *bdev, int kind)
bdev->bd_disk = NULL;
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
if (bdev != bdev->bd_contains) {
blkdev_put(bdev->bd_contains, BDEV_RAW);
blkdev_put(bdev->bd_contains);
}
bdev->bd_contains = NULL;
}
......@@ -738,7 +738,7 @@ static int blkdev_close(struct inode * inode, struct file * filp)
struct block_device *bdev = I_BDEV(filp->f_mapping->host);
if (bdev->bd_holder == filp)
bd_release(bdev);
return blkdev_put(bdev, BDEV_FILE);
return blkdev_put(bdev);
}
static ssize_t blkdev_file_write(struct file *file, const char __user *buf,
......@@ -850,14 +850,12 @@ struct block_device *lookup_bdev(const char *path)
*
* @path: special file representing the block device
* @flags: %MS_RDONLY for opening read-only
* @kind: usage (same as the 4th paramter to blkdev_get)
* @holder: owner for exclusion
*
* Open the blockdevice described by the special file at @path, claim it
* for the @holder and properly set it up for @kind usage.
* for the @holder.
*/
struct block_device *open_bdev_excl(const char *path, int flags,
int kind, void *holder)
struct block_device *open_bdev_excl(const char *path, int flags, void *holder)
{
struct block_device *bdev;
mode_t mode = FMODE_READ;
......@@ -869,7 +867,7 @@ struct block_device *open_bdev_excl(const char *path, int flags,
if (!(flags & MS_RDONLY))
mode |= FMODE_WRITE;
error = blkdev_get(bdev, mode, 0, kind);
error = blkdev_get(bdev, mode, 0);
if (error)
return ERR_PTR(error);
error = -EACCES;
......@@ -882,7 +880,7 @@ struct block_device *open_bdev_excl(const char *path, int flags,
return bdev;
blkdev_put:
blkdev_put(bdev, BDEV_FS);
blkdev_put(bdev);
return ERR_PTR(error);
}
......@@ -892,14 +890,13 @@ EXPORT_SYMBOL(open_bdev_excl);
* close_bdev_excl - release a blockdevice openen by open_bdev_excl()
*
* @bdev: blockdevice to close
* @kind: usage (same as the 4th paramter to blkdev_get)
*
* This is the counterpart to open_bdev_excl().
*/
void close_bdev_excl(struct block_device *bdev, int kind)
void close_bdev_excl(struct block_device *bdev)
{
bd_release(bdev);
blkdev_put(bdev, kind);
blkdev_put(bdev);
}
EXPORT_SYMBOL(close_bdev_excl);
......@@ -325,7 +325,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
struct block_device *bdev;
char b[BDEVNAME_SIZE];
bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE, BDEV_FS);
bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
if (IS_ERR(bdev))
goto fail;
return bdev;
......@@ -342,7 +342,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
static int ext3_blkdev_put(struct block_device *bdev)
{
bd_release(bdev);
return blkdev_put(bdev, BDEV_FS);
return blkdev_put(bdev);
}
static int ext3_blkdev_remove(struct ext3_sb_info *sbi)
......@@ -1487,7 +1487,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
if (bd_claim(bdev, sb)) {
printk(KERN_ERR
"EXT3: failed to claim external journal device.\n");
blkdev_put(bdev, BDEV_FS);
blkdev_put(bdev);
return NULL;
}
......
......@@ -1105,8 +1105,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
*/
externalLog:
bdev = open_by_devnum(JFS_SBI(sb)->logdev,
FMODE_READ|FMODE_WRITE, BDEV_FS);
bdev = open_by_devnum(JFS_SBI(sb)->logdev, FMODE_READ|FMODE_WRITE);
if (IS_ERR(bdev)) {
rc = -PTR_ERR(bdev);
goto free;
......@@ -1145,7 +1144,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
bd_release(bdev);
close: /* close external log device */
blkdev_put(bdev, BDEV_FS);
blkdev_put(bdev);
free: /* free log descriptor */
kfree(log);
......@@ -1392,7 +1391,7 @@ int lmLogClose(struct super_block *sb, struct jfs_log * log)
rc = lmLogShutdown(log);
bd_release(bdev);
blkdev_put(bdev, BDEV_FS);
blkdev_put(bdev);
out:
jfs_info("lmLogClose: exit(%d)", rc);
......
......@@ -367,7 +367,7 @@ void register_disk(struct gendisk *disk)
return;
bdev = bdget_disk(disk, 0);
if (blkdev_get(bdev, FMODE_READ, 0, BDEV_RAW) < 0)
if (blkdev_get(bdev, FMODE_READ, 0) < 0)
return;
state = check_partition(disk, bdev);
if (state) {
......@@ -385,7 +385,7 @@ void register_disk(struct gendisk *disk)
}
kfree(state);
}
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
}
int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
......
......@@ -1895,7 +1895,7 @@ static int release_journal_dev( struct super_block *super,
journal -> j_dev_file = NULL;
journal -> j_dev_bd = NULL;
} else if( journal -> j_dev_bd != NULL ) {
result = blkdev_put( journal -> j_dev_bd, BDEV_FS );
result = blkdev_put( journal -> j_dev_bd );
journal -> j_dev_bd = NULL;
}
......@@ -1926,7 +1926,7 @@ static int journal_init_dev( struct super_block *super,
/* there is no "jdev" option and journal is on separate device */
if( ( !jdev_name || !jdev_name[ 0 ] ) ) {
journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode, BDEV_FS);
journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode);
if (IS_ERR(journal->j_dev_bd)) {
result = PTR_ERR(journal->j_dev_bd);
journal->j_dev_bd = NULL;
......
......@@ -596,7 +596,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
struct super_block *s;
int error = 0;
bdev = open_bdev_excl(dev_name, flags, BDEV_FS, fs_type);
bdev = open_bdev_excl(dev_name, flags, fs_type);
if (IS_ERR(bdev))
return (struct super_block *)bdev;
......@@ -630,7 +630,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
return s;
out:
close_bdev_excl(bdev, BDEV_FS);
close_bdev_excl(bdev);
return s;
}
......@@ -641,7 +641,7 @@ void kill_block_super(struct super_block *sb)
struct block_device *bdev = sb->s_bdev;
generic_shutdown_super(sb);
set_blocksize(bdev, sb->s_old_blocksize);
close_bdev_excl(bdev, BDEV_FS);
close_bdev_excl(bdev);
}
EXPORT_SYMBOL(kill_block_super);
......
......@@ -266,7 +266,7 @@ xfs_blkdev_get(
{
int error = 0;
*bdevp = open_bdev_excl(name, 0, BDEV_FS, mp);
*bdevp = open_bdev_excl(name, 0, mp);
if (IS_ERR(*bdevp)) {
error = PTR_ERR(*bdevp);
printk("XFS: Invalid device [%s], error=%d\n", name, error);
......@@ -280,7 +280,7 @@ xfs_blkdev_put(
struct block_device *bdev)
{
if (bdev)
close_bdev_excl(bdev, BDEV_FS);
close_bdev_excl(bdev);
}
void
......
......@@ -1132,14 +1132,13 @@ extern void vfs_caches_init(unsigned long);
#define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL)
#define putname(name) kmem_cache_free(names_cachep, (void *)(name))
enum {BDEV_FILE, BDEV_SWAP, BDEV_FS, BDEV_RAW};
extern int register_blkdev(unsigned int, const char *);
extern int unregister_blkdev(unsigned int, const char *);
extern struct block_device *bdget(dev_t);
extern void bd_forget(struct inode *inode);
extern void bdput(struct block_device *);
extern int blkdev_open(struct inode *, struct file *);
extern struct block_device *open_by_devnum(dev_t, unsigned, int);
extern struct block_device *open_by_devnum(dev_t, unsigned);
extern struct file_operations def_blk_fops;
extern struct address_space_operations def_blk_aops;
extern struct file_operations def_chr_fops;
......@@ -1147,8 +1146,8 @@ extern struct file_operations bad_sock_fops;
extern struct file_operations def_fifo_fops;
extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
extern int blkdev_get(struct block_device *, mode_t, unsigned, int);
extern int blkdev_put(struct block_device *, int);
extern int blkdev_get(struct block_device *, mode_t, unsigned);
extern int blkdev_put(struct block_device *);
extern int bd_claim(struct block_device *, void *);
extern void bd_release(struct block_device *);
extern void blk_run_queues(void);
......@@ -1167,8 +1166,8 @@ extern int chrdev_open(struct inode *, struct file *);
extern const char *__bdevname(dev_t, char *buffer);
extern const char *bdevname(struct block_device *bdev, char *buffer);
extern struct block_device *lookup_bdev(const char *);
extern struct block_device *open_bdev_excl(const char *, int, int, void *);
extern void close_bdev_excl(struct block_device *, int);
extern struct block_device *open_bdev_excl(const char *, int, void *);
extern void close_bdev_excl(struct block_device *);
extern void init_special_inode(struct inode *, umode_t, dev_t);
......
......@@ -1121,11 +1121,11 @@ int __init pmdisk_read(void)
resume_device = name_to_dev_t(resume_file);
pr_debug("pmdisk: Resume From Partition: %s\n", resume_file);
resume_bdev = open_by_devnum(resume_device, FMODE_READ, BDEV_RAW);
resume_bdev = open_by_devnum(resume_device, FMODE_READ);
if (!IS_ERR(resume_bdev)) {
set_blocksize(resume_bdev, PAGE_SIZE);
error = read_suspend_image();
blkdev_put(resume_bdev, BDEV_RAW);
blkdev_put(resume_bdev);
} else
error = PTR_ERR(resume_bdev);
......
......@@ -997,13 +997,13 @@ static int read_suspend_image(const char * specialfile, int noresume)
struct block_device *bdev;
printk("Resuming from device %s\n",
__bdevname(resume_device, b));
bdev = open_by_devnum(resume_device, FMODE_READ, BDEV_RAW);
bdev = open_by_devnum(resume_device, FMODE_READ);
if (IS_ERR(bdev)) {
error = PTR_ERR(bdev);
} else {
set_blocksize(bdev, PAGE_SIZE);
error = __read_suspend_image(bdev, cur, noresume);
blkdev_put(bdev, BDEV_RAW);
blkdev_put(bdev);
}
} else error = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment