aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/fsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/fsync.c')
-rw-r--r--fs/udf/fsync.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/fs/udf/fsync.c b/fs/udf/fsync.c
new file mode 100644
index 000000000000..2dde6b888c2b
--- /dev/null
+++ b/fs/udf/fsync.c
@@ -0,0 +1,56 @@
1/*
2 * fsync.c
3 *
4 * PURPOSE
5 * Fsync handling routines for the OSTA-UDF(tm) filesystem.
6 *
7 * CONTACTS
8 * E-mail regarding any portion of the Linux UDF file system should be
9 * directed to the development team mailing list (run by majordomo):
10 * linux_udf@hpesjro.fc.hp.com
11 *
12 * COPYRIGHT
13 * This file is distributed under the terms of the GNU General Public
14 * License (GPL). Copies of the GPL can be obtained from:
15 * ftp://prep.ai.mit.edu/pub/gnu/GPL
16 * Each contributing author retains all rights to their own work.
17 *
18 * (C) 1999-2001 Ben Fennema
19 * (C) 1999-2000 Stelias Computing Inc
20 *
21 * HISTORY
22 *
23 * 05/22/99 blf Created.
24 */
25
26#include "udfdecl.h"
27
28#include <linux/fs.h>
29#include <linux/smp_lock.h>
30
31static int udf_fsync_inode(struct inode *, int);
32
33/*
34 * File may be NULL when we are called. Perhaps we shouldn't
35 * even pass file to fsync ?
36 */
37
38int udf_fsync_file(struct file * file, struct dentry *dentry, int datasync)
39{
40 struct inode *inode = dentry->d_inode;
41 return udf_fsync_inode(inode, datasync);
42}
43
44static int udf_fsync_inode(struct inode *inode, int datasync)
45{
46 int err;
47
48 err = sync_mapping_buffers(inode->i_mapping);
49 if (!(inode->i_state & I_DIRTY))
50 return err;
51 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
52 return err;
53
54 err |= udf_sync_inode (inode);
55 return err ? -EIO : 0;
56}