aufs: Update circular includes patch to version preferred by aufs upstream.

svn path=/dists/sid/linux/; revision=21594
This commit is contained in:
Ian Campbell 2014-07-20 20:21:09 +00:00
parent bbad3c5731
commit c618343c23
1 changed files with 139 additions and 80 deletions

View File

@ -1,7 +1,7 @@
From: Ian Campbell <ijc@hellion.org.uk>
Date: Fri, 18 Jul 2014 22:12:19 +0100
Date: Sun, 20 Jul 2014 16:13:35 +0100
Subject: aufs3: remove include of linux/fs.h from linux/mm.h
Forwarded: http://sourceforge.net/p/aufs/mailman/message/32626407/
Forwarded: http://sourceforge.net/p/aufs/mailman/message/32628514/
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:
@ -21,12 +21,9 @@ 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.
By turning the various additions to linux/mm.h into macros rather than static
inlines we can avoid the need for the additional includes. Convert all but the
vm?_pr_or_file functions which don't require additional includes and are a bit
trickier to turn into macros (due to having a return value).
Also take the opportunity to wrap the vmr_* macros in ifndef CONFIG_MMU
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.
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
@ -42,18 +39,33 @@ Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
struct mempolicy;
struct anon_vma;
@@ -1170,6 +1167,7 @@
@@ -1155,76 +1152,16 @@
}
#endif
}
+#ifndef CONFIG_MMU
static inline struct file *vmr_do_pr_or_file(struct vm_region *region,
const char func[], int line)
{
@@ -1178,25 +1176,29 @@
return (f && pr) ? pr : f;
}
-/*
- * 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)
-{
@ -63,9 +75,7 @@ Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
- if (f && pr)
- fput(pr);
-}
+#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
+ __LINE__)
-
-static inline void vma_do_file_update_time(struct vm_area_struct *vma,
- const char func[], int line)
-{
@ -75,33 +85,15 @@ Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
- if (f && pr)
- file_update_time(pr);
-}
+#define vmr_fput(region) do { \
+ struct vm_region *_region = (region); \
+ struct file *f = _region->vm_file, *pr = _region->vm_prfile; \
+ aufs_trace(f, pr, __func__, __LINE__, "vmr_fput"); \
+ fput(f); \
+ if (f && pr) \
+ fput(pr); \
+} while(0);
+
+#endif
+
+#define vma_file_update_time(vma) { \
+ struct vm_area_struct *_vma = (vma); \
+ struct file *f = _vma->vm_file, *pr = _vma->vm_prfile; \
+ aufs_trace(f, pr, __func__, __LINE__, \
+ "vma_file_update_time"); \
+ file_update_time(f); \
+ if (f && pr) \
+ file_update_time(pr); \
+} while (0)
static inline struct file *vma_do_pr_or_file(struct vm_area_struct *vma,
const char func[], int line)
@@ -1206,35 +1208,26 @@
return (f && pr) ? pr : f;
}
-
-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)
-{
@ -111,9 +103,7 @@ Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
- if (f && pr)
- get_file(pr);
-}
+#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \
+ __LINE__)
-
-static inline void vma_do_fput(struct vm_area_struct *vma,
- const char func[], int line)
-{
@ -123,33 +113,102 @@ Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
- if (f && pr)
- fput(pr);
-}
-
-#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__)
+#define vma_get_file(vma) do { \
+ struct vm_area_struct *_vma = (vma); \
+ struct file *f = _vma->vm_file, *pr = _vma->vm_prfile; \
+ aufs_trace(f, pr, __func__, __LINE__, "vma_get_file"); \
+ get_file(f); \
+ if (f && pr) \
+ get_file(pr); \
+} while(0)
+
+#define vma_fput(vma) do { \
+ struct vm_area_struct *_vma = (vma); \
+ struct file *f = _vma->vm_file, *pr = _vma->vm_prfile; \
+ aufs_trace(f, pr, __func__, __LINE__, "vma_fput"); \
+ fput(f); \
+ if (f && pr) \
+ fput(pr); \
+} while(0)
+extern struct file *vmr_do_pr_or_file(struct vm_region *region,
+ const char func[], int line);
+extern void vmr_do_fput(struct vm_region *region, const char func[], int line);
+extern void vma_do_file_update_time(struct vm_area_struct *vma,
+ const char func[], int line);
+extern struct file *vma_do_pr_or_file(struct vm_area_struct *vma,
+ const char func[], int line);
+extern void vma_do_get_file(struct vm_area_struct *vma,
+ const char func[], int line);
+extern void vma_do_fput(struct vm_area_struct *vma, const char func[], int line);
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,
#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
__LINE__)
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -20,6 +20,7 @@
interval_tree.o list_lru.o $(mmu-y)
obj-y += init-mm.o
+obj-y += aufs_mmap.o
ifdef CONFIG_NO_BOOTMEM
obj-y += nobootmem.o
--- /dev/null
+++ b/mm/aufs_mmap.c
@@ -0,0 +1,73 @@
+#include <linux/mm.h>
+#include <linux/file.h>
+#include <linux/fs.h>
+
+/*
+ * 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
+}
+
+#ifndef CONFIG_MMU
+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;
+}
+
+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);
+}
+#endif
+
+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);
+}
+
+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;
+}
+
+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);
+}
+
+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);
+}