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

[PATCH] cleanup sync_buffers()

Renames sync_buffers() to sync_blockdev() and removes its (never used)
second argument.

Removes fsync_no_super() in favour of direct calls to sync_blockdev().
parent a2bcb3a0
...@@ -84,7 +84,7 @@ int set_blocksize(kdev_t dev, int size) ...@@ -84,7 +84,7 @@ int set_blocksize(kdev_t dev, int size)
/* Ok, we're actually changing the blocksize.. */ /* Ok, we're actually changing the blocksize.. */
bdev = bdget(kdev_t_to_nr(dev)); bdev = bdget(kdev_t_to_nr(dev));
sync_buffers(bdev, 2); sync_blockdev(bdev);
blksize_size[major(dev)][minor(dev)] = size; blksize_size[major(dev)][minor(dev)] = size;
bdev->bd_inode->i_blkbits = blksize_bits(size); bdev->bd_inode->i_blkbits = blksize_bits(size);
kill_bdev(bdev); kill_bdev(bdev);
...@@ -180,11 +180,6 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) ...@@ -180,11 +180,6 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
return retval; return retval;
} }
static int __block_fsync(struct inode * inode)
{
return sync_buffers(inode->i_bdev, 1);
}
/* /*
* Filp may be NULL when we are called by an msync of a vma * Filp may be NULL when we are called by an msync of a vma
* since the vma has no handle. * since the vma has no handle.
...@@ -194,7 +189,7 @@ static int block_fsync(struct file *filp, struct dentry *dentry, int datasync) ...@@ -194,7 +189,7 @@ static int block_fsync(struct file *filp, struct dentry *dentry, int datasync)
{ {
struct inode * inode = dentry->d_inode; struct inode * inode = dentry->d_inode;
return __block_fsync(inode); return sync_blockdev(inode->i_bdev);
} }
/* /*
...@@ -693,10 +688,8 @@ int blkdev_put(struct block_device *bdev, int kind) ...@@ -693,10 +688,8 @@ int blkdev_put(struct block_device *bdev, int kind)
lock_kernel(); lock_kernel();
switch (kind) { switch (kind) {
case BDEV_FILE: case BDEV_FILE:
__block_fsync(bd_inode);
break;
case BDEV_FS: case BDEV_FS:
fsync_no_super(bdev); sync_blockdev(bd_inode->i_bdev);
break; break;
} }
if (!--bdev->bd_openers) if (!--bdev->bd_openers)
......
...@@ -203,42 +203,27 @@ void end_buffer_io_sync(struct buffer_head *bh, int uptodate) ...@@ -203,42 +203,27 @@ void end_buffer_io_sync(struct buffer_head *bh, int uptodate)
} }
/* /*
* write out all the dirty data associated with a block device * Write out and wait upon all the dirty data associated with a block
* via its mapping. Does not take the superblock lock. * device via its mapping. Does not take the superblock lock.
*
* If `wait' is true, wait on the writeout.
*
* FIXME: rename this function.
*/ */
int sync_buffers(struct block_device *bdev, int wait) int sync_blockdev(struct block_device *bdev)
{ {
int ret; int ret = 0;
ret = filemap_fdatawrite(bdev->bd_inode->i_mapping); if (bdev) {
if (wait) {
int err; int err;
ret = filemap_fdatawait(bdev->bd_inode->i_mapping);
err = filemap_fdatawrite(bdev->bd_inode->i_mapping);
if (!ret)
ret = err;
err = filemap_fdatawait(bdev->bd_inode->i_mapping); err = filemap_fdatawait(bdev->bd_inode->i_mapping);
if (!ret) if (!ret)
ret = err; ret = err;
} }
return ret; return ret;
} }
EXPORT_SYMBOL(sync_blockdev);
/*
* Write out all the dirty data associated with a block device
* via its mapping. Does not take the superblock lock.
*
* Wait on the writeout.
*/
int fsync_no_super(struct block_device *bdev)
{
int ret = 0;
if (bdev)
ret = sync_buffers(bdev, 1);
return ret;
}
/* /*
* Write out and wait upon all dirty data associated with this * Write out and wait upon all dirty data associated with this
...@@ -254,7 +239,7 @@ int fsync_super(struct super_block *sb) ...@@ -254,7 +239,7 @@ int fsync_super(struct super_block *sb)
sb->s_op->write_super(sb); sb->s_op->write_super(sb);
unlock_super(sb); unlock_super(sb);
return fsync_no_super(sb->s_bdev); return sync_blockdev(sb->s_bdev);
} }
/* /*
...@@ -270,7 +255,7 @@ int fsync_bdev(struct block_device *bdev) ...@@ -270,7 +255,7 @@ int fsync_bdev(struct block_device *bdev)
drop_super(sb); drop_super(sb);
return res; return res;
} }
return fsync_no_super(bdev); return sync_blockdev(bdev);
} }
/* /*
...@@ -324,7 +309,7 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync) ...@@ -324,7 +309,7 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
unlock_super(sb); unlock_super(sb);
/* .. finally sync the buffers to disk */ /* .. finally sync the buffers to disk */
ret = sync_buffers(sb->s_bdev, 1); ret = sync_blockdev(sb->s_bdev);
return ret; return ret;
} }
......
...@@ -438,7 +438,7 @@ void ext3_put_super (struct super_block * sb) ...@@ -438,7 +438,7 @@ void ext3_put_super (struct super_block * sb)
* floating about in memory - the physical journal device may * floating about in memory - the physical journal device may
* hotswapped, and it breaks the `ro-after' testing code. * hotswapped, and it breaks the `ro-after' testing code.
*/ */
fsync_no_super(sbi->journal_bdev); sync_blockdev(sbi->journal_bdev);
invalidate_bdev(sbi->journal_bdev, 0); invalidate_bdev(sbi->journal_bdev, 0);
ext3_blkdev_remove(sbi); ext3_blkdev_remove(sbi);
} }
......
...@@ -260,7 +260,7 @@ int journal_recover(journal_t *journal) ...@@ -260,7 +260,7 @@ int journal_recover(journal_t *journal)
journal->j_transaction_sequence = ++info.end_transaction; journal->j_transaction_sequence = ++info.end_transaction;
journal_clear_revoke(journal); journal_clear_revoke(journal);
fsync_no_super(journal->j_fs_dev); sync_blockdev(journal->j_fs_dev);
return err; return err;
} }
......
...@@ -1432,7 +1432,7 @@ static int lmLogShutdown(log_t * log) ...@@ -1432,7 +1432,7 @@ static int lmLogShutdown(log_t * log)
* We need to make sure all of the "written" metapages * We need to make sure all of the "written" metapages
* actually make it to disk * actually make it to disk
*/ */
fsync_no_super(log->sb->s_bdev); sync_blockdev(log->sb->s_bdev);
/* /*
* write the last SYNCPT record with syncpoint = 0 * write the last SYNCPT record with syncpoint = 0
......
...@@ -161,7 +161,7 @@ void set_buffer_async_io(struct buffer_head *bh); ...@@ -161,7 +161,7 @@ void set_buffer_async_io(struct buffer_head *bh);
void invalidate_inode_buffers(struct inode *); void invalidate_inode_buffers(struct inode *);
void invalidate_bdev(struct block_device *, int); void invalidate_bdev(struct block_device *, int);
void __invalidate_buffers(kdev_t dev, int); void __invalidate_buffers(kdev_t dev, int);
int sync_buffers(struct block_device *, int); int sync_blockdev(struct block_device *bdev);
void __wait_on_buffer(struct buffer_head *); void __wait_on_buffer(struct buffer_head *);
void sleep_on_buffer(struct buffer_head *bh); void sleep_on_buffer(struct buffer_head *bh);
void wake_up_buffer(struct buffer_head *bh); void wake_up_buffer(struct buffer_head *bh);
......
...@@ -184,7 +184,6 @@ EXPORT_SYMBOL(invalidate_inode_pages); ...@@ -184,7 +184,6 @@ EXPORT_SYMBOL(invalidate_inode_pages);
EXPORT_SYMBOL(truncate_inode_pages); EXPORT_SYMBOL(truncate_inode_pages);
EXPORT_SYMBOL(fsync_dev); EXPORT_SYMBOL(fsync_dev);
EXPORT_SYMBOL(fsync_bdev); EXPORT_SYMBOL(fsync_bdev);
EXPORT_SYMBOL(fsync_no_super);
EXPORT_SYMBOL(permission); EXPORT_SYMBOL(permission);
EXPORT_SYMBOL(vfs_permission); EXPORT_SYMBOL(vfs_permission);
EXPORT_SYMBOL(inode_setattr); EXPORT_SYMBOL(inode_setattr);
......
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