From 9d0d442412f8c1434cc211ca0458a660ba797866 Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Sun, 7 Jun 2015 00:51:52 +0900 Subject: [PATCH] Fix build warnings due to change of fsync() 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 --- fs/nilfs2/file.c | 8 ++++++-- fs/nilfs2/kern_feature.h | 9 +++++++-- fs/nilfs2/nilfs.h | 5 +++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index dccbebd..cec302d 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c @@ -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 @@ -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)) { diff --git a/fs/nilfs2/kern_feature.h b/fs/nilfs2/kern_feature.h index c3e675c..0feac0d 100644 --- a/fs/nilfs2/kern_feature.h +++ b/fs/nilfs2/kern_feature.h @@ -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(). */ @@ -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 diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index e70de59..4cedbcd 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -29,6 +29,7 @@ #include #include #include +#include "kern_feature.h" #include "the_nilfs.h" #include "bmap.h" @@ -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);