From 59c99920ab7ba29ec727864e43714c6346a43887 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 13 Oct 2008 15:04:36 +0000 Subject: [PATCH] b=12182 i=adilger i=green i=nikita - oss read-only cache feature --- lustre/obdfilter/filter.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 8d0b4d4..4eb05f8 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1934,6 +1934,8 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, INIT_LIST_HEAD(&filter->fo_export_list); sema_init(&filter->fo_alloc_lock, 1); init_brw_stats(&filter->fo_filter_stats); + filter->fo_read_cache = 1; /* enable read-only cache by default */ + filter->fo_writethrough_cache = 0; /* disable writethrough cache */ filter->fo_readcache_max_filesize = FILTER_MAX_CACHE_SIZE; filter->fo_fmd_max_num = FILTER_FMD_MAX_NUM_DEFAULT; filter->fo_fmd_max_age = FILTER_FMD_MAX_AGE_DEFAULT; @@ -2048,6 +2050,21 @@ static int filter_setup(struct obd_device *obd, obd_count len, void *buf) lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_WRITE_BYTES, LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes"); + lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_GET_PAGE, + LPROCFS_CNTR_AVGMINMAX|LPROCFS_CNTR_STDDEV, + "get_page", "usec"); + lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_NO_PAGE, + LPROCFS_CNTR_AVGMINMAX, + "get_page failures", "num"); + lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_CACHE_ACCESS, + LPROCFS_CNTR_AVGMINMAX, + "cache_access", "pages"); + lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_CACHE_HIT, + LPROCFS_CNTR_AVGMINMAX, + "cache_hit", "pages"); + lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_CACHE_MISS, + LPROCFS_CNTR_AVGMINMAX, + "cache_miss", "pages"); lproc_filter_attach_seqstat(obd); lprocfs_obd_attach_stale_exports(obd); obd->obd_proc_exports_entry = proc_mkdir("exports", @@ -2805,13 +2822,8 @@ int filter_setattr_internal(struct obd_export *exp, struct dentry *dentry, } if (locked) { - /* Let's flush truncated page on disk immediately, then we can - * avoid need to search for page aliases before directio writes - * and this sort of stuff at expense of somewhat slower - * truncates not on a page boundary. I believe this is the only - * place in filter code that can lead to pages getting to - * pagecache so far. */ - filter_clear_truncated_page(inode); + /* truncate can leave dirty pages in the cache. + * we'll take care of them in write path -bzzz */ UNLOCK_INODE_MUTEX(inode); locked = 0; } -- 1.8.3.1