X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_patchless_compat.h;h=7bcdaf4d87958c35a7d91564fe1a2df71d599bbc;hb=45cb603b4352a73077dcc45ec2cdea403837a7ba;hp=c62e4d5c930ef2351457982d55819d03463e78f5;hpb=bcc52fdccc92c45f657d637eaf8403decc6d9877;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_patchless_compat.h b/lustre/include/lustre_patchless_compat.h index c62e4d5..7bcdaf4 100644 --- a/lustre/include/lustre_patchless_compat.h +++ b/lustre/include/lustre_patchless_compat.h @@ -68,13 +68,26 @@ static inline void ll_remove_from_page_cache(struct page *page) static inline void ll_delete_from_page_cache(struct page *page) { ll_remove_from_page_cache(page); - page_cache_release(page); + put_page(page); } #else /* HAVE_DELETE_FROM_PAGE_CACHE */ #define ll_delete_from_page_cache(page) delete_from_page_cache(page) #endif /* !HAVE_DELETE_FROM_PAGE_CACHE */ static inline void +ll_cancel_dirty_page(struct address_space *mapping, struct page *page) +{ +#ifdef HAVE_NEW_CANCEL_DIRTY_PAGE + cancel_dirty_page(page); +#elif defined(HAVE_CANCEL_DIRTY_PAGE) + cancel_dirty_page(page, PAGE_SIZE); +#else + if (TestClearPageDirty(page)) + account_page_cleaned(page, mapping); +#endif /* HAVE_NEW_CANCEL_DIRTY_PAGE */ +} + +static inline void truncate_complete_page(struct address_space *mapping, struct page *page) { if (page->mapping != mapping) @@ -82,16 +95,12 @@ truncate_complete_page(struct address_space *mapping, struct page *page) if (PagePrivate(page)) #ifdef HAVE_INVALIDATE_RANGE - page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); + page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE); #else page->mapping->a_ops->invalidatepage(page, 0); #endif -#ifdef HAVE_CANCEL_DIRTY_PAGE - cancel_dirty_page(page, PAGE_SIZE); -#else - if (TestClearPageDirty(page)) - account_page_cleaned(page, mapping); -#endif /* HAVE_CANCEL_DIRTY_PAGE */ + + ll_cancel_dirty_page(mapping, page); ClearPageMappedToDisk(page); ll_delete_from_page_cache(page); } @@ -126,4 +135,8 @@ truncate_complete_page(struct address_space *mapping, struct page *page) #define ATTR_CTIME_SET (1 << 28) #endif +#ifndef HAVE_IN_COMPAT_SYSCALL +#define in_compat_syscall is_compat_task +#endif + #endif /* LUSTRE_PATCHLESS_COMPAT_H */