Skip to content

Commit

Permalink
Fix build warnings due to change of fsync()
Browse files Browse the repository at this point in the history
Dentry argument was removed from fop->fsync() in kernel 2.6.35.  This
fixes build warnings due to the change.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  • Loading branch information
konis committed Jun 6, 2015
1 parent 7d9a7d1 commit 9d0d442
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions fs/nilfs2/file.c
Expand Up @@ -28,7 +28,11 @@
#include "nilfs.h"
#include "segment.h"

int nilfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
int nilfs_sync_file(struct file *file,
#if HAVE_DENTRY_ARG_IN_FSYNC
struct dentry *dentry,
#endif
int datasync)
{
/*
* Called from fsync() system call
Expand All @@ -39,7 +43,7 @@ int nilfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
* will be implemented.
*/
struct the_nilfs *nilfs;
struct inode *inode = dentry->d_inode;
struct inode *inode = file->f_mapping->host;
int err = 0;

if (nilfs_inode_dirty(inode)) {
Expand Down
9 changes: 7 additions & 2 deletions fs/nilfs2/kern_feature.h
Expand Up @@ -109,6 +109,13 @@
(LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) && \
LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
#endif
/*
* dentry argument was removed from fop->fsync() in kernel 2.6.35.
*/
#ifndef HAVE_DENTRY_ARG_IN_FSYNC
# define HAVE_DENTRY_ARG_IN_FSYNC \
(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35))
#endif
/*
* linux-2.6.35 and the later kernels have inode_init_owner().
*/
Expand Down Expand Up @@ -340,8 +347,6 @@ compat_blkdev_issue_discard(struct block_device *bdev, sector_t sector,
* The following patches are left unapplied during backporting later
* patches:
*
* commit 7ea8085910ef3dd4f3cad6845aaa2b580d39b115
* "drop unused dentry argument to ->fsync"
* commit 7b6d91daee5cac6402186ff224c3af39d79f4a0e
* "block: unify flags for struct bio and struct request"
* commit eafdc7d190a944c755a9fe68573c193e6e0217e7
Expand Down
5 changes: 5 additions & 0 deletions fs/nilfs2/nilfs.h
Expand Up @@ -29,6 +29,7 @@
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/nilfs2_fs.h>
#include "kern_feature.h"
#include "the_nilfs.h"
#include "bmap.h"

Expand Down Expand Up @@ -248,7 +249,11 @@ extern void nilfs_set_link(struct inode *, struct nilfs_dir_entry *,
struct page *, struct inode *);

/* file.c */
#if HAVE_DENTRY_ARG_IN_FSYNC
extern int nilfs_sync_file(struct file *, struct dentry *, int);
#else
extern int nilfs_sync_file(struct file *, int);
#endif

/* ioctl.c */
long nilfs_ioctl(struct file *, unsigned int, unsigned long);
Expand Down

0 comments on commit 9d0d442

Please sign in to comment.