X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_patchless_compat.h;h=2ad8bce19ac53d70670ded95ca861e2962424fc0;hb=6f8d0e2905286cadda1564ace6c2e6b034f0dfd6;hp=3ef2b0b2303d99e01725ae839f6d83df5ec5ef39;hpb=bca975c7fa261ffb926e8a18d5869b886c65f447;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_patchless_compat.h b/lustre/include/lustre_patchless_compat.h index 3ef2b0b..2ad8bce 100644 --- a/lustre/include/lustre_patchless_compat.h +++ b/lustre/include/lustre_patchless_compat.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -38,10 +34,9 @@ #define LUSTRE_PATCHLESS_COMPAT_H #include - +#include #ifndef HAVE_TRUNCATE_COMPLETE_PAGE #include -#include #include #ifndef HAVE_DELETE_FROM_PAGE_CACHE /* 2.6.39 */ @@ -69,13 +64,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) @@ -83,11 +91,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 - cancel_dirty_page(page, PAGE_SIZE); + + ll_cancel_dirty_page(mapping, page); ClearPageMappedToDisk(page); ll_delete_from_page_cache(page); } @@ -122,4 +131,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 */