This change adds simple accounting hooks for "unstable" pages on a per
OSC basis. Now, in addition to the per filesystem tracking, each OSC
will maintain a running total of its unstable pages. These counters are
exported through the proc interface, and can be read using the lctl
command.
For example:
# Read number of unstable pages contained by each OSC
lctl get_param osc.*.unstable_stats
The motivation for this change is in anticipation of implementing a
"soft sync" functionality, urging servers to commit these unstable
pages to stable storage. The per OSC accounting allows a client to
limit the soft sync request to only the OSCs which have outstanding
unstable pages.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Change-Id: Ife1f90515cb60ba9f85daba5d50483562f2697d1
Reviewed-on: http://review.whamcloud.com/4374
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
cfs_atomic_t cl_lru_in_list;
cfs_list_t cl_lru_list; /* lru page list */
client_obd_lock_t cl_lru_list_lock; /* page list protector */
cfs_atomic_t cl_lru_in_list;
cfs_list_t cl_lru_list; /* lru page list */
client_obd_lock_t cl_lru_list_lock; /* page list protector */
+ cfs_atomic_t cl_unstable_count;
/* number of in flight destroy rpcs is limited to max_rpcs_in_flight */
cfs_atomic_t cl_destroy_in_flight;
/* number of in flight destroy rpcs is limited to max_rpcs_in_flight */
cfs_atomic_t cl_destroy_in_flight;
cfs_atomic_set(&cli->cl_lru_in_list, 0);
CFS_INIT_LIST_HEAD(&cli->cl_lru_list);
client_obd_list_lock_init(&cli->cl_lru_list_lock);
cfs_atomic_set(&cli->cl_lru_in_list, 0);
CFS_INIT_LIST_HEAD(&cli->cl_lru_list);
client_obd_list_lock_init(&cli->cl_lru_list_lock);
+ cfs_atomic_set(&cli->cl_unstable_count, 0);
init_waitqueue_head(&cli->cl_destroy_waitq);
cfs_atomic_set(&cli->cl_destroy_in_flight, 0);
init_waitqueue_head(&cli->cl_destroy_waitq);
cfs_atomic_set(&cli->cl_destroy_in_flight, 0);
+static int osc_rd_unstable_stats(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int pages, mb;
+
+ pages = cfs_atomic_read(&cli->cl_unstable_count);
+ mb = (pages * PAGE_CACHE_SIZE) >> 20;
+
+ return snprintf(page, count,
+ "unstable_pages: %8d\n"
+ "unstable_mb: %8d\n",
+ pages, mb);
+}
+
static struct lprocfs_vars lprocfs_osc_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "ping", 0, lprocfs_wr_ping, 0, 0, 0222 },
static struct lprocfs_vars lprocfs_osc_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "ping", 0, lprocfs_wr_ping, 0, 0, 0222 },
{ "state", lprocfs_rd_state, 0, 0 },
{ "pinger_recov", lprocfs_rd_pinger_recov,
lprocfs_wr_pinger_recov, 0, 0 },
{ "state", lprocfs_rd_state, 0, 0 },
{ "pinger_recov", lprocfs_rd_pinger_recov,
lprocfs_wr_pinger_recov, 0, 0 },
+ { "unstable_stats", osc_rd_unstable_stats, 0, 0},
+
cfs_atomic_sub(page_count, &cli->cl_cache->ccc_unstable_nr);
LASSERT(cfs_atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0);
cfs_atomic_sub(page_count, &cli->cl_cache->ccc_unstable_nr);
LASSERT(cfs_atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0);
+ cfs_atomic_sub(page_count, &cli->cl_unstable_count);
+ LASSERT(cfs_atomic_read(&cli->cl_unstable_count) >= 0);
+
cfs_atomic_sub(page_count, &obd_unstable_pages);
LASSERT(cfs_atomic_read(&obd_unstable_pages) >= 0);
cfs_atomic_sub(page_count, &obd_unstable_pages);
LASSERT(cfs_atomic_read(&obd_unstable_pages) >= 0);
LASSERT(cfs_atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0);
cfs_atomic_add(page_count, &cli->cl_cache->ccc_unstable_nr);
LASSERT(cfs_atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0);
cfs_atomic_add(page_count, &cli->cl_cache->ccc_unstable_nr);
+ LASSERT(cfs_atomic_read(&cli->cl_unstable_count) >= 0);
+ cfs_atomic_add(page_count, &cli->cl_unstable_count);
+
LASSERT(cfs_atomic_read(&obd_unstable_pages) >= 0);
cfs_atomic_add(page_count, &obd_unstable_pages);
LASSERT(cfs_atomic_read(&obd_unstable_pages) >= 0);
cfs_atomic_add(page_count, &obd_unstable_pages);