get rid of file_fsync()

Copy and simplify in the only two users remaining.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2010-07-04 12:24:09 +04:00
parent fa9b227e90
commit b5fc510c48
6 changed files with 53 additions and 29 deletions

View File

@ -625,6 +625,30 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
return 0; return 0;
} }
static int hfs_file_fsync(struct file *filp, int datasync)
{
struct inode *inode = filp->f_mapping->host;
struct super_block * sb;
int ret, err;
/* sync the inode to buffers */
ret = write_inode_now(inode, 0);
/* sync the superblock to buffers */
sb = inode->i_sb;
if (sb->s_dirt) {
lock_super(sb);
sb->s_dirt = 0;
if (!(sb->s_flags & MS_RDONLY))
hfs_mdb_commit(sb);
unlock_super(sb);
}
/* .. finally sync the buffers to disk */
err = sync_blockdev(sb->s_bdev);
if (!ret)
ret = err;
return ret;
}
static const struct file_operations hfs_file_operations = { static const struct file_operations hfs_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
@ -634,7 +658,7 @@ static const struct file_operations hfs_file_operations = {
.aio_write = generic_file_aio_write, .aio_write = generic_file_aio_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.splice_read = generic_file_splice_read, .splice_read = generic_file_splice_read,
.fsync = file_fsync, .fsync = hfs_file_fsync,
.open = hfs_file_open, .open = hfs_file_open,
.release = hfs_file_release, .release = hfs_file_release,
}; };

View File

@ -351,6 +351,7 @@ int hfsplus_show_options(struct seq_file *, struct vfsmount *);
/* super.c */ /* super.c */
struct inode *hfsplus_iget(struct super_block *, unsigned long); struct inode *hfsplus_iget(struct super_block *, unsigned long);
int hfsplus_sync_fs(struct super_block *sb, int wait);
/* tables.c */ /* tables.c */
extern u16 hfsplus_case_fold_table[]; extern u16 hfsplus_case_fold_table[];

View File

@ -311,6 +311,31 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
return 0; return 0;
} }
static int hfsplus_file_fsync(struct file *filp, int datasync)
{
struct inode *inode = filp->f_mapping->host;
struct super_block * sb;
int ret, err;
/* sync the inode to buffers */
ret = write_inode_now(inode, 0);
/* sync the superblock to buffers */
sb = inode->i_sb;
if (sb->s_dirt) {
if (!(sb->s_flags & MS_RDONLY))
hfsplus_sync_fs(sb, 1);
else
sb->s_dirt = 0;
}
/* .. finally sync the buffers to disk */
err = sync_blockdev(sb->s_bdev);
if (!ret)
ret = err;
return ret;
}
static const struct inode_operations hfsplus_file_inode_operations = { static const struct inode_operations hfsplus_file_inode_operations = {
.lookup = hfsplus_file_lookup, .lookup = hfsplus_file_lookup,
.truncate = hfsplus_file_truncate, .truncate = hfsplus_file_truncate,
@ -328,7 +353,7 @@ static const struct file_operations hfsplus_file_operations = {
.aio_write = generic_file_aio_write, .aio_write = generic_file_aio_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.splice_read = generic_file_splice_read, .splice_read = generic_file_splice_read,
.fsync = file_fsync, .fsync = hfsplus_file_fsync,
.open = hfsplus_file_open, .open = hfsplus_file_open,
.release = hfsplus_file_release, .release = hfsplus_file_release,
.unlocked_ioctl = hfsplus_ioctl, .unlocked_ioctl = hfsplus_ioctl,

View File

@ -154,7 +154,7 @@ static void hfsplus_clear_inode(struct inode *inode)
} }
} }
static int hfsplus_sync_fs(struct super_block *sb, int wait) int hfsplus_sync_fs(struct super_block *sb, int wait)
{ {
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;

View File

@ -128,31 +128,6 @@ void emergency_sync(void)
} }
} }
/*
* Generic function to fsync a file.
*/
int file_fsync(struct file *filp, int datasync)
{
struct inode *inode = filp->f_mapping->host;
struct super_block * sb;
int ret, err;
/* sync the inode to buffers */
ret = write_inode_now(inode, 0);
/* sync the superblock to buffers */
sb = inode->i_sb;
if (sb->s_dirt && sb->s_op->write_super)
sb->s_op->write_super(sb);
/* .. finally sync the buffers to disk */
err = sync_blockdev(sb->s_bdev);
if (!ret)
ret = err;
return ret;
}
EXPORT_SYMBOL(file_fsync);
/** /**
* vfs_fsync_range - helper to sync a range of data & metadata to disk * vfs_fsync_range - helper to sync a range of data & metadata to disk
* @file: file to sync * @file: file to sync

View File

@ -225,7 +225,6 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
void block_sync_page(struct page *); void block_sync_page(struct page *);
sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
int block_truncate_page(struct address_space *, loff_t, get_block_t *); int block_truncate_page(struct address_space *, loff_t, get_block_t *);
int file_fsync(struct file *, int);
int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
struct page **, void **, get_block_t*); struct page **, void **, get_block_t*);
int nobh_write_end(struct file *, struct address_space *, int nobh_write_end(struct file *, struct address_space *,