Commit fa65ca01 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] fsync_bdev() conversion

Bunch of places converted from fsync_dev/invalidate_buffers to
fsync_bdev/invalidate_bdev.
parent c0b88a09
...@@ -247,8 +247,8 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg) ...@@ -247,8 +247,8 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg)
case BLKFLSBUF: case BLKFLSBUF:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
fsync_dev(dev); fsync_bdev(bdev);
invalidate_buffers(dev); invalidate_bdev(bdev, 0);
return 0; return 0;
case BLKSSZGET: case BLKSSZGET:
......
...@@ -405,9 +405,10 @@ static void __exit rd_cleanup (void) ...@@ -405,9 +405,10 @@ static void __exit rd_cleanup (void)
for (i = 0 ; i < NUM_RAMDISKS; i++) { for (i = 0 ; i < NUM_RAMDISKS; i++) {
struct block_device *bdev = rd_bdev[i]; struct block_device *bdev = rd_bdev[i];
rd_bdev[i] = NULL; rd_bdev[i] = NULL;
if (bdev) if (bdev) {
invalidate_bdev(bdev, 1);
blkdev_put(bdev, BDEV_FILE); blkdev_put(bdev, BDEV_FILE);
destroy_buffers(mk_kdev(MAJOR_NR, i)); }
} }
devfs_unregister (devfs_handle); devfs_unregister (devfs_handle);
......
...@@ -541,7 +541,7 @@ static int mtdblock_ioctl(struct inode * inode, struct file * file, ...@@ -541,7 +541,7 @@ static int mtdblock_ioctl(struct inode * inode, struct file * file,
return -EACCES; return -EACCES;
#endif #endif
fsync_bdev(inode->i_bdev); fsync_bdev(inode->i_bdev);
invalidate_buffers(inode->i_rdev); invalidate_bdev(inode->b_rdev, 0);
down(&mtdblk->cache_sem); down(&mtdblk->cache_sem);
write_cached_data(mtdblk); write_cached_data(mtdblk);
up(&mtdblk->cache_sem); up(&mtdblk->cache_sem);
......
...@@ -222,7 +222,7 @@ static int mtdblock_ioctl(struct inode * inode, struct file * file, ...@@ -222,7 +222,7 @@ static int mtdblock_ioctl(struct inode * inode, struct file * file,
if(!capable(CAP_SYS_ADMIN)) return -EACCES; if(!capable(CAP_SYS_ADMIN)) return -EACCES;
#endif #endif
fsync_bdev(inode->i_bdev); fsync_bdev(inode->i_bdev);
invalidate_buffers(inode->i_rdev); invalidate_bdev(inode->i_bdev, 0);
if (mtd->sync) if (mtd->sync)
mtd->sync(mtd); mtd->sync(mtd);
return 0; return 0;
......
...@@ -796,7 +796,7 @@ static int nftl_ioctl(struct inode * inode, struct file * file, unsigned int cmd ...@@ -796,7 +796,7 @@ static int nftl_ioctl(struct inode * inode, struct file * file, unsigned int cmd
case BLKFLSBUF: case BLKFLSBUF:
if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!capable(CAP_SYS_ADMIN)) return -EACCES;
fsync_bdev(inode->i_bdev); fsync_bdev(inode->i_bdev);
invalidate_buffers(inode->i_rdev); invalidate_bdev(inode->i_bdev, 0);
if (nftl->mtd->sync) if (nftl->mtd->sync)
nftl->mtd->sync(nftl->mtd); nftl->mtd->sync(nftl->mtd);
return 0; return 0;
......
...@@ -2618,7 +2618,7 @@ dasd_release (struct inode *inp, struct file *filp) ...@@ -2618,7 +2618,7 @@ dasd_release (struct inode *inp, struct file *filp)
} }
count = atomic_dec_return (&device->open_count); count = atomic_dec_return (&device->open_count);
if ( count == 0) { if ( count == 0) {
invalidate_buffers (inp->i_rdev); invalidate_bdev (inp->i_bdev, 0);
if ( device->discipline->owner ) if ( device->discipline->owner )
__MOD_DEC_USE_COUNT(device->discipline->owner); __MOD_DEC_USE_COUNT(device->discipline->owner);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
......
...@@ -655,7 +655,7 @@ int xpram_ioctl (struct inode *inode, struct file *filp, ...@@ -655,7 +655,7 @@ int xpram_ioctl (struct inode *inode, struct file *filp,
case BLKFLSBUF: /* flush, 0x1261 */ case BLKFLSBUF: /* flush, 0x1261 */
fsync_bdev(inode->i_bdev); fsync_bdev(inode->i_bdev);
if ( capable(CAP_SYS_ADMIN) )invalidate_buffers(inode->i_rdev); if ( capable(CAP_SYS_ADMIN) )invalidate_bdev(inode->i_bdev, 0);
return 0; return 0;
case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */ case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
......
...@@ -217,7 +217,7 @@ tapeblock_release(struct inode *inode, struct file *filp) { ...@@ -217,7 +217,7 @@ tapeblock_release(struct inode *inode, struct file *filp) {
s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags); s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
tapestate_set (ti, TS_UNUSED); tapestate_set (ti, TS_UNUSED);
s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags); s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
invalidate_buffers(inode->i_rdev); invalidate_bdev(inode->i_bdev, 0);
return 0; return 0;
} }
......
...@@ -657,10 +657,14 @@ int invalidate_inodes(struct super_block * sb) ...@@ -657,10 +657,14 @@ int invalidate_inodes(struct super_block * sb)
int invalidate_device(kdev_t dev, int do_sync) int invalidate_device(kdev_t dev, int do_sync)
{ {
struct super_block *sb; struct super_block *sb;
struct block_device *bdev = bdget(kdev_t_to_nr(dev));
int res; int res;
if (!bdev)
return 0;
if (do_sync) if (do_sync)
fsync_dev(dev); fsync_bdev(bdev);
res = 0; res = 0;
sb = get_super(dev); sb = get_super(dev);
...@@ -675,7 +679,8 @@ int invalidate_device(kdev_t dev, int do_sync) ...@@ -675,7 +679,8 @@ int invalidate_device(kdev_t dev, int do_sync)
res = invalidate_inodes(sb); res = invalidate_inodes(sb);
drop_super(sb); drop_super(sb);
} }
invalidate_buffers(dev); invalidate_bdev(bdev, 0);
bdput(bdev);
return res; return res;
} }
......
...@@ -894,7 +894,7 @@ int journal_create (journal_t *journal) ...@@ -894,7 +894,7 @@ int journal_create (journal_t *journal)
__brelse(bh); __brelse(bh);
} }
fsync_dev(to_kdev_t(journal->j_dev->bd_dev)); fsync_bdev(journal->j_dev);
jbd_debug(1, "JBD: journal cleared.\n"); jbd_debug(1, "JBD: journal cleared.\n");
/* OK, fill in the initial static fields in the new superblock */ /* OK, fill in the initial static fields in the new superblock */
......
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