Re: [patch] cache pipe buf page address for non-highmem arch

From: Andrew Morton
Date: Wed Mar 28 2007 - 19:34:41 EST


On Wed, 28 Mar 2007 16:21:04 -0700
Zach Brown <zach.brown@xxxxxxxxxx> wrote:

> > Does this look OK?
>
> Almost...
>
> > #ifdef CONFIG_HIGHMEM
> > static inline void pipe_kunmap_atomic(void *addr, enum km_type type)
> > #else /* CONFIG_HIGHMEM */
> > static inline void pipe_kunmap_atomic(struct page *page, enum
> > km_type type)
>

OK, I give up. What are you telling me here?

<compiles it>

argh, enum km_type isn't defined if !CONFIG_HIGHMEM, which is extravagantly
dumb.


From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

Cc: "Ken Chen" <kenchen@xxxxxxxxxx>
Cc: Zach Brown <zach.brown@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

fs/pipe.c | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)

diff -puN fs/pipe.c~cache-pipe-buf-page-address-for-non-highmem-arch-fix-tidy fs/pipe.c
--- a/fs/pipe.c~cache-pipe-buf-page-address-for-non-highmem-arch-fix-tidy
+++ a/fs/pipe.c
@@ -22,17 +22,36 @@
#include <asm/ioctls.h>

#ifdef CONFIG_HIGHMEM
-#define pipe_kmap kmap
-#define pipe_kmap_atomic kmap_atomic
-#define pipe_kunmap kunmap
-#define pipe_kunmap_atomic kunmap_atomic
+static inline void *pipe_kmap(struct page *page)
+{
+ return kmap(page);
+}
+
+static inline void pipe_kunmap(struct page *page)
+{
+ kunmap(page);
+}
+
+static inline void *pipe_kmap_atomic(struct page *page, enum km_type type)
+{
+ return kmap_atomic(page, type);
+}
+
+static inline void pipe_kunmap_atomic(void *addr, enum km_type type)
+{
+ kunmap_atomic(addr, type);
+}
#else /* CONFIG_HIGHMEM */
static inline void *pipe_kmap(struct page *page)
{
- return (void *) page->private;
+ return (void *)page->private;
}
+
+static inline void pipe_kunmap(struct page *page)
+{
+}
+
#define pipe_kmap_atomic(page, type) pipe_kmap(page)
-#define pipe_kunmap(page) do { } while (0)
#define pipe_kunmap_atomic(page, type) do { } while (0)
#endif

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/