Commit 4385bab1 authored by Al Viro's avatar Al Viro

make blkdev_put() return void

same story as with the previous patches - note that return
value of blkdev_close() is lost, since there's nowhere the
caller (__fput()) could return it to.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent db2a144b
...@@ -1045,7 +1045,7 @@ void bd_set_size(struct block_device *bdev, loff_t size) ...@@ -1045,7 +1045,7 @@ void bd_set_size(struct block_device *bdev, loff_t size)
} }
EXPORT_SYMBOL(bd_set_size); EXPORT_SYMBOL(bd_set_size);
static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part); static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
/* /*
* bd_mutex locking: * bd_mutex locking:
...@@ -1400,9 +1400,8 @@ static int blkdev_open(struct inode * inode, struct file * filp) ...@@ -1400,9 +1400,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
return blkdev_get(bdev, filp->f_mode, filp); return blkdev_get(bdev, filp->f_mode, filp);
} }
static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
{ {
int ret = 0;
struct gendisk *disk = bdev->bd_disk; struct gendisk *disk = bdev->bd_disk;
struct block_device *victim = NULL; struct block_device *victim = NULL;
...@@ -1441,10 +1440,9 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) ...@@ -1441,10 +1440,9 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
bdput(bdev); bdput(bdev);
if (victim) if (victim)
__blkdev_put(victim, mode, 1); __blkdev_put(victim, mode, 1);
return ret;
} }
int blkdev_put(struct block_device *bdev, fmode_t mode) void blkdev_put(struct block_device *bdev, fmode_t mode)
{ {
mutex_lock(&bdev->bd_mutex); mutex_lock(&bdev->bd_mutex);
...@@ -1488,15 +1486,15 @@ int blkdev_put(struct block_device *bdev, fmode_t mode) ...@@ -1488,15 +1486,15 @@ int blkdev_put(struct block_device *bdev, fmode_t mode)
mutex_unlock(&bdev->bd_mutex); mutex_unlock(&bdev->bd_mutex);
return __blkdev_put(bdev, mode, 0); __blkdev_put(bdev, mode, 0);
} }
EXPORT_SYMBOL(blkdev_put); EXPORT_SYMBOL(blkdev_put);
static int blkdev_close(struct inode * inode, struct file * filp) static int blkdev_close(struct inode * inode, struct file * filp)
{ {
struct block_device *bdev = I_BDEV(filp->f_mapping->host); struct block_device *bdev = I_BDEV(filp->f_mapping->host);
blkdev_put(bdev, filp->f_mode);
return blkdev_put(bdev, filp->f_mode); return 0;
} }
static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
......
...@@ -362,22 +362,19 @@ static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb) ...@@ -362,22 +362,19 @@ static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
/* /*
* Release the journal device * Release the journal device
*/ */
static int ext3_blkdev_put(struct block_device *bdev) static void ext3_blkdev_put(struct block_device *bdev)
{ {
return blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
} }
static int ext3_blkdev_remove(struct ext3_sb_info *sbi) static void ext3_blkdev_remove(struct ext3_sb_info *sbi)
{ {
struct block_device *bdev; struct block_device *bdev;
int ret = -ENODEV;
bdev = sbi->journal_bdev; bdev = sbi->journal_bdev;
if (bdev) { if (bdev) {
ret = ext3_blkdev_put(bdev); ext3_blkdev_put(bdev);
sbi->journal_bdev = NULL; sbi->journal_bdev = NULL;
} }
return ret;
} }
static inline struct inode *orphan_list_entry(struct list_head *l) static inline struct inode *orphan_list_entry(struct list_head *l)
......
...@@ -703,22 +703,19 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) ...@@ -703,22 +703,19 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
/* /*
* Release the journal device * Release the journal device
*/ */
static int ext4_blkdev_put(struct block_device *bdev) static void ext4_blkdev_put(struct block_device *bdev)
{ {
return blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
} }
static int ext4_blkdev_remove(struct ext4_sb_info *sbi) static void ext4_blkdev_remove(struct ext4_sb_info *sbi)
{ {
struct block_device *bdev; struct block_device *bdev;
int ret = -ENODEV;
bdev = sbi->journal_bdev; bdev = sbi->journal_bdev;
if (bdev) { if (bdev) {
ret = ext4_blkdev_put(bdev); ext4_blkdev_put(bdev);
sbi->journal_bdev = NULL; sbi->journal_bdev = NULL;
} }
return ret;
} }
static inline struct inode *orphan_list_entry(struct list_head *l) static inline struct inode *orphan_list_entry(struct list_head *l)
......
...@@ -173,7 +173,7 @@ struct bl_msg_hdr { ...@@ -173,7 +173,7 @@ struct bl_msg_hdr {
/* blocklayoutdev.c */ /* blocklayoutdev.c */
ssize_t bl_pipe_downcall(struct file *, const char __user *, size_t); ssize_t bl_pipe_downcall(struct file *, const char __user *, size_t);
void bl_pipe_destroy_msg(struct rpc_pipe_msg *); void bl_pipe_destroy_msg(struct rpc_pipe_msg *);
int nfs4_blkdev_put(struct block_device *bdev); void nfs4_blkdev_put(struct block_device *bdev);
struct pnfs_block_dev *nfs4_blk_decode_device(struct nfs_server *server, struct pnfs_block_dev *nfs4_blk_decode_device(struct nfs_server *server,
struct pnfs_device *dev); struct pnfs_device *dev);
int nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo, int nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
......
...@@ -56,11 +56,11 @@ static int decode_sector_number(__be32 **rp, sector_t *sp) ...@@ -56,11 +56,11 @@ static int decode_sector_number(__be32 **rp, sector_t *sp)
/* /*
* Release the block device * Release the block device
*/ */
int nfs4_blkdev_put(struct block_device *bdev) void nfs4_blkdev_put(struct block_device *bdev)
{ {
dprintk("%s for device %d:%d\n", __func__, MAJOR(bdev->bd_dev), dprintk("%s for device %d:%d\n", __func__, MAJOR(bdev->bd_dev),
MINOR(bdev->bd_dev)); MINOR(bdev->bd_dev));
return blkdev_put(bdev, FMODE_READ); blkdev_put(bdev, FMODE_READ);
} }
ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, ssize_t bl_pipe_downcall(struct file *filp, const char __user *src,
......
...@@ -88,14 +88,8 @@ static void dev_remove(struct net *net, dev_t dev) ...@@ -88,14 +88,8 @@ static void dev_remove(struct net *net, dev_t dev)
*/ */
static void nfs4_blk_metadev_release(struct pnfs_block_dev *bdev) static void nfs4_blk_metadev_release(struct pnfs_block_dev *bdev)
{ {
int rv;
dprintk("%s Releasing\n", __func__); dprintk("%s Releasing\n", __func__);
rv = nfs4_blkdev_put(bdev->bm_mdev); nfs4_blkdev_put(bdev->bm_mdev);
if (rv)
printk(KERN_ERR "NFS: %s nfs4_blkdev_put returns %d\n",
__func__, rv);
dev_remove(bdev->net, bdev->bm_mdev->bd_dev); dev_remove(bdev->net, bdev->bm_mdev->bd_dev);
} }
......
...@@ -97,7 +97,7 @@ static int flush_commit_list(struct super_block *s, ...@@ -97,7 +97,7 @@ static int flush_commit_list(struct super_block *s,
static int can_dirty(struct reiserfs_journal_cnode *cn); static int can_dirty(struct reiserfs_journal_cnode *cn);
static int journal_join(struct reiserfs_transaction_handle *th, static int journal_join(struct reiserfs_transaction_handle *th,
struct super_block *sb, unsigned long nblocks); struct super_block *sb, unsigned long nblocks);
static int release_journal_dev(struct super_block *super, static void release_journal_dev(struct super_block *super,
struct reiserfs_journal *journal); struct reiserfs_journal *journal);
static int dirty_one_transaction(struct super_block *s, static int dirty_one_transaction(struct super_block *s,
struct reiserfs_journal_list *jl); struct reiserfs_journal_list *jl);
...@@ -2532,23 +2532,13 @@ static void journal_list_init(struct super_block *sb) ...@@ -2532,23 +2532,13 @@ static void journal_list_init(struct super_block *sb)
SB_JOURNAL(sb)->j_current_jl = alloc_journal_list(sb); SB_JOURNAL(sb)->j_current_jl = alloc_journal_list(sb);
} }
static int release_journal_dev(struct super_block *super, static void release_journal_dev(struct super_block *super,
struct reiserfs_journal *journal) struct reiserfs_journal *journal)
{ {
int result;
result = 0;
if (journal->j_dev_bd != NULL) { if (journal->j_dev_bd != NULL) {
result = blkdev_put(journal->j_dev_bd, journal->j_dev_mode); blkdev_put(journal->j_dev_bd, journal->j_dev_mode);
journal->j_dev_bd = NULL; journal->j_dev_bd = NULL;
} }
if (result != 0) {
reiserfs_warning(super, "sh-457",
"Cannot release journal device: %i", result);
}
return result;
} }
static int journal_init_dev(struct super_block *super, static int journal_init_dev(struct super_block *super,
......
...@@ -2091,7 +2091,7 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, ...@@ -2091,7 +2091,7 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
void *holder); void *holder);
extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
void *holder); void *holder);
extern int blkdev_put(struct block_device *bdev, fmode_t mode); extern void blkdev_put(struct block_device *bdev, fmode_t mode);
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
extern void bd_unlink_disk_holder(struct block_device *bdev, extern void bd_unlink_disk_holder(struct block_device *bdev,
......
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