X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_lproc.c;h=b9b4e3d5dab83d0eb8070334eb4b42aadb7a48a0;hb=be41e2ce0d71a707da703e6f8e82d397be839d23;hp=87a8c08a13216b5e217b92fea0e7a7019d9ef8ce;hpb=98060d83459ba10409f295898f0ec917f938b4d3;p=fs%2Flustre-release.git diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 87a8c08..b9b4e3d 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -63,7 +63,7 @@ void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf) if (unlikely(nr_pages == 0)) return; - blocks_per_page = CFS_PAGE_SIZE >> osd_sb(osd)->s_blocksize_bits; + blocks_per_page = PAGE_CACHE_SIZE >> osd_sb(osd)->s_blocksize_bits; lprocfs_oh_tally_log2(&s->hist[BRW_R_PAGES+rw], nr_pages); @@ -125,12 +125,12 @@ static void display_brw_stats(struct seq_file *seq, char *name, char *units, static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats) { - struct timeval now; + struct timeval now; - /* this sampling races with updates */ - cfs_gettimeofday(&now); - seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", - now.tv_sec, now.tv_usec); + /* this sampling races with updates */ + do_gettimeofday(&now); + seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", + now.tv_sec, now.tv_usec); display_brw_stats(seq, "pages per bulk r/w", "rpcs", &brw_stats->hist[BRW_R_PAGES], @@ -152,9 +152,9 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats) &brw_stats->hist[BRW_R_RPC_HIST], &brw_stats->hist[BRW_W_RPC_HIST], 0); - display_brw_stats(seq, "I/O time (1/1000s)", "ios", - &brw_stats->hist[BRW_R_IO_TIME], - &brw_stats->hist[BRW_W_IO_TIME], 1000 / CFS_HZ); + display_brw_stats(seq, "I/O time (1/1000s)", "ios", + &brw_stats->hist[BRW_R_IO_TIME], + &brw_stats->hist[BRW_W_IO_TIME], 1000 / HZ); display_brw_stats(seq, "disk I/O size", "ios", &brw_stats->hist[BRW_R_DISK_IOSIZE], @@ -239,7 +239,6 @@ out: int osd_procfs_init(struct osd_device *osd, const char *name) { - struct lprocfs_static_vars lvars; struct obd_type *type; int rc; ENTRY; @@ -252,9 +251,9 @@ int osd_procfs_init(struct osd_device *osd, const char *name) LASSERT(type != NULL); /* Find the type procroot and add the proc entry for this device */ - lprocfs_osd_init_vars(&lvars); osd->od_proc_entry = lprocfs_register(name, type->typ_procroot, - lvars.obd_vars, &osd->od_dt_dev); + lprocfs_osd_obd_vars, + &osd->od_dt_dev); if (IS_ERR(osd->od_proc_entry)) { rc = PTR_ERR(osd->od_proc_entry); CERROR("Error %d setting up lprocfs for %s\n", @@ -514,6 +513,38 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer, return count; } +static int lprocfs_osd_rd_lma_self_repair(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct osd_device *dev = osd_dt_dev(data); + + LASSERT(dev != NULL); + if (unlikely(dev->od_mnt == NULL)) + return -EINPROGRESS; + + *eof = 1; + return snprintf(page, count, "%d\n", !!dev->od_lma_self_repair); +} + +static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct osd_device *dev = osd_dt_dev(data); + int val; + int rc; + + LASSERT(dev != NULL); + if (unlikely(dev->od_mnt == NULL)) + return -EINPROGRESS; + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + return rc; + + dev->od_lma_self_repair = !!val; + return count; +} + struct lprocfs_vars lprocfs_osd_obd_vars[] = { { "blocksize", lprocfs_dt_rd_blksize, 0, 0 }, { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 }, @@ -534,6 +565,8 @@ struct lprocfs_vars lprocfs_osd_obd_vars[] = { lprocfs_osd_wr_wcache, 0 }, { "readcache_max_filesize", lprocfs_osd_rd_readcache, lprocfs_osd_wr_readcache, 0 }, + { "lma_self_repair", lprocfs_osd_rd_lma_self_repair, + lprocfs_osd_wr_lma_self_repair, 0, 0 }, { 0 } }; @@ -545,9 +578,4 @@ struct lprocfs_vars lprocfs_osd_module_vars[] = { { 0 } }; -void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars) -{ - lvars->module_vars = lprocfs_osd_module_vars; - lvars->obd_vars = lprocfs_osd_obd_vars; -} #endif