aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hfs/inode.c26
-rw-r--r--fs/hfsplus/hfsplus_fs.h1
-rw-r--r--fs/hfsplus/inode.c27
-rw-r--r--fs/hfsplus/super.c2
-rw-r--r--fs/sync.c25
-rw-r--r--include/linux/buffer_head.h1
6 files changed, 53 insertions, 29 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
628static 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
629static const struct file_operations hfs_file_operations = { 653static 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};
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 6505c30ad965..dc856be3c2b0 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -351,6 +351,7 @@ int hfsplus_show_options(struct seq_file *, struct vfsmount *);
351 351
352/* super.c */ 352/* super.c */
353struct inode *hfsplus_iget(struct super_block *, unsigned long); 353struct inode *hfsplus_iget(struct super_block *, unsigned long);
354int hfsplus_sync_fs(struct super_block *sb, int wait);
354 355
355/* tables.c */ 356/* tables.c */
356extern u16 hfsplus_case_fold_table[]; 357extern u16 hfsplus_case_fold_table[];
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 654c5a8ddf1c..c5a979d62c65 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -311,6 +311,31 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
311 return 0; 311 return 0;
312} 312}
313 313
314static int hfsplus_file_fsync(struct file *filp, int datasync)
315{
316 struct inode *inode = filp->f_mapping->host;
317 struct super_block * sb;
318 int ret, err;
319
320 /* sync the inode to buffers */
321 ret = write_inode_now(inode, 0);
322
323 /* sync the superblock to buffers */
324 sb = inode->i_sb;
325 if (sb->s_dirt) {
326 if (!(sb->s_flags & MS_RDONLY))
327 hfsplus_sync_fs(sb, 1);
328 else
329 sb->s_dirt = 0;
330 }
331
332 /* .. finally sync the buffers to disk */
333 err = sync_blockdev(sb->s_bdev);
334 if (!ret)
335 ret = err;
336 return ret;
337}
338
314static const struct inode_operations hfsplus_file_inode_operations = { 339static const struct inode_operations hfsplus_file_inode_operations = {
315 .lookup = hfsplus_file_lookup, 340 .lookup = hfsplus_file_lookup,
316 .truncate = hfsplus_file_truncate, 341 .truncate = hfsplus_file_truncate,
@@ -328,7 +353,7 @@ static const struct file_operations hfsplus_file_operations = {
328 .aio_write = generic_file_aio_write, 353 .aio_write = generic_file_aio_write,
329 .mmap = generic_file_mmap, 354 .mmap = generic_file_mmap,
330 .splice_read = generic_file_splice_read, 355 .splice_read = generic_file_splice_read,
331 .fsync = file_fsync, 356 .fsync = hfsplus_file_fsync,
332 .open = hfsplus_file_open, 357 .open = hfsplus_file_open,
333 .release = hfsplus_file_release, 358 .release = hfsplus_file_release,
334 .unlocked_ioctl = hfsplus_ioctl, 359 .unlocked_ioctl = hfsplus_ioctl,
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 74b473a8ef92..a32c241e4e45 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -154,7 +154,7 @@ static void hfsplus_clear_inode(struct inode *inode)
154 } 154 }
155} 155}
156 156
157static int hfsplus_sync_fs(struct super_block *sb, int wait) 157int hfsplus_sync_fs(struct super_block *sb, int wait)
158{ 158{
159 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; 159 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
160 160
diff --git a/fs/sync.c b/fs/sync.c
index 15aa6f03b2da..ba76b9623e7e 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -128,31 +128,6 @@ void emergency_sync(void)
128 } 128 }
129} 129}
130 130
131/*
132 * Generic function to fsync a file.
133 */
134int file_fsync(struct file *filp, int datasync)
135{
136 struct inode *inode = filp->f_mapping->host;
137 struct super_block * sb;
138 int ret, err;
139
140 /* sync the inode to buffers */
141 ret = write_inode_now(inode, 0);
142
143 /* sync the superblock to buffers */
144 sb = inode->i_sb;
145 if (sb->s_dirt && sb->s_op->write_super)
146 sb->s_op->write_super(sb);
147
148 /* .. finally sync the buffers to disk */
149 err = sync_blockdev(sb->s_bdev);
150 if (!ret)
151 ret = err;
152 return ret;
153}
154EXPORT_SYMBOL(file_fsync);
155
156/** 131/**
157 * vfs_fsync_range - helper to sync a range of data & metadata to disk 132 * vfs_fsync_range - helper to sync a range of data & metadata to disk
158 * @file: file to sync 133 * @file: file to sync
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 3f69054f86d9..620f1d1088cb 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -225,7 +225,6 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
225void block_sync_page(struct page *); 225void block_sync_page(struct page *);
226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
227int block_truncate_page(struct address_space *, loff_t, get_block_t *); 227int block_truncate_page(struct address_space *, loff_t, get_block_t *);
228int file_fsync(struct file *, int);
229int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, 228int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
230 struct page **, void **, get_block_t*); 229 struct page **, void **, get_block_t*);
231int nobh_write_end(struct file *, struct address_space *, 230int nobh_write_end(struct file *, struct address_space *,