Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5fc510c authored by Al Viro's avatar Al Viro
Browse files

get rid of file_fsync()



Copy and simplify in the only two users remaining.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent fa9b227e
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -625,6 +625,30 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
	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 = {
	.llseek		= generic_file_llseek,
@@ -634,7 +658,7 @@ static const struct file_operations hfs_file_operations = {
	.aio_write	= generic_file_aio_write,
	.mmap		= generic_file_mmap,
	.splice_read	= generic_file_splice_read,
	.fsync		= file_fsync,
	.fsync		= hfs_file_fsync,
	.open		= hfs_file_open,
	.release	= hfs_file_release,
};
+1 −0
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ int hfsplus_show_options(struct seq_file *, struct vfsmount *);

/* super.c */
struct inode *hfsplus_iget(struct super_block *, unsigned long);
int hfsplus_sync_fs(struct super_block *sb, int wait);

/* tables.c */
extern u16 hfsplus_case_fold_table[];
+26 −1
Original line number Diff line number Diff line
@@ -311,6 +311,31 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
	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 = {
	.lookup		= hfsplus_file_lookup,
	.truncate	= hfsplus_file_truncate,
@@ -328,7 +353,7 @@ static const struct file_operations hfsplus_file_operations = {
	.aio_write	= generic_file_aio_write,
	.mmap		= generic_file_mmap,
	.splice_read	= generic_file_splice_read,
	.fsync		= file_fsync,
	.fsync		= hfsplus_file_fsync,
	.open		= hfsplus_file_open,
	.release	= hfsplus_file_release,
	.unlocked_ioctl = hfsplus_ioctl,
+1 −1
Original line number Diff line number Diff line
@@ -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;

+0 −25
Original line number Diff line number Diff line
@@ -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
 * @file:		file to sync
Loading