Add fsync file operation method

Add a scoutfs_file_fsync() which synchronously commits the current
transaction and call it to fsync files and directories.  This fixes a
number of generic xfstests in the quick group which were failing because
fsync wasn't supported.

Signed-off-by: Zach Brown <zab@versity.com>
Reviewed-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Zach Brown
2016-11-14 10:30:05 -08:00
parent 1d0cd95b55
commit 243a36e405
4 changed files with 10 additions and 0 deletions

View File

@@ -1013,6 +1013,7 @@ out:
const struct file_operations scoutfs_dir_fops = {
.readdir = scoutfs_readdir,
.fsync = scoutfs_file_fsync,
};
const struct inode_operations scoutfs_dir_iops = {

View File

@@ -671,4 +671,5 @@ const struct file_operations scoutfs_file_fops = {
.aio_read = generic_file_aio_read,
.aio_write = generic_file_aio_write,
.unlocked_ioctl = scoutfs_ioctl,
.fsync = scoutfs_file_fsync,
};

View File

@@ -177,6 +177,12 @@ int scoutfs_sync_fs(struct super_block *sb, int wait)
return ret;
}
int scoutfs_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync)
{
return scoutfs_sync_fs(file->f_inode->i_sb, 1);
}
int scoutfs_hold_trans(struct super_block *sb)
{
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);

View File

@@ -3,6 +3,8 @@
void scoutfs_trans_write_func(struct work_struct *work);
int scoutfs_sync_fs(struct super_block *sb, int wait);
int scoutfs_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync);
int scoutfs_hold_trans(struct super_block *sb);
void scoutfs_release_trans(struct super_block *sb);