X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Flproc_llite.c;h=d432d1b0fce92845284421acf2f7c2c6e4166b10;hb=926c6309185a25a8ac1541cfa67910325ed8626f;hp=9f1987ca7e7d48817ebc1c16ff1a397364784e1a;hpb=7a7e17d4db28fac1ca4bc333d60cbeb8dbc530d6;p=fs%2Flustre-release.git diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 9f1987c..d432d1b0 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -161,14 +161,6 @@ static int ll_rd_filesfree(char *page, char **start, off_t off, int count, } -#if 0 -static int ll_rd_path(char *page, char **start, off_t off, int count, int *eof, - void *data) -{ - return 0; -} -#endif - static int ll_rd_fstype(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -212,7 +204,7 @@ static int ll_wr_read_ahead(struct file *file, const char *buffer, ENTRY; if (1 != sscanf(buffer, "%d", &readahead)) - RETURN(-EINVAL); + RETURN(-EINVAL); if (readahead) sbi->ll_flags |= LL_SBI_READAHEAD; @@ -222,6 +214,52 @@ static int ll_wr_read_ahead(struct file *file, const char *buffer, RETURN(count); } +static int ll_wr_config_update(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct super_block *sb = (struct super_block*)data; + struct ll_sb_info *sbi = ll_s2sbi(sb); + ENTRY; + + CWARN("Starting a LOV/OST update !\n"); + RETURN(ll_process_config_update(sbi, 0)); +} + +static int ll_rd_max_read_ahead_mb(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct super_block *sb = data; + struct ll_sb_info *sbi = ll_s2sbi(sb); + unsigned val; + + spin_lock(&sbi->ll_lock); + val = (sbi->ll_max_read_ahead_pages << PAGE_CACHE_SHIFT) >> 20; + spin_unlock(&sbi->ll_lock); + + return snprintf(page, count, "%u\n", val); +} + +static int ll_wr_max_read_ahead_mb(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct super_block *sb = data; + struct ll_sb_info *sbi = ll_s2sbi(sb); + int val, rc; + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + return rc; + + if (val < 0 || val > (num_physpages << PAGE_SHIFT) >> 20) + return -ERANGE; + + spin_lock(&sbi->ll_lock); + sbi->ll_max_read_ahead_pages = (val << 20) >> PAGE_CACHE_SHIFT; + spin_unlock(&sbi->ll_lock); + + return count; +} + static struct lprocfs_vars lprocfs_obd_vars[] = { { "uuid", ll_rd_sb_uuid, 0, 0 }, //{ "mntpt_path", ll_rd_path, 0, 0 }, @@ -234,6 +272,9 @@ static struct lprocfs_vars lprocfs_obd_vars[] = { { "filesfree", ll_rd_filesfree, 0, 0 }, //{ "filegroups", lprocfs_rd_filegroups, 0, 0 }, { "read_ahead", ll_rd_read_ahead, ll_wr_read_ahead, 0 }, + { "config_update", 0, ll_wr_config_update, 0 }, + { "max_read_ahead_mb", ll_rd_max_read_ahead_mb, + ll_wr_max_read_ahead_mb, 0 }, { 0 } }; @@ -463,15 +504,15 @@ static int llite_dump_pgcache_seq_show(struct seq_file *seq, void *v) return 0; } - spin_lock(&sbi->ll_pglist_lock); + spin_lock(&sbi->ll_lock); llap = llite_pglist_next_llap(sbi, &dummy_llap->llap_proc_item); if (llap != NULL) { int has_flags = 0; struct page *page = llap->llap_page; - seq_printf(seq, "%lu | %p %p | %p %p %lu [", - sbi->ll_pglist_gen, + seq_printf(seq, "%lu | %p %p | %p %p %lu [", + sbi->ll_pglist_gen, llap, llap->llap_cookie, page, page->mapping->host, page->index); seq_page_flag(seq, page, locked, has_flags); @@ -482,11 +523,11 @@ static int llite_dump_pgcache_seq_show(struct seq_file *seq, void *v) seq_page_flag(seq, page, highmem, has_flags); if (!has_flags) seq_puts(seq, "-]\n"); - else + else seq_puts(seq, "]\n"); } - spin_unlock(&sbi->ll_pglist_lock); + spin_unlock(&sbi->ll_lock); return 0; } @@ -501,7 +542,7 @@ static void *llite_dump_pgcache_seq_start(struct seq_file *seq, loff_t *pos) return (void *)1; } -static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v, +static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct ll_async_page *llap, *dummy_llap = seq->private; @@ -516,14 +557,14 @@ static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v, /* we've just displayed the llap that is after us in the list. * we advance to a position beyond it, returning null if there * isn't another llap in the list beyond that new position. */ - spin_lock(&sbi->ll_pglist_lock); + spin_lock(&sbi->ll_lock); llap = llite_pglist_next_llap(sbi, &dummy_llap->llap_proc_item); list_del_init(&dummy_llap->llap_proc_item); if (llap) { list_add(&dummy_llap->llap_proc_item, &llap->llap_proc_item); llap = llite_pglist_next_llap(sbi, &dummy_llap->llap_proc_item); } - spin_unlock(&sbi->ll_pglist_lock); + spin_unlock(&sbi->ll_lock); ++*pos; if (llap == NULL) { @@ -578,9 +619,9 @@ static int llite_dump_pgcache_seq_open(struct inode *inode, struct file *file) seq = file->private_data; seq->private = llap; - spin_lock(&sbi->ll_pglist_lock); + spin_lock(&sbi->ll_lock); list_add(&llap->llap_proc_item, &sbi->ll_pglist); - spin_unlock(&sbi->ll_pglist_lock); + spin_unlock(&sbi->ll_lock); return 0; } @@ -592,10 +633,10 @@ static int llite_dump_pgcache_seq_release(struct inode *inode, struct ll_async_page *llap = seq->private; struct ll_sb_info *sbi = llap->llap_cookie; - spin_lock(&sbi->ll_pglist_lock); + spin_lock(&sbi->ll_lock); if (!list_empty(&llap->llap_proc_item)) list_del_init(&llap->llap_proc_item); - spin_unlock(&sbi->ll_pglist_lock); + spin_unlock(&sbi->ll_lock); OBD_FREE(llap, sizeof(*llap)); return seq_release(inode, file);