Commit b5fc510c48f631882ccec3c0f02a25d5b67de09f

Authored by Al Viro
1 parent fa9b227e90

get rid of file_fsync()

Copy and simplify in the only two users remaining.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 6 changed files with 53 additions and 29 deletions Side-by-side Diff

... ... @@ -625,7 +625,31 @@
625 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;
628 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 +}
  652 +
629 653 static const struct file_operations hfs_file_operations = {
630 654 .llseek = generic_file_llseek,
631 655 .read = do_sync_read,
... ... @@ -634,7 +658,7 @@
634 658 .aio_write = generic_file_aio_write,
635 659 .mmap = generic_file_mmap,
636 660 .splice_read = generic_file_splice_read,
637   - .fsync = file_fsync,
  661 + .fsync = hfs_file_fsync,
638 662 .open = hfs_file_open,
639 663 .release = hfs_file_release,
640 664 };
fs/hfsplus/hfsplus_fs.h
... ... @@ -351,6 +351,7 @@
351 351  
352 352 /* super.c */
353 353 struct inode *hfsplus_iget(struct super_block *, unsigned long);
  354 +int hfsplus_sync_fs(struct super_block *sb, int wait);
354 355  
355 356 /* tables.c */
356 357 extern u16 hfsplus_case_fold_table[];
... ... @@ -311,6 +311,31 @@
311 311 return 0;
312 312 }
313 313  
  314 +static 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 +
314 339 static const struct inode_operations hfsplus_file_inode_operations = {
315 340 .lookup = hfsplus_file_lookup,
316 341 .truncate = hfsplus_file_truncate,
... ... @@ -328,7 +353,7 @@
328 353 .aio_write = generic_file_aio_write,
329 354 .mmap = generic_file_mmap,
330 355 .splice_read = generic_file_splice_read,
331   - .fsync = file_fsync,
  356 + .fsync = hfsplus_file_fsync,
332 357 .open = hfsplus_file_open,
333 358 .release = hfsplus_file_release,
334 359 .unlocked_ioctl = hfsplus_ioctl,
... ... @@ -154,7 +154,7 @@
154 154 }
155 155 }
156 156  
157   -static int hfsplus_sync_fs(struct super_block *sb, int wait)
  157 +int hfsplus_sync_fs(struct super_block *sb, int wait)
158 158 {
159 159 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
160 160  
... ... @@ -128,31 +128,6 @@
128 128 }
129 129 }
130 130  
131   -/*
132   - * Generic function to fsync a file.
133   - */
134   -int 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   -}
154   -EXPORT_SYMBOL(file_fsync);
155   -
156 131 /**
157 132 * vfs_fsync_range - helper to sync a range of data & metadata to disk
158 133 * @file: file to sync
include/linux/buffer_head.h
... ... @@ -225,7 +225,6 @@
225 225 void block_sync_page(struct page *);
226 226 sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
227 227 int block_truncate_page(struct address_space *, loff_t, get_block_t *);
228   -int file_fsync(struct file *, int);
229 228 int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
230 229 struct page **, void **, get_block_t*);
231 230 int nobh_write_end(struct file *, struct address_space *,