v2.6.22.24-op1
[linux-2.6.22.y-op.git] / fs / udf / fsync.c
blob6ded93e7c44fc79587bce58b0241facb627a9634
1 /*
2 * fsync.c
4 * PURPOSE
5 * Fsync handling routines for the OSTA-UDF(tm) filesystem.
7 * COPYRIGHT
8 * This file is distributed under the terms of the GNU General Public
9 * License (GPL). Copies of the GPL can be obtained from:
10 * ftp://prep.ai.mit.edu/pub/gnu/GPL
11 * Each contributing author retains all rights to their own work.
13 * (C) 1999-2001 Ben Fennema
14 * (C) 1999-2000 Stelias Computing Inc
16 * HISTORY
18 * 05/22/99 blf Created.
21 #include "udfdecl.h"
23 #include <linux/fs.h>
25 static int udf_fsync_inode(struct inode *, int);
28 * File may be NULL when we are called. Perhaps we shouldn't
29 * even pass file to fsync ?
32 int udf_fsync_file(struct file * file, struct dentry *dentry, int datasync)
34 struct inode *inode = dentry->d_inode;
35 return udf_fsync_inode(inode, datasync);
38 static int udf_fsync_inode(struct inode *inode, int datasync)
40 int err;
42 err = sync_mapping_buffers(inode->i_mapping);
43 if (!(inode->i_state & I_DIRTY))
44 return err;
45 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
46 return err;
48 err |= udf_sync_inode (inode);
49 return err ? -EIO : 0;