From: Hauke Mehrtens Date: Sun, 8 Jun 2014 20:52:39 +0000 (+0200) Subject: backports: add split_page() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5b0087cbb80eceadc1d4b05b587868abf0d9cf71;p=openwrt%2Fstaging%2Fblogic.git backports: add split_page() Signed-off-by: Hauke Mehrtens --- diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c index 9bcb8059506a..e75e52ed8164 100644 --- a/backport/compat/backport-3.10.c +++ b/backport/compat/backport-3.10.c @@ -17,6 +17,7 @@ #include #include #include +#include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) #include @@ -232,3 +233,48 @@ int of_property_read_u32_index(const struct device_node *np, } EXPORT_SYMBOL_GPL(of_property_read_u32_index); #endif /* CONFIG_OF */ + +static inline void set_page_count(struct page *page, int v) +{ + atomic_set(&page->_count, v); +} + +/* + * Turn a non-refcounted page (->_count == 0) into refcounted with + * a count of one. + */ +static inline void set_page_refcounted(struct page *page) +{ + VM_BUG_ON(PageTail(page)); + VM_BUG_ON(atomic_read(&page->_count)); + set_page_count(page, 1); +} + +/* + * split_page takes a non-compound higher-order page, and splits it into + * n (1<