mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
[PATCH] pass fmode_t to blkdev_put()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
511de73ff0
commit
9a1c354276
14 changed files with 38 additions and 38 deletions
|
@ -2381,7 +2381,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
|
|||
out_unclaim:
|
||||
bd_release(pd->bdev);
|
||||
out_putdev:
|
||||
blkdev_put(pd->bdev);
|
||||
blkdev_put(pd->bdev, FMODE_READ);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
@ -2399,7 +2399,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
|
|||
|
||||
pkt_set_speed(pd, MAX_SPEED, MAX_SPEED);
|
||||
bd_release(pd->bdev);
|
||||
blkdev_put(pd->bdev);
|
||||
blkdev_put(pd->bdev, FMODE_READ);
|
||||
|
||||
pkt_shrink_pktlist(pd);
|
||||
}
|
||||
|
@ -2790,7 +2790,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
|
|||
return 0;
|
||||
|
||||
out_mem:
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
/* This is safe: open() is still holding a reference. */
|
||||
module_put(THIS_MODULE);
|
||||
return ret;
|
||||
|
@ -2975,7 +2975,7 @@ static int pkt_remove_dev(dev_t pkt_dev)
|
|||
pkt_debugfs_dev_remove(pd);
|
||||
pkt_sysfs_dev_remove(pd);
|
||||
|
||||
blkdev_put(pd->bdev);
|
||||
blkdev_put(pd->bdev, FMODE_READ|FMODE_WRITE);
|
||||
|
||||
remove_proc_entry(pd->name, pkt_proc);
|
||||
DPRINTK(DRIVER_NAME": writer %s unmapped\n", pd->name);
|
||||
|
|
|
@ -87,7 +87,7 @@ static int raw_open(struct inode *inode, struct file *filp)
|
|||
out2:
|
||||
bd_release(bdev);
|
||||
out1:
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, filp->f_mode);
|
||||
out:
|
||||
mutex_unlock(&raw_mutex);
|
||||
return err;
|
||||
|
@ -112,7 +112,7 @@ static int raw_release(struct inode *inode, struct file *filp)
|
|||
mutex_unlock(&raw_mutex);
|
||||
|
||||
bd_release(bdev);
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, filp->f_mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ static int open_dev(struct dm_dev_internal *d, dev_t dev,
|
|||
return PTR_ERR(bdev);
|
||||
r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md));
|
||||
if (r)
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, d->dm_dev.mode);
|
||||
else
|
||||
d->dm_dev.bdev = bdev;
|
||||
return r;
|
||||
|
@ -372,7 +372,7 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
|
|||
return;
|
||||
|
||||
bd_release_from_disk(d->dm_dev.bdev, dm_disk(md));
|
||||
blkdev_put(d->dm_dev.bdev);
|
||||
blkdev_put(d->dm_dev.bdev, d->dm_dev.mode);
|
||||
d->dm_dev.bdev = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1520,7 +1520,7 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared)
|
|||
if (err) {
|
||||
printk(KERN_ERR "md: could not bd_claim %s.\n",
|
||||
bdevname(bdev, b));
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
return err;
|
||||
}
|
||||
if (!shared)
|
||||
|
@ -1536,7 +1536,7 @@ static void unlock_rdev(mdk_rdev_t *rdev)
|
|||
if (!bdev)
|
||||
MD_BUG();
|
||||
bd_release(bdev);
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
}
|
||||
|
||||
void md_autodetect_dev(dev_t dev);
|
||||
|
|
|
@ -152,7 +152,7 @@ void dasd_destroy_partitions(struct dasd_block *block)
|
|||
|
||||
invalidate_partition(block->gdp, 0);
|
||||
/* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ);
|
||||
set_capacity(block->gdp, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -977,7 +977,7 @@ EXPORT_SYMBOL(bd_set_size);
|
|||
|
||||
static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,
|
||||
int for_part);
|
||||
static int __blkdev_put(struct block_device *bdev, int for_part);
|
||||
static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
|
||||
|
||||
/*
|
||||
* bd_mutex locking:
|
||||
|
@ -1095,7 +1095,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
|
|||
bdev->bd_part = NULL;
|
||||
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
|
||||
if (bdev != bdev->bd_contains)
|
||||
__blkdev_put(bdev->bd_contains, 1);
|
||||
__blkdev_put(bdev->bd_contains, file->f_mode, 1);
|
||||
bdev->bd_contains = NULL;
|
||||
out_unlock_bdev:
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
|
@ -1163,11 +1163,11 @@ static int blkdev_open(struct inode * inode, struct file * filp)
|
|||
if (!(res = bd_claim(bdev, filp)))
|
||||
return 0;
|
||||
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, filp->f_mode);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int __blkdev_put(struct block_device *bdev, int for_part)
|
||||
static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
|
||||
{
|
||||
int ret = 0;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
|
@ -1184,7 +1184,7 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
|
|||
}
|
||||
if (bdev->bd_contains == bdev) {
|
||||
if (disk->fops->release)
|
||||
ret = disk->fops->release(disk, 0);
|
||||
ret = disk->fops->release(disk, mode);
|
||||
}
|
||||
if (!bdev->bd_openers) {
|
||||
struct module *owner = disk->fops->owner;
|
||||
|
@ -1203,13 +1203,13 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
|
|||
mutex_unlock(&bdev->bd_mutex);
|
||||
bdput(bdev);
|
||||
if (victim)
|
||||
__blkdev_put(victim, 1);
|
||||
__blkdev_put(victim, mode, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int blkdev_put(struct block_device *bdev)
|
||||
int blkdev_put(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
return __blkdev_put(bdev, 0);
|
||||
return __blkdev_put(bdev, mode, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(blkdev_put);
|
||||
|
||||
|
@ -1218,7 +1218,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);
|
||||
return blkdev_put(bdev, filp->f_mode);
|
||||
}
|
||||
|
||||
static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
|
@ -1343,7 +1343,7 @@ struct block_device *open_bdev_excl(const char *path, int flags, void *holder)
|
|||
return bdev;
|
||||
|
||||
blkdev_put:
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, mode);
|
||||
return ERR_PTR(error);
|
||||
}
|
||||
|
||||
|
@ -1359,7 +1359,7 @@ EXPORT_SYMBOL(open_bdev_excl);
|
|||
void close_bdev_excl(struct block_device *bdev)
|
||||
{
|
||||
bd_release(bdev);
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, 0); /* move up in the next patches */
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(close_bdev_excl);
|
||||
|
|
|
@ -347,7 +347,7 @@ fail:
|
|||
static int ext3_blkdev_put(struct block_device *bdev)
|
||||
{
|
||||
bd_release(bdev);
|
||||
return blkdev_put(bdev);
|
||||
return blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
}
|
||||
|
||||
static int ext3_blkdev_remove(struct ext3_sb_info *sbi)
|
||||
|
@ -2066,7 +2066,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);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ fail:
|
|||
static int ext4_blkdev_put(struct block_device *bdev)
|
||||
{
|
||||
bd_release(bdev);
|
||||
return blkdev_put(bdev);
|
||||
return blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
}
|
||||
|
||||
static int ext4_blkdev_remove(struct ext4_sb_info *sbi)
|
||||
|
@ -2553,7 +2553,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
|
|||
if (bd_claim(bdev, sb)) {
|
||||
printk(KERN_ERR
|
||||
"EXT4: failed to claim external journal device.\n");
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1168,7 +1168,7 @@ journal_found:
|
|||
bd_release(bdev);
|
||||
|
||||
close: /* close external log device */
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
|
||||
free: /* free log descriptor */
|
||||
mutex_unlock(&jfs_log_mutex);
|
||||
|
@ -1514,7 +1514,7 @@ int lmLogClose(struct super_block *sb)
|
|||
rc = lmLogShutdown(log);
|
||||
|
||||
bd_release(bdev);
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
|
||||
|
||||
kfree(log);
|
||||
|
||||
|
|
|
@ -976,7 +976,7 @@ static void o2hb_region_release(struct config_item *item)
|
|||
}
|
||||
|
||||
if (reg->hr_bdev)
|
||||
blkdev_put(reg->hr_bdev);
|
||||
blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
|
||||
|
||||
if (reg->hr_slots)
|
||||
kfree(reg->hr_slots);
|
||||
|
@ -1358,7 +1358,7 @@ out:
|
|||
iput(inode);
|
||||
if (ret < 0) {
|
||||
if (reg->hr_bdev) {
|
||||
blkdev_put(reg->hr_bdev);
|
||||
blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
|
||||
reg->hr_bdev = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ void register_disk(struct gendisk *disk)
|
|||
err = blkdev_get(bdev, FMODE_READ, 0);
|
||||
if (err < 0)
|
||||
goto exit;
|
||||
blkdev_put(bdev);
|
||||
blkdev_put(bdev, FMODE_READ);
|
||||
|
||||
exit:
|
||||
/* announce disk after possible partitions are created */
|
||||
|
|
|
@ -2575,7 +2575,7 @@ static int release_journal_dev(struct super_block *super,
|
|||
if (journal->j_dev_bd != NULL) {
|
||||
if (journal->j_dev_bd->bd_dev != super->s_dev)
|
||||
bd_release(journal->j_dev_bd);
|
||||
result = blkdev_put(journal->j_dev_bd);
|
||||
result = blkdev_put(journal->j_dev_bd, 0); /* move up */
|
||||
journal->j_dev_bd = NULL;
|
||||
}
|
||||
|
||||
|
@ -2618,7 +2618,7 @@ static int journal_init_dev(struct super_block *super,
|
|||
} else if (jdev != super->s_dev) {
|
||||
result = bd_claim(journal->j_dev_bd, journal);
|
||||
if (result) {
|
||||
blkdev_put(journal->j_dev_bd);
|
||||
blkdev_put(journal->j_dev_bd, blkdev_mode);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1722,7 +1722,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
|||
unsigned long arg);
|
||||
extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
|
||||
extern int blkdev_get(struct block_device *, fmode_t, unsigned);
|
||||
extern int blkdev_put(struct block_device *);
|
||||
extern int blkdev_put(struct block_device *, fmode_t);
|
||||
extern int bd_claim(struct block_device *, void *);
|
||||
extern void bd_release(struct block_device *);
|
||||
#ifdef CONFIG_SYSFS
|
||||
|
|
|
@ -178,7 +178,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */
|
|||
|
||||
res = set_blocksize(resume_bdev, PAGE_SIZE);
|
||||
if (res < 0)
|
||||
blkdev_put(resume_bdev);
|
||||
blkdev_put(resume_bdev, FMODE_WRITE);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ int swsusp_read(unsigned int *flags_p)
|
|||
error = load_image(&handle, &snapshot, header->pages - 1);
|
||||
release_swap_reader(&handle);
|
||||
|
||||
blkdev_put(resume_bdev);
|
||||
blkdev_put(resume_bdev, FMODE_READ);
|
||||
|
||||
if (!error)
|
||||
pr_debug("PM: Image successfully loaded\n");
|
||||
|
@ -609,7 +609,7 @@ int swsusp_check(void)
|
|||
return -EINVAL;
|
||||
}
|
||||
if (error)
|
||||
blkdev_put(resume_bdev);
|
||||
blkdev_put(resume_bdev, FMODE_READ);
|
||||
else
|
||||
pr_debug("PM: Signature found, resuming\n");
|
||||
} else {
|
||||
|
@ -633,7 +633,7 @@ void swsusp_close(void)
|
|||
return;
|
||||
}
|
||||
|
||||
blkdev_put(resume_bdev);
|
||||
blkdev_put(resume_bdev, 0); /* move up */
|
||||
}
|
||||
|
||||
static int swsusp_header_init(void)
|
||||
|
|
Loading…
Reference in a new issue