X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2FLINUX%2Fosi_vnodeops.c;h=48c25aac7e3694c62344fd3898baa7e0c82bbaca;hp=df50a90c47182c0d3adae41e88b68c666a1c551b;hb=17b42fe67c18fab0003fb712092d36f06c93f2eb;hpb=dca95bcb7efdff38564dcff3e8f4189735f13b3a diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index df50a90..48c25aa 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -31,7 +31,11 @@ #endif #include #include -#include +#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) +# include +#else +# include +#endif #include #include "afs/lock.h" #include "afs/afs_bypasscache.h" @@ -67,6 +71,36 @@ extern struct vcache *afs_globalVp; /* Handle interfacing with Linux's pagevec/lru facilities */ +#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) + +/* + * Linux's lru_cache_add_file provides a simplified LRU interface without + * needing a pagevec + */ +struct afs_lru_pages { + char unused; +}; + +static inline void +afs_lru_cache_init(struct afs_lru_pages *alrupages) +{ + return; +} + +static inline void +afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page) +{ + lru_cache_add_file(page); +} + +static inline void +afs_lru_cache_finalize(struct afs_lru_pages *alrupages) +{ + return; +} +#else + +/* Linux's pagevec/lru interfaces require a pagevec */ struct afs_lru_pages { struct pagevec lrupv; }; @@ -74,16 +108,16 @@ struct afs_lru_pages { static inline void afs_lru_cache_init(struct afs_lru_pages *alrupages) { -#if defined(PAGEVEC_INIT_COLD_ARG) +# if defined(PAGEVEC_INIT_COLD_ARG) pagevec_init(&alrupages->lrupv, 0); -#else +# else pagevec_init(&alrupages->lrupv); -#endif +# endif } -#ifndef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE -# define __pagevec_lru_add_file __pagevec_lru_add -#endif +# ifndef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE +# define __pagevec_lru_add_file __pagevec_lru_add +# endif static inline void afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page) @@ -99,6 +133,7 @@ afs_lru_cache_finalize(struct afs_lru_pages *alrupages) if (pagevec_count(&alrupages->lrupv)) __pagevec_lru_add_file(&alrupages->lrupv); } +#endif /* !HAVE_LINUX_LRU_ADD_FILE */ /* This function converts a positive error code from AFS into a negative * code suitable for passing into the Linux VFS layer. It checks that the