From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
Ian Campbell <ian.campbell@citrix.com>,
Jan Beulich <JBeulich@novell.com>
Subject: [PATCH] grant-table: use page flag interfaces when copying a grant page
Date: Tue, 23 Feb 2010 17:24:22 +0000 [thread overview]
Message-ID: <1266945862-21830-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1266944896.11737.6496.camel@zakaz.uk.xensource.com>
Use SetPage{Foreign,Reserved} instead of bit-bashing directly. Add an
accessor for the foreign page destructor.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
drivers/xen/grant-table.c | 5 ++---
include/linux/page-flags.h | 4 +++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 7079787..76fe621 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -556,10 +556,9 @@ int gnttab_copy_grant_page(grant_ref_t ref, struct page **pagep)
}
new_page->mapping = page->mapping;
- new_page->index = page->index;
- set_bit(PG_foreign, &new_page->flags);
+ SetPageForeign(new_page, _PageForeignDestructor(page));
if (PageReserved(page))
- set_bit(PG_reserved, &new_page->flags);
+ SetPageReserved(new_page);
*pagep = new_page;
SetPageForeign(page, gnttab_page_free);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 86325f9..b03950e 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -287,8 +287,10 @@ CLEARPAGEFLAG(Foreign, foreign)
BUG_ON((dtor) == (void (*)(struct page *, unsigned int))0); \
(_page)->index = (long)(dtor); \
} while (0)
+#define _PageForeignDestructor(_page) \
+ ((void (*)(struct page *, unsigned int))(_page)->index)
#define PageForeignDestructor(_page, order) \
- ((void (*)(struct page *, unsigned int))(_page)->index)(_page, order)
+ _PageForeignDestructor(_page)(_page, order)
#else
PAGEFLAG_FALSE(Foreign)
#endif
--
1.5.6.5
next prev parent reply other threads:[~2010-02-23 17:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 16:39 [GIT] Grant table fix Ian Campbell
2010-02-23 16:40 ` [PATCH] gnttab: propagate Reserved flag from old to new page in gnttab_copy_grant_page Ian Campbell
2010-02-23 17:04 ` Jan Beulich
2010-02-23 17:08 ` Ian Campbell
2010-02-23 17:24 ` Ian Campbell [this message]
2010-02-23 17:25 ` [PATCH] grant-table: use page flag interfaces when copying a grant page Ian Campbell
2010-02-23 18:02 ` [GIT] Grant table fix Jeremy Fitzhardinge
2010-02-23 18:05 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266945862-21830-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=JBeulich@novell.com \
--cc=jeremy@goop.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).