aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-02-22 20:40:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:48:58 -0400
commit9a1c3542768b5a58e45a9216921cd10a3bae1205 (patch)
treec20ffda950db868ec7e1e35aed532962de2ecfd9
parent511de73ff09034fb89c8d54bed201a10d057328c (diff)
[PATCH] pass fmode_t to blkdev_put()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/block/pktcdvd.c8
-rw-r--r--drivers/char/raw.c4
-rw-r--r--drivers/md/dm-table.c4
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/s390/block/dasd_genhd.c2
-rw-r--r--fs/block_dev.c22
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/ext4/super.c4
-rw-r--r--fs/jfs/jfs_logmgr.c4
-rw-r--r--fs/ocfs2/cluster/heartbeat.c4
-rw-r--r--fs/partitions/check.c2
-rw-r--r--fs/reiserfs/journal.c4
-rw-r--r--include/linux/fs.h2
-rw-r--r--kernel/power/swap.c8
14 files changed, 38 insertions, 38 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 90548da9c1cb..ce8c71901923 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2381,7 +2381,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
2381out_unclaim: 2381out_unclaim:
2382 bd_release(pd->bdev); 2382 bd_release(pd->bdev);
2383out_putdev: 2383out_putdev:
2384 blkdev_put(pd->bdev); 2384 blkdev_put(pd->bdev, FMODE_READ);
2385out: 2385out:
2386 return ret; 2386 return ret;
2387} 2387}
@@ -2399,7 +2399,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
2399 2399
2400 pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); 2400 pkt_set_speed(pd, MAX_SPEED, MAX_SPEED);
2401 bd_release(pd->bdev); 2401 bd_release(pd->bdev);
2402 blkdev_put(pd->bdev); 2402 blkdev_put(pd->bdev, FMODE_READ);
2403 2403
2404 pkt_shrink_pktlist(pd); 2404 pkt_shrink_pktlist(pd);
2405} 2405}
@@ -2790,7 +2790,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
2790 return 0; 2790 return 0;
2791 2791
2792out_mem: 2792out_mem:
2793 blkdev_put(bdev); 2793 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
2794 /* This is safe: open() is still holding a reference. */ 2794 /* This is safe: open() is still holding a reference. */
2795 module_put(THIS_MODULE); 2795 module_put(THIS_MODULE);
2796 return ret; 2796 return ret;
@@ -2975,7 +2975,7 @@ static int pkt_remove_dev(dev_t pkt_dev)
2975 pkt_debugfs_dev_remove(pd); 2975 pkt_debugfs_dev_remove(pd);
2976 pkt_sysfs_dev_remove(pd); 2976 pkt_sysfs_dev_remove(pd);
2977 2977
2978 blkdev_put(pd->bdev); 2978 blkdev_put(pd->bdev, FMODE_READ|FMODE_WRITE);
2979 2979
2980 remove_proc_entry(pd->name, pkt_proc); 2980 remove_proc_entry(pd->name, pkt_proc);
2981 DPRINTK(DRIVER_NAME": writer %s unmapped\n", pd->name); 2981 DPRINTK(DRIVER_NAME": writer %s unmapped\n", pd->name);
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index e139372d0e69..bfd59e6bf54f 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -87,7 +87,7 @@ static int raw_open(struct inode *inode, struct file *filp)
87out2: 87out2:
88 bd_release(bdev); 88 bd_release(bdev);
89out1: 89out1:
90 blkdev_put(bdev); 90 blkdev_put(bdev, filp->f_mode);
91out: 91out:
92 mutex_unlock(&raw_mutex); 92 mutex_unlock(&raw_mutex);
93 return err; 93 return err;
@@ -112,7 +112,7 @@ static int raw_release(struct inode *inode, struct file *filp)
112 mutex_unlock(&raw_mutex); 112 mutex_unlock(&raw_mutex);
113 113
114 bd_release(bdev); 114 bd_release(bdev);
115 blkdev_put(bdev); 115 blkdev_put(bdev, filp->f_mode);
116 return 0; 116 return 0;
117} 117}
118 118
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 7c8671b06fe3..dd8bd2e867cd 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -357,7 +357,7 @@ static int open_dev(struct dm_dev_internal *d, dev_t dev,
357 return PTR_ERR(bdev); 357 return PTR_ERR(bdev);
358 r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md)); 358 r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md));
359 if (r) 359 if (r)
360 blkdev_put(bdev); 360 blkdev_put(bdev, d->dm_dev.mode);
361 else 361 else
362 d->dm_dev.bdev = bdev; 362 d->dm_dev.bdev = bdev;
363 return r; 363 return r;
@@ -372,7 +372,7 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
372 return; 372 return;
373 373
374 bd_release_from_disk(d->dm_dev.bdev, dm_disk(md)); 374 bd_release_from_disk(d->dm_dev.bdev, dm_disk(md));
375 blkdev_put(d->dm_dev.bdev); 375 blkdev_put(d->dm_dev.bdev, d->dm_dev.mode);
376 d->dm_dev.bdev = NULL; 376 d->dm_dev.bdev = NULL;
377} 377}
378 378
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 06ea991c7a40..c1a837ca193c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1520,7 +1520,7 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared)
1520 if (err) { 1520 if (err) {
1521 printk(KERN_ERR "md: could not bd_claim %s.\n", 1521 printk(KERN_ERR "md: could not bd_claim %s.\n",
1522 bdevname(bdev, b)); 1522 bdevname(bdev, b));
1523 blkdev_put(bdev); 1523 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1524 return err; 1524 return err;
1525 } 1525 }
1526 if (!shared) 1526 if (!shared)
@@ -1536,7 +1536,7 @@ static void unlock_rdev(mdk_rdev_t *rdev)
1536 if (!bdev) 1536 if (!bdev)
1537 MD_BUG(); 1537 MD_BUG();
1538 bd_release(bdev); 1538 bd_release(bdev);
1539 blkdev_put(bdev); 1539 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1540} 1540}
1541 1541
1542void md_autodetect_dev(dev_t dev); 1542void md_autodetect_dev(dev_t dev);
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index aee6565aaf98..3c1b6915c9ad 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -152,7 +152,7 @@ void dasd_destroy_partitions(struct dasd_block *block)
152 152
153 invalidate_partition(block->gdp, 0); 153 invalidate_partition(block->gdp, 0);
154 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */ 154 /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
155 blkdev_put(bdev); 155 blkdev_put(bdev, FMODE_READ);
156 set_capacity(block->gdp, 0); 156 set_capacity(block->gdp, 0);
157} 157}
158 158
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 55124ac8c7ad..05131baf3cf8 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -977,7 +977,7 @@ EXPORT_SYMBOL(bd_set_size);
977 977
978static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags, 978static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags,
979 int for_part); 979 int for_part);
980static int __blkdev_put(struct block_device *bdev, int for_part); 980static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
981 981
982/* 982/*
983 * bd_mutex locking: 983 * bd_mutex locking:
@@ -1095,7 +1095,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
1095 bdev->bd_part = NULL; 1095 bdev->bd_part = NULL;
1096 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; 1096 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
1097 if (bdev != bdev->bd_contains) 1097 if (bdev != bdev->bd_contains)
1098 __blkdev_put(bdev->bd_contains, 1); 1098 __blkdev_put(bdev->bd_contains, file->f_mode, 1);
1099 bdev->bd_contains = NULL; 1099 bdev->bd_contains = NULL;
1100 out_unlock_bdev: 1100 out_unlock_bdev:
1101 mutex_unlock(&bdev->bd_mutex); 1101 mutex_unlock(&bdev->bd_mutex);
@@ -1163,11 +1163,11 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1163 if (!(res = bd_claim(bdev, filp))) 1163 if (!(res = bd_claim(bdev, filp)))
1164 return 0; 1164 return 0;
1165 1165
1166 blkdev_put(bdev); 1166 blkdev_put(bdev, filp->f_mode);
1167 return res; 1167 return res;
1168} 1168}
1169 1169
1170static int __blkdev_put(struct block_device *bdev, int for_part) 1170static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
1171{ 1171{
1172 int ret = 0; 1172 int ret = 0;
1173 struct gendisk *disk = bdev->bd_disk; 1173 struct gendisk *disk = bdev->bd_disk;
@@ -1184,7 +1184,7 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
1184 } 1184 }
1185 if (bdev->bd_contains == bdev) { 1185 if (bdev->bd_contains == bdev) {
1186 if (disk->fops->release) 1186 if (disk->fops->release)
1187 ret = disk->fops->release(disk, 0); 1187 ret = disk->fops->release(disk, mode);
1188 } 1188 }
1189 if (!bdev->bd_openers) { 1189 if (!bdev->bd_openers) {
1190 struct module *owner = disk->fops->owner; 1190 struct module *owner = disk->fops->owner;
@@ -1203,13 +1203,13 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
1203 mutex_unlock(&bdev->bd_mutex); 1203 mutex_unlock(&bdev->bd_mutex);
1204 bdput(bdev); 1204 bdput(bdev);
1205 if (victim) 1205 if (victim)
1206 __blkdev_put(victim, 1); 1206 __blkdev_put(victim, mode, 1);
1207 return ret; 1207 return ret;
1208} 1208}
1209 1209
1210int blkdev_put(struct block_device *bdev) 1210int blkdev_put(struct block_device *bdev, fmode_t mode)
1211{ 1211{
1212 return __blkdev_put(bdev, 0); 1212 return __blkdev_put(bdev, mode, 0);
1213} 1213}
1214EXPORT_SYMBOL(blkdev_put); 1214EXPORT_SYMBOL(blkdev_put);
1215 1215
@@ -1218,7 +1218,7 @@ static int blkdev_close(struct inode * inode, struct file * filp)
1218 struct block_device *bdev = I_BDEV(filp->f_mapping->host); 1218 struct block_device *bdev = I_BDEV(filp->f_mapping->host);
1219 if (bdev->bd_holder == filp) 1219 if (bdev->bd_holder == filp)
1220 bd_release(bdev); 1220 bd_release(bdev);
1221 return blkdev_put(bdev); 1221 return blkdev_put(bdev, filp->f_mode);
1222} 1222}
1223 1223
1224static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) 1224static 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)
1343 return bdev; 1343 return bdev;
1344 1344
1345blkdev_put: 1345blkdev_put:
1346 blkdev_put(bdev); 1346 blkdev_put(bdev, mode);
1347 return ERR_PTR(error); 1347 return ERR_PTR(error);
1348} 1348}
1349 1349
@@ -1359,7 +1359,7 @@ EXPORT_SYMBOL(open_bdev_excl);
1359void close_bdev_excl(struct block_device *bdev) 1359void close_bdev_excl(struct block_device *bdev)
1360{ 1360{
1361 bd_release(bdev); 1361 bd_release(bdev);
1362 blkdev_put(bdev); 1362 blkdev_put(bdev, 0); /* move up in the next patches */
1363} 1363}
1364 1364
1365EXPORT_SYMBOL(close_bdev_excl); 1365EXPORT_SYMBOL(close_bdev_excl);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 3a260af5544d..15c38e69b694 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -347,7 +347,7 @@ fail:
347static int ext3_blkdev_put(struct block_device *bdev) 347static int ext3_blkdev_put(struct block_device *bdev)
348{ 348{
349 bd_release(bdev); 349 bd_release(bdev);
350 return blkdev_put(bdev); 350 return blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
351} 351}
352 352
353static int ext3_blkdev_remove(struct ext3_sb_info *sbi) 353static int ext3_blkdev_remove(struct ext3_sb_info *sbi)
@@ -2066,7 +2066,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2066 if (bd_claim(bdev, sb)) { 2066 if (bd_claim(bdev, sb)) {
2067 printk(KERN_ERR 2067 printk(KERN_ERR
2068 "EXT3: failed to claim external journal device.\n"); 2068 "EXT3: failed to claim external journal device.\n");
2069 blkdev_put(bdev); 2069 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
2070 return NULL; 2070 return NULL;
2071 } 2071 }
2072 2072
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9b2b2bc4ec17..c12cf7a657a9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -399,7 +399,7 @@ fail:
399static int ext4_blkdev_put(struct block_device *bdev) 399static int ext4_blkdev_put(struct block_device *bdev)
400{ 400{
401 bd_release(bdev); 401 bd_release(bdev);
402 return blkdev_put(bdev); 402 return blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
403} 403}
404 404
405static int ext4_blkdev_remove(struct ext4_sb_info *sbi) 405static int ext4_blkdev_remove(struct ext4_sb_info *sbi)
@@ -2553,7 +2553,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
2553 if (bd_claim(bdev, sb)) { 2553 if (bd_claim(bdev, sb)) {
2554 printk(KERN_ERR 2554 printk(KERN_ERR
2555 "EXT4: failed to claim external journal device.\n"); 2555 "EXT4: failed to claim external journal device.\n");
2556 blkdev_put(bdev); 2556 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
2557 return NULL; 2557 return NULL;
2558 } 2558 }
2559 2559
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index cd2ec2988b59..335c4de6552d 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1168,7 +1168,7 @@ journal_found:
1168 bd_release(bdev); 1168 bd_release(bdev);
1169 1169
1170 close: /* close external log device */ 1170 close: /* close external log device */
1171 blkdev_put(bdev); 1171 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1172 1172
1173 free: /* free log descriptor */ 1173 free: /* free log descriptor */
1174 mutex_unlock(&jfs_log_mutex); 1174 mutex_unlock(&jfs_log_mutex);
@@ -1514,7 +1514,7 @@ int lmLogClose(struct super_block *sb)
1514 rc = lmLogShutdown(log); 1514 rc = lmLogShutdown(log);
1515 1515
1516 bd_release(bdev); 1516 bd_release(bdev);
1517 blkdev_put(bdev); 1517 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1518 1518
1519 kfree(log); 1519 kfree(log);
1520 1520
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 7dce1612553e..4b6fdf591eed 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -976,7 +976,7 @@ static void o2hb_region_release(struct config_item *item)
976 } 976 }
977 977
978 if (reg->hr_bdev) 978 if (reg->hr_bdev)
979 blkdev_put(reg->hr_bdev); 979 blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
980 980
981 if (reg->hr_slots) 981 if (reg->hr_slots)
982 kfree(reg->hr_slots); 982 kfree(reg->hr_slots);
@@ -1358,7 +1358,7 @@ out:
1358 iput(inode); 1358 iput(inode);
1359 if (ret < 0) { 1359 if (ret < 0) {
1360 if (reg->hr_bdev) { 1360 if (reg->hr_bdev) {
1361 blkdev_put(reg->hr_bdev); 1361 blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);
1362 reg->hr_bdev = NULL; 1362 reg->hr_bdev = NULL;
1363 } 1363 }
1364 } 1364 }
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index cfb0c80690aa..5a35ff2e1a9b 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -488,7 +488,7 @@ void register_disk(struct gendisk *disk)
488 err = blkdev_get(bdev, FMODE_READ, 0); 488 err = blkdev_get(bdev, FMODE_READ, 0);
489 if (err < 0) 489 if (err < 0)
490 goto exit; 490 goto exit;
491 blkdev_put(bdev); 491 blkdev_put(bdev, FMODE_READ);
492 492
493exit: 493exit:
494 /* announce disk after possible partitions are created */ 494 /* announce disk after possible partitions are created */
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index b89d193a00d9..3261518478f4 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2575,7 +2575,7 @@ static int release_journal_dev(struct super_block *super,
2575 if (journal->j_dev_bd != NULL) { 2575 if (journal->j_dev_bd != NULL) {
2576 if (journal->j_dev_bd->bd_dev != super->s_dev) 2576 if (journal->j_dev_bd->bd_dev != super->s_dev)
2577 bd_release(journal->j_dev_bd); 2577 bd_release(journal->j_dev_bd);
2578 result = blkdev_put(journal->j_dev_bd); 2578 result = blkdev_put(journal->j_dev_bd, 0); /* move up */
2579 journal->j_dev_bd = NULL; 2579 journal->j_dev_bd = NULL;
2580 } 2580 }
2581 2581
@@ -2618,7 +2618,7 @@ static int journal_init_dev(struct super_block *super,
2618 } else if (jdev != super->s_dev) { 2618 } else if (jdev != super->s_dev) {
2619 result = bd_claim(journal->j_dev_bd, journal); 2619 result = bd_claim(journal->j_dev_bd, journal);
2620 if (result) { 2620 if (result) {
2621 blkdev_put(journal->j_dev_bd); 2621 blkdev_put(journal->j_dev_bd, blkdev_mode);
2622 return result; 2622 return result;
2623 } 2623 }
2624 2624
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b5894604ba5e..04c8dc41f454 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1722,7 +1722,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
1722 unsigned long arg); 1722 unsigned long arg);
1723extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1723extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1724extern int blkdev_get(struct block_device *, fmode_t, unsigned); 1724extern int blkdev_get(struct block_device *, fmode_t, unsigned);
1725extern int blkdev_put(struct block_device *); 1725extern int blkdev_put(struct block_device *, fmode_t);
1726extern int bd_claim(struct block_device *, void *); 1726extern int bd_claim(struct block_device *, void *);
1727extern void bd_release(struct block_device *); 1727extern void bd_release(struct block_device *);
1728#ifdef CONFIG_SYSFS 1728#ifdef CONFIG_SYSFS
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 80ccac849e46..7b9d611c1106 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -178,7 +178,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */
178 178
179 res = set_blocksize(resume_bdev, PAGE_SIZE); 179 res = set_blocksize(resume_bdev, PAGE_SIZE);
180 if (res < 0) 180 if (res < 0)
181 blkdev_put(resume_bdev); 181 blkdev_put(resume_bdev, FMODE_WRITE);
182 182
183 return res; 183 return res;
184} 184}
@@ -574,7 +574,7 @@ int swsusp_read(unsigned int *flags_p)
574 error = load_image(&handle, &snapshot, header->pages - 1); 574 error = load_image(&handle, &snapshot, header->pages - 1);
575 release_swap_reader(&handle); 575 release_swap_reader(&handle);
576 576
577 blkdev_put(resume_bdev); 577 blkdev_put(resume_bdev, FMODE_READ);
578 578
579 if (!error) 579 if (!error)
580 pr_debug("PM: Image successfully loaded\n"); 580 pr_debug("PM: Image successfully loaded\n");
@@ -609,7 +609,7 @@ int swsusp_check(void)
609 return -EINVAL; 609 return -EINVAL;
610 } 610 }
611 if (error) 611 if (error)
612 blkdev_put(resume_bdev); 612 blkdev_put(resume_bdev, FMODE_READ);
613 else 613 else
614 pr_debug("PM: Signature found, resuming\n"); 614 pr_debug("PM: Signature found, resuming\n");
615 } else { 615 } else {
@@ -633,7 +633,7 @@ void swsusp_close(void)
633 return; 633 return;
634 } 634 }
635 635
636 blkdev_put(resume_bdev); 636 blkdev_put(resume_bdev, 0); /* move up */
637} 637}
638 638
639static int swsusp_header_init(void) 639static int swsusp_header_init(void)