From c5774d112de7663c0773bf4e4a4e5523131bcdb1 Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 12 Oct 2005 20:46:16 +0000 Subject: [PATCH] cleanup llap_from_page(): - add explicit LLAP_FROM_REMOVEPAGE - make llap_from_page() static - fix inverted condition in llap_from_page(). b=5047 r=adilger --- lustre/llite/llite_internal.h | 6 +++++- lustre/llite/rw.c | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index c3d963a..dfefb72 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -275,12 +275,17 @@ struct ll_async_page { __u32 llap_checksum; }; +/* + * enumeration of llap_from_page() call-sites. Used to export statistics in + * /proc/fs/lustre/llite/fsN/dump_page_cache. + */ enum { LLAP_ORIGIN_UNKNOWN = 0, LLAP_ORIGIN_READPAGE, LLAP_ORIGIN_READAHEAD, LLAP_ORIGIN_COMMIT_WRITE, LLAP_ORIGIN_WRITEPAGE, + LLAP_ORIGIN_REMOVEPAGE, LLAP__ORIGIN_MAX, }; extern char *llap_origins[]; @@ -337,7 +342,6 @@ extern struct cache_definition ll_cache_definition; void ll_removepage(struct page *page); int ll_readpage(struct file *file, struct page *page); struct ll_async_page *llap_from_cookie(void *cookie); -struct ll_async_page *llap_from_page(struct page *page, unsigned origin); struct ll_async_page *llap_cast_private(struct page *page); void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras); void ll_ra_accounting(struct page *page, struct address_space *mapping); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 1b86074..5f64cbc 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -492,7 +492,7 @@ int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction) return count; } -struct ll_async_page *llap_from_page(struct page *page, unsigned origin) +static struct ll_async_page *llap_from_page(struct page *page, unsigned origin) { struct ll_async_page *llap; struct obd_export *exp; @@ -506,8 +506,9 @@ struct ll_async_page *llap_from_page(struct page *page, unsigned origin) llap = llap_cast_private(page); if (llap != NULL) { - /* move to end of LRU list */ - if (origin == 0) { + /* move to end of LRU list, except when page is just about to + * die */ + if (origin != LLAP_ORIGIN_REMOVEPAGE) { spin_lock(&sbi->ll_lock); sbi->ll_pglist_gen++; list_del_init(&llap->llap_pglist_item); -- 1.8.3.1