1 #ifndef LUSTRE_PATCHLESS_COMPAT_H
2 #define LUSTRE_PATCHLESS_COMPAT_H
4 #include <linux/lustre_version.h>
5 #ifndef LUSTRE_KERNEL_VERSION
8 #ifndef HAVE_TRUNCATE_COMPLETE_PAGE
9 #include <linux/list.h>
11 #include <linux/hash.h>
13 /* XXX copy & paste from 2.6.15 kernel */
14 static inline void ll_remove_from_page_cache(struct page *page)
16 struct address_space *mapping = page->mapping;
18 BUG_ON(!PageLocked(page));
20 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
21 write_lock_irq(&mapping->tree_lock);
23 spin_lock_irq(&mapping->tree_lock);
25 radix_tree_delete(&mapping->page_tree, page->index);
28 #ifdef HAVE_NR_PAGECACHE
29 atomic_add(-1, &nr_pagecache); // XXX pagecache_acct(-1);
31 __dec_zone_page_state(page, NR_FILE_PAGES);
33 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
34 write_unlock_irq(&mapping->tree_lock);
36 spin_unlock_irq(&mapping->tree_lock);
41 truncate_complete_page(struct address_space *mapping, struct page *page)
43 if (page->mapping != mapping)
46 if (PagePrivate(page))
47 page->mapping->a_ops->invalidatepage(page, 0);
49 clear_page_dirty(page);
50 ClearPageUptodate(page);
51 ClearPageMappedToDisk(page);
52 ll_remove_from_page_cache(page);
53 page_cache_release(page); /* pagecache ref */
58 static inline void d_rehash_cond(struct dentry * entry, int lock)
61 spin_unlock(&dcache_lock);
66 spin_lock(&dcache_lock);
69 #define __d_rehash(dentry, lock) d_rehash_cond(dentry, lock)
71 #define LUSTRE_PATCHLESS
73 #ifndef ATTR_FROM_OPEN
74 #define ATTR_FROM_OPEN 0
80 #endif /* LUSTRE_KERNEL_VERSION */