#include <linux/errno.h>
#include <linux/locks.h>
#include <linux/unistd.h>
-
+#include <linux/version.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/lustre_mds.h>
#include <linux/lustre_light.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10))
/*
* Add a page to the dirty page list.
*/
if (mapping->host)
mark_inode_dirty_pages(mapping->host);
}
+#else
+/*
+ * Add a page to the dirty page list.
+ */
+void set_page_dirty(struct page *page)
+{
+ if (!test_and_set_bit(PG_dirty, &page->flags)) {
+ struct address_space *mapping = page->mapping;
+
+ if (mapping) {
+ spin_lock(&pagecache_lock);
+ list_del(&page->list);
+ list_add(&page->list, &mapping->dirty_pages);
+ spin_unlock(&pagecache_lock);
+
+ if (mapping->host)
+ mark_inode_dirty_pages(mapping->host);
+ }
+ }
+}
+#endif
static void inline ll_oa_from_inode(struct obdo *oa, struct inode *inode)
{
}
} /* ll_oa_from_inode */
-/*
- * Add a page to the dirty page list.
- */
-#if 0
-void set_page_dirty(struct page *page)
-{
- if (!test_and_set_bit(PG_dirty, &page->flags)) {
- struct address_space *mapping = page->mapping;
-
- if (mapping) {
- list_del(&page->list);
- list_add(&page->list, &mapping->dirty_pages);
-
- if (mapping->host)
- mark_inode_dirty_pages(mapping->host);
- }
- }
-}
-#endif
#include <linux/errno.h>
#include <linux/locks.h>
#include <linux/unistd.h>
+#include <linux/version.h>
#include <asm/system.h>
#include <asm/uaccess.h>
/* page cache support stuff */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
+/*
+ * Add a page to the dirty page list.
+ */
+void __set_page_dirty(struct page *page)
+{
+ struct address_space *mapping;
+ spinlock_t *pg_lock;
+
+ pg_lock = PAGECACHE_LOCK(page);
+ spin_lock(pg_lock);
+ mapping = page->mapping;
+ spin_lock(&mapping->page_lock);
+
+ list_del(&page->list);
+ list_add(&page->list, &mapping->dirty_pages);
+
+ spin_unlock(&mapping->page_lock);
+ spin_unlock(pg_lock);
+
+ if (mapping->host)
+ mark_inode_dirty_pages(mapping->host);
+}
+/*
+ * Remove page from dirty list
+ */
+void __set_page_clean(struct page *page)
+{
+ struct address_space *mapping = page->mapping;
+ struct inode *inode;
+
+ if (!mapping)
+ return;
+
+ list_del(&page->list);
+ list_add(&page->list, &mapping->clean_pages);
+
+ inode = mapping->host;
+ if (list_empty(&mapping->dirty_pages)) {
+ CDEBUG(D_INODE, "inode clean\n");
+ inode->i_state &= ~I_DIRTY_PAGES;
+ }
+ EXIT;
+}
+
+#else
/*
* Add a page to the dirty page list.
*/
}
}
}
-
/*
* Remove page from dirty list
*/
EXIT;
}
+#endif
+
+
inline void set_page_clean(struct page *page)
{
if (PageDirty(page)) {