Re: aufs3: remove include of linux/fs.h from linux/mm.h
Ian Campbell:
> There were some other errors in the original buildd log at
> http://buildd.debian-ports.org/status/fetch.php?pkg=linux&arch=arm64&ver=3.14.12-1&stamp=1405234443 but they were resolved as part of this patch too so I didn't investigate much further. Some of them were missing prototypes for get_file and file_update_time. The one I'm least sure about is the missing S_IS??? defines. I think most of those would be hard to solve with a fwd declaration without duplicating the complete definition.
All right. Thank you.
Here is the commit which will be released next Monday.
commit 0f23bd8d06cf8e8ba02bad2871d5ddd210f0b9da
Author: J. R. Okajima <hooanon05g@gmail.com>
Date: Mon Jul 21 15:17:04 2014 +0900
aufs mmap: remove include of linux/fs.h from linux/mm.h
This include is added by aufs3-mmap.patch but causes circular dependencies on
arm64 as seen with the Debian kernel packages in http://buildd.debian-ports.org/status/fetch.php?pkg=linux&arch=arm64&ver=3.14.12-1&stamp=1405234443
which contains:
In file included from /PKGBUILDDIR/include/linux/mm.h:23:0,
from /PKGBUILDDIR/include/linux/pid_namespace.h:6,
from /PKGBUILDDIR/include/linux/ptrace.h:9,
from /PKGBUILDDIR/arch/arm64/include/asm/compat.h:26,
from /PKGBUILDDIR/arch/arm64/include/asm/stat.h:23,
from /PKGBUILDDIR/include/linux/stat.h:5,
from /PKGBUILDDIR/include/linux/module.h:10,
from /PKGBUILDDIR/init/main.c:15:
/PKGBUILDDIR/include/linux/fs.h:1575:64: warning: 'struct kstat' declared inside parameter list [enabled by default]
int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
According to http://article.gmane.org/gmane.linux.ports.arm.kernel/342042
> The added mm.h->fs.h looks like a mistake, it should not be there, and we have
> in the past worked hard to separate mm.h, sched.h and fs.h from one another.
Move all of the static inline functions added to mm.h by
aufs3-mmap.patch into a new file, mm/aufs_mmap.c, instead to avoid the
new includes in mm.h.
See-also: http://www.mail-archive.com/aufs-users@lists.sourceforge.net/msg04727.html
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e0f4183..573ea29 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -17,9 +17,6 @@
#include <linux/pfn.h>
#include <linux/bit_spinlock.h>
#include <linux/shrinker.h>
-#include <linux/dcache.h>
-#include <linux/file.h>
-#include <linux/fs.h>
struct mempolicy;
struct anon_vma;
@@ -1013,92 +1010,27 @@ static inline int fixup_user_fault(struct task_struct *tsk,
}
#endif
-/*
- * Mainly for aufs which mmap(2) diffrent file and wants to print different path
- * in /proc/PID/maps.
- */
-/* #define AUFS_DEBUG_MMAP */
-static inline void aufs_trace(struct file *f, struct file *pr,
- const char func[], int line, const char func2[])
-{
-#ifdef AUFS_DEBUG_MMAP
- if (pr)
- pr_info("%s:%d: %s, %p\n", func, line, func2,
- f ? (char *)f->f_dentry->d_name.name : "(null)");
-#endif
-}
-
-static inline struct file *vmr_do_pr_or_file(struct vm_region *region,
- const char func[], int line)
-{
- struct file *f = region->vm_file, *pr = region->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- return (f && pr) ? pr : f;
-}
-
-static inline void vmr_do_fput(struct vm_region *region,
- const char func[], int line)
-{
- struct file *f = region->vm_file, *pr = region->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- fput(f);
- if (f && pr)
- fput(pr);
-}
-
-static inline void vma_do_file_update_time(struct vm_area_struct *vma,
- const char func[], int line)
-{
- struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- file_update_time(f);
- if (f && pr)
- file_update_time(pr);
-}
-
-static inline struct file *vma_do_pr_or_file(struct vm_area_struct *vma,
- const char func[], int line)
-{
- struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- return (f && pr) ? pr : f;
-}
-
-static inline void vma_do_get_file(struct vm_area_struct *vma,
- const char func[], int line)
-{
- struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- get_file(f);
- if (f && pr)
- get_file(pr);
-}
-
-static inline void vma_do_fput(struct vm_area_struct *vma,
- const char func[], int line)
-{
- struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-
- aufs_trace(f, pr, func, line, __func__);
- fput(f);
- if (f && pr)
- fput(pr);
-}
+#ifdef CONFIG_MMU
+extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int);
+extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[],
+ int);
+extern void vma_do_get_file(struct vm_area_struct *, const char[], int);
+extern void vma_do_fput(struct vm_area_struct *, const char[], int);
-#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
- __LINE__)
-#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__)
#define vma_file_update_time(vma) vma_do_file_update_time(vma, __func__, \
__LINE__)
#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \
__LINE__)
#define vma_get_file(vma) vma_do_get_file(vma, __func__, __LINE__)
#define vma_fput(vma) vma_do_fput(vma, __func__, __LINE__)
+#else
+extern struct file *vmr_do_pr_or_file(struct vm_region *, const char[], int);
+extern void vmr_do_fput(struct vm_region *, const char[], int);
+
+#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
+ __LINE__)
+#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__)
+#endif /* CONFIG_MMU */
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
diff --git a/mm/Makefile b/mm/Makefile
index 3a46287..ce0e53c 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -17,7 +17,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
util.o mmzone.o vmstat.o backing-dev.o \
mm_init.o mmu_context.o percpu.o slab_common.o \
compaction.o balloon_compaction.o \
- interval_tree.o $(mmu-y)
+ interval_tree.o prfile.o $(mmu-y)
obj-y += init-mm.o
diff --git a/mm/prfile.c b/mm/prfile.c
new file mode 100644
index 0000000..fc708d2
--- /dev/null
+++ b/mm/prfile.c
@@ -0,0 +1,86 @@
+/*
+ * Mainly for aufs which mmap(2) diffrent file and wants to print different path
+ * in /proc/PID/maps.
+ * Call these functions via macros defined in linux/mm.h.
+ *
+ * See Documentation/filesystems/aufs/design/06mmap.txt
+ *
+ * Copyright (c) 2014 Junjro R. Okajima
+ * Copyright (c) 2014 Ian Campbell
+ */
+
+#include <linux/mm.h>
+#include <linux/file.h>
+#include <linux/fs.h>
+
+/* #define PRFILE_TRACE */
+static inline void prfile_trace(struct file *f, struct file *pr,
+ const char func[], int line, const char func2[])
+{
+#ifdef PRFILE_TRACE
+ if (pr)
+ pr_info("%s:%d: %s, %p\n", func, line, func2,
+ f ? (char *)f->f_dentry->d_name.name : "(null)");
+#endif
+}
+
+#ifdef CONFIG_MMU
+void vma_do_file_update_time(struct vm_area_struct *vma, const char func[],
+ int line)
+{
+ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ file_update_time(f);
+ if (f && pr)
+ file_update_time(pr);
+}
+
+struct file *vma_do_pr_or_file(struct vm_area_struct *vma, const char func[],
+ int line)
+{
+ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ return (f && pr) ? pr : f;
+}
+
+void vma_do_get_file(struct vm_area_struct *vma, const char func[], int line)
+{
+ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ get_file(f);
+ if (f && pr)
+ get_file(pr);
+}
+
+void vma_do_fput(struct vm_area_struct *vma, const char func[], int line)
+{
+ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ fput(f);
+ if (f && pr)
+ fput(pr);
+}
+#else
+struct file *vmr_do_pr_or_file(struct vm_region *region, const char func[],
+ int line)
+{
+ struct file *f = region->vm_file, *pr = region->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ return (f && pr) ? pr : f;
+}
+
+void vmr_do_fput(struct vm_region *region, const char func[], int line)
+{
+ struct file *f = region->vm_file, *pr = region->vm_prfile;
+
+ prfile_trace(f, pr, func, line, __func__);
+ fput(f);
+ if (f && pr)
+ fput(pr);
+}
+#endif /* CONFIG_MMU */
Reply to: