diff options
Diffstat (limited to 'fs/hfs/inode.c')
-rw-r--r-- | fs/hfs/inode.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 87de671baa83..93ceec8fbb8f 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -625,6 +625,30 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) | |||
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
628 | static int hfs_file_fsync(struct file *filp, int datasync) | ||
629 | { | ||
630 | struct inode *inode = filp->f_mapping->host; | ||
631 | struct super_block * sb; | ||
632 | int ret, err; | ||
633 | |||
634 | /* sync the inode to buffers */ | ||
635 | ret = write_inode_now(inode, 0); | ||
636 | |||
637 | /* sync the superblock to buffers */ | ||
638 | sb = inode->i_sb; | ||
639 | if (sb->s_dirt) { | ||
640 | lock_super(sb); | ||
641 | sb->s_dirt = 0; | ||
642 | if (!(sb->s_flags & MS_RDONLY)) | ||
643 | hfs_mdb_commit(sb); | ||
644 | unlock_super(sb); | ||
645 | } | ||
646 | /* .. finally sync the buffers to disk */ | ||
647 | err = sync_blockdev(sb->s_bdev); | ||
648 | if (!ret) | ||
649 | ret = err; | ||
650 | return ret; | ||
651 | } | ||
628 | 652 | ||
629 | static const struct file_operations hfs_file_operations = { | 653 | static const struct file_operations hfs_file_operations = { |
630 | .llseek = generic_file_llseek, | 654 | .llseek = generic_file_llseek, |
@@ -634,7 +658,7 @@ static const struct file_operations hfs_file_operations = { | |||
634 | .aio_write = generic_file_aio_write, | 658 | .aio_write = generic_file_aio_write, |
635 | .mmap = generic_file_mmap, | 659 | .mmap = generic_file_mmap, |
636 | .splice_read = generic_file_splice_read, | 660 | .splice_read = generic_file_splice_read, |
637 | .fsync = file_fsync, | 661 | .fsync = hfs_file_fsync, |
638 | .open = hfs_file_open, | 662 | .open = hfs_file_open, |
639 | .release = hfs_file_release, | 663 | .release = hfs_file_release, |
640 | }; | 664 | }; |