diff options
author | Brian Behlendorf <[email protected]> | 2011-11-09 12:45:35 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-11-09 19:36:21 -0800 |
commit | 0d0b523728b348b2d762fd9b27511ed9b138607b (patch) | |
tree | 0cce0407fbb877f06e6aba098d47f27c8084324f /include/linux/file_compat.h | |
parent | 12ff95ff579d0203790aff69632c7ab12ce56140 (diff) |
Linux 3.1 compat, vfs_fsync()
Preferentially use the vfs_fsync() function. This function was
initially introduced in 2.6.29 and took three arguments. As
of 2.6.35 the dentry argument was dropped from the function.
For older kernels fall back to using file_fsync() which also
took three arguments including the dentry.
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #52
Diffstat (limited to 'include/linux/file_compat.h')
-rw-r--r-- | include/linux/file_compat.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h index d5fb2bc60..5c7833d4a 100644 --- a/include/linux/file_compat.h +++ b/include/linux/file_compat.h @@ -50,12 +50,16 @@ spl_filp_open(const char *name, int flags, int mode, int *err) #define spl_filp_poff(f) (&(f)->f_pos) #define spl_filp_write(fp, b, s, p) (fp)->f_op->write((fp), (b), (s), p) -#ifdef HAVE_3ARGS_FILE_FSYNC -#define spl_filp_fsync(fp, sync) (fp)->f_op->fsync((fp), \ - (fp)->f_dentry, sync) +#ifdef HAVE_VFS_FSYNC +# ifdef HAVE_2ARGS_VFS_FSYNC +# define spl_filp_fsync(fp, sync) vfs_fsync(fp, sync) +# else +# define spl_filp_fsync(fp, sync) vfs_fsync(fp, (fp)->f_dentry, sync) +# endif /* HAVE_2ARGS_VFS_FSYNC */ #else -#define spl_filp_fsync(fp, sync) (fp)->f_op->fsync((fp), sync) -#endif +# include <linux/buffer_head.h> +# define spl_filp_fsync(fp, sync) file_fsync(fp, (fp)->f_dentry, sync) +#endif /* HAVE_VFS_FSYNC */ #ifdef HAVE_INODE_I_MUTEX #define spl_inode_lock(ip) (mutex_lock(&(ip)->i_mutex)) |