X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fsuper.c;h=40ae6238b0eac84768155a9d059b6e34619c8b6e;hb=400b0681017091fab9cef9bd00e0f536e1793dcc;hp=554c28dcf5773559e645b02601c2d02f6187a71a;hpb=1c83e36b0591a065c279d8dc3e137fb6b0fc032e;p=fs%2Flustre-release.git diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 554c28d..40ae623 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -20,6 +20,8 @@ #include #include #include +#include + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) kmem_cache_t *ll_file_data_slab; @@ -31,6 +33,15 @@ extern int ll_recover(struct recovd_data *, int); extern int ll_commitcbd_setup(struct ll_sb_info *); extern int ll_commitcbd_cleanup(struct ll_sb_info *); +extern int rd_dev_uuid(char* page, char **start, off_t off, + int count, int *eof, void *data); + +extern int rd_dev_name(char* page, char **start, off_t off, + int count, int *eof, void *data); + + +extern lprocfs_vars_t status_var_nm_1[]; + static char *ll_read_opt(const char *opt, char *data) { char *value; @@ -109,6 +120,14 @@ static struct super_block * ll_read_super(struct super_block *sb, struct ll_read_inode2_cookie lic; class_uuid_t uuid; + + /* Lprocfs variables */ + char mnt_name[100]; + char uuid_name[100]; + lprocfs_vars_t d_vars[3]; + + + ENTRY; MOD_INC_USE_COUNT; @@ -218,6 +237,65 @@ static struct super_block * ll_read_super(struct super_block *sb, ptlrpc_req_finished(request); request = NULL; + + /* Register this mount instance with LProcFS */ + + snprintf(mnt_name, 100, "mount_%s", sbi->ll_sb_uuid); + sbi->ll_mnt_root=lprocfs_reg_mnt(mnt_name); + if(!sbi->ll_mnt_root) + goto out_dev; + + /* Add the static configuration info */ + lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)status_var_nm_1, + (void*)sb); + + /* Add the dynamic configuration stuff */ + /* MDC */ + obd = class_uuid2obd(mdc); + + /* Reuse mnt_name */ + + sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name); + + memset(d_vars, 0, sizeof(d_vars)); + d_vars[0].read_fptr=rd_dev_name; + d_vars[0].write_fptr=0; + d_vars[0].name=(char*)mnt_name; + + memset(uuid_name, '\0', strlen(uuid_name)); + sprintf(uuid_name, "status/%s/uuid", obd->obd_type->typ_name); + d_vars[1].read_fptr=rd_dev_uuid; + d_vars[1].write_fptr=0; + d_vars[1].name=(char*)uuid_name; + + err=lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)d_vars, + (void*)obd); + if (err) { + CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables"); + } + + /* OSC or LOV*/ + obd = class_uuid2obd(osc); + /* Reuse mnt_name */ + memset(mnt_name, '\0', strlen(mnt_name)); + sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name); + + memset(d_vars, 0, sizeof(d_vars)); + d_vars[0].read_fptr=rd_dev_name; + d_vars[0].write_fptr=0; + d_vars[0].name=(char*)mnt_name; + + memset(uuid_name, '\0', strlen(uuid_name)); + sprintf(uuid_name, "status/%s/uuid", obd->obd_type->typ_name); + d_vars[1].read_fptr=rd_dev_uuid; + d_vars[1].write_fptr=0; + d_vars[1].name=(char*)uuid_name; + + err=lprocfs_add_vars(sbi->ll_mnt_root, (lprocfs_vars_t*)d_vars, + (void*)obd); + if (err) { + CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables"); + } out_dev: if (mdc) OBD_FREE(mdc, strlen(mdc) + 1); @@ -258,6 +336,7 @@ static void ll_put_super(struct super_block *sb) */ mdc_getstatus(&sbi->ll_mdc_conn, &rootfid); + lprocfs_dereg_mnt(sbi->ll_mnt_root); obd_disconnect(&sbi->ll_mdc_conn); OBD_FREE(sbi, sizeof(*sbi));