1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #include <sys/types.h> 27 #include <sys/kstat.h> 28 #include <sys/zone.h> 29 #include <sys/kmem.h> 30 #include <sys/systm.h> 31 32 #include <nfs/nfs.h> 33 #include <nfs/nfs4_kprot.h> 34 35 /* 36 * Key to retrieve per-zone data corresponding to NFS kstats consumed by 37 * nfsstat(1m). 38 */ 39 zone_key_t nfsstat_zone_key; 40 41 /* 42 * Convenience routine to create a named kstat associated with zoneid, named 43 * module:0:name:"misc", using the provided template to initialize the names 44 * and values of the stats. 45 */ 46 static kstat_named_t * 47 nfsstat_zone_init_common(zoneid_t zoneid, const char *module, int vers, 48 const char *name, const kstat_named_t *template, 49 size_t template_size) 50 { 51 kstat_t *ksp; 52 kstat_named_t *ks_data; 53 54 ks_data = kmem_alloc(template_size, KM_SLEEP); 55 bcopy(template, ks_data, template_size); 56 if ((ksp = kstat_create_zone(module, vers, name, "misc", 57 KSTAT_TYPE_NAMED, template_size / sizeof (kstat_named_t), 58 KSTAT_FLAG_VIRTUAL | KSTAT_FLAG_WRITABLE, zoneid)) != NULL) { 59 ksp->ks_data = ks_data; 60 kstat_install(ksp); 61 } 62 return (ks_data); 63 } 64 65 /* 66 * Convenience routine to remove a kstat in specified zone with name 67 * module:0:name. 68 */ 69 static void 70 nfsstat_zone_fini_common(zoneid_t zoneid, const char *module, int vers, 71 const char *name) 72 { 73 kstat_delete_byname_zone(module, vers, name, zoneid); 74 } 75 76 /* 77 * Server statistics. These are defined here, rather than in the server 78 * code, so that they can be referenced before the nfssrv kmod is loaded. 79 * 80 * The "calls" counter is a Contract Private interface covered by 81 * PSARC/2001/357. Please contact contract-2001-357-01@eng.sun.com before 82 * making any changes. 83 */ 84 85 static const kstat_named_t svstat_tmpl[] = { 86 { "calls", KSTAT_DATA_UINT64 }, 87 { "badcalls", KSTAT_DATA_UINT64 }, 88 { "referrals", KSTAT_DATA_UINT64 }, 89 { "referlinks", KSTAT_DATA_UINT64 }, 90 }; 91 92 static void 93 nfsstat_zone_init_server(zoneid_t zoneid, kstat_named_t *svstatp[]) 94 { 95 int vers; 96 97 for (vers = NFS_VERSION; vers <= NFS_V4; vers++) { 98 svstatp[vers] = nfsstat_zone_init_common(zoneid, "nfs", vers, 99 "nfs_server", svstat_tmpl, sizeof (svstat_tmpl)); 100 } 101 } 102 103 static void 104 nfsstat_zone_fini_server(zoneid_t zoneid, kstat_named_t *svstatp[]) 105 { 106 int vers; 107 for (vers = NFS_VERSION; vers <= NFS_V4; vers++) { 108 nfsstat_zone_fini_common(zoneid, "nfs", vers, "nfs_server"); 109 kmem_free(svstatp[vers], sizeof (svstat_tmpl)); 110 } 111 } 112 113 /* 114 * NFSv2 client stats 115 */ 116 static const kstat_named_t rfsreqcnt_v2_tmpl[] = { 117 { "null", KSTAT_DATA_UINT64 }, 118 { "getattr", KSTAT_DATA_UINT64 }, 119 { "setattr", KSTAT_DATA_UINT64 }, 120 { "root", KSTAT_DATA_UINT64 }, 121 { "lookup", KSTAT_DATA_UINT64 }, 122 { "readlink", KSTAT_DATA_UINT64 }, 123 { "read", KSTAT_DATA_UINT64 }, 124 { "wrcache", KSTAT_DATA_UINT64 }, 125 { "write", KSTAT_DATA_UINT64 }, 126 { "create", KSTAT_DATA_UINT64 }, 127 { "remove", KSTAT_DATA_UINT64 }, 128 { "rename", KSTAT_DATA_UINT64 }, 129 { "link", KSTAT_DATA_UINT64 }, 130 { "symlink", KSTAT_DATA_UINT64 }, 131 { "mkdir", KSTAT_DATA_UINT64 }, 132 { "rmdir", KSTAT_DATA_UINT64 }, 133 { "readdir", KSTAT_DATA_UINT64 }, 134 { "statfs", KSTAT_DATA_UINT64 } 135 }; 136 137 static void 138 nfsstat_zone_init_rfsreq_v2(zoneid_t zoneid, struct nfs_version_stats *statsp) 139 { 140 statsp->rfsreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs", 0, 141 "rfsreqcnt_v2", rfsreqcnt_v2_tmpl, sizeof (rfsreqcnt_v2_tmpl)); 142 } 143 144 static void 145 nfsstat_zone_fini_rfsreq_v2(zoneid_t zoneid, struct nfs_version_stats *statsp) 146 { 147 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsreqcnt_v2"); 148 kmem_free(statsp->rfsreqcnt_ptr, sizeof (rfsreqcnt_v2_tmpl)); 149 } 150 151 /* 152 * NFSv2 server stats 153 */ 154 static const kstat_named_t rfsproccnt_v2_tmpl[] = { 155 { "null", KSTAT_DATA_UINT64 }, 156 { "getattr", KSTAT_DATA_UINT64 }, 157 { "setattr", KSTAT_DATA_UINT64 }, 158 { "root", KSTAT_DATA_UINT64 }, 159 { "lookup", KSTAT_DATA_UINT64 }, 160 { "readlink", KSTAT_DATA_UINT64 }, 161 { "read", KSTAT_DATA_UINT64 }, 162 { "wrcache", KSTAT_DATA_UINT64 }, 163 { "write", KSTAT_DATA_UINT64 }, 164 { "create", KSTAT_DATA_UINT64 }, 165 { "remove", KSTAT_DATA_UINT64 }, 166 { "rename", KSTAT_DATA_UINT64 }, 167 { "link", KSTAT_DATA_UINT64 }, 168 { "symlink", KSTAT_DATA_UINT64 }, 169 { "mkdir", KSTAT_DATA_UINT64 }, 170 { "rmdir", KSTAT_DATA_UINT64 }, 171 { "readdir", KSTAT_DATA_UINT64 }, 172 { "statfs", KSTAT_DATA_UINT64 } 173 }; 174 175 /* 176 * NFSv2 client ACL stats 177 */ 178 static const kstat_named_t aclreqcnt_v2_tmpl[] = { 179 { "null", KSTAT_DATA_UINT64 }, 180 { "getacl", KSTAT_DATA_UINT64 }, 181 { "setacl", KSTAT_DATA_UINT64 }, 182 { "getattr", KSTAT_DATA_UINT64 }, 183 { "access", KSTAT_DATA_UINT64 }, 184 { "getxattrdir", KSTAT_DATA_UINT64 } 185 }; 186 187 static void 188 nfsstat_zone_init_aclreq_v2(zoneid_t zoneid, struct nfs_version_stats *statsp) 189 { 190 statsp->aclreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs_acl", 0, 191 "aclreqcnt_v2", aclreqcnt_v2_tmpl, sizeof (aclreqcnt_v2_tmpl)); 192 } 193 194 static void 195 nfsstat_zone_fini_aclreq_v2(zoneid_t zoneid, struct nfs_version_stats *statsp) 196 { 197 nfsstat_zone_fini_common(zoneid, "nfs_acl", 0, "aclreqcnt_v2"); 198 kmem_free(statsp->aclreqcnt_ptr, sizeof (aclreqcnt_v2_tmpl)); 199 } 200 201 /* 202 * NFSv2 server ACL stats 203 */ 204 static const kstat_named_t aclproccnt_v2_tmpl[] = { 205 { "null", KSTAT_DATA_UINT64 }, 206 { "getacl", KSTAT_DATA_UINT64 }, 207 { "setacl", KSTAT_DATA_UINT64 }, 208 { "getattr", KSTAT_DATA_UINT64 }, 209 { "access", KSTAT_DATA_UINT64 }, 210 { "getxattrdir", KSTAT_DATA_UINT64 } 211 }; 212 213 /* 214 * NFSv3 client stats 215 */ 216 static const kstat_named_t rfsreqcnt_v3_tmpl[] = { 217 { "null", KSTAT_DATA_UINT64 }, 218 { "getattr", KSTAT_DATA_UINT64 }, 219 { "setattr", KSTAT_DATA_UINT64 }, 220 { "lookup", KSTAT_DATA_UINT64 }, 221 { "access", KSTAT_DATA_UINT64 }, 222 { "readlink", KSTAT_DATA_UINT64 }, 223 { "read", KSTAT_DATA_UINT64 }, 224 { "write", KSTAT_DATA_UINT64 }, 225 { "create", KSTAT_DATA_UINT64 }, 226 { "mkdir", KSTAT_DATA_UINT64 }, 227 { "symlink", KSTAT_DATA_UINT64 }, 228 { "mknod", KSTAT_DATA_UINT64 }, 229 { "remove", KSTAT_DATA_UINT64 }, 230 { "rmdir", KSTAT_DATA_UINT64 }, 231 { "rename", KSTAT_DATA_UINT64 }, 232 { "link", KSTAT_DATA_UINT64 }, 233 { "readdir", KSTAT_DATA_UINT64 }, 234 { "readdirplus", KSTAT_DATA_UINT64 }, 235 { "fsstat", KSTAT_DATA_UINT64 }, 236 { "fsinfo", KSTAT_DATA_UINT64 }, 237 { "pathconf", KSTAT_DATA_UINT64 }, 238 { "commit", KSTAT_DATA_UINT64 } 239 }; 240 241 static void 242 nfsstat_zone_init_rfsreq_v3(zoneid_t zoneid, struct nfs_version_stats *statsp) 243 { 244 statsp->rfsreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs", 0, 245 "rfsreqcnt_v3", rfsreqcnt_v3_tmpl, sizeof (rfsreqcnt_v3_tmpl)); 246 } 247 248 static void 249 nfsstat_zone_fini_rfsreq_v3(zoneid_t zoneid, struct nfs_version_stats *statsp) 250 { 251 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsreqcnt_v3"); 252 kmem_free(statsp->rfsreqcnt_ptr, sizeof (rfsreqcnt_v3_tmpl)); 253 } 254 255 /* 256 * NFSv3 server stats 257 */ 258 static const kstat_named_t rfsproccnt_v3_tmpl[] = { 259 { "null", KSTAT_DATA_UINT64 }, 260 { "getattr", KSTAT_DATA_UINT64 }, 261 { "setattr", KSTAT_DATA_UINT64 }, 262 { "lookup", KSTAT_DATA_UINT64 }, 263 { "access", KSTAT_DATA_UINT64 }, 264 { "readlink", KSTAT_DATA_UINT64 }, 265 { "read", KSTAT_DATA_UINT64 }, 266 { "write", KSTAT_DATA_UINT64 }, 267 { "create", KSTAT_DATA_UINT64 }, 268 { "mkdir", KSTAT_DATA_UINT64 }, 269 { "symlink", KSTAT_DATA_UINT64 }, 270 { "mknod", KSTAT_DATA_UINT64 }, 271 { "remove", KSTAT_DATA_UINT64 }, 272 { "rmdir", KSTAT_DATA_UINT64 }, 273 { "rename", KSTAT_DATA_UINT64 }, 274 { "link", KSTAT_DATA_UINT64 }, 275 { "readdir", KSTAT_DATA_UINT64 }, 276 { "readdirplus", KSTAT_DATA_UINT64 }, 277 { "fsstat", KSTAT_DATA_UINT64 }, 278 { "fsinfo", KSTAT_DATA_UINT64 }, 279 { "pathconf", KSTAT_DATA_UINT64 }, 280 { "commit", KSTAT_DATA_UINT64 } 281 }; 282 283 /* 284 * NFSv3 client ACL stats 285 */ 286 static const kstat_named_t aclreqcnt_v3_tmpl[] = { 287 { "null", KSTAT_DATA_UINT64 }, 288 { "getacl", KSTAT_DATA_UINT64 }, 289 { "setacl", KSTAT_DATA_UINT64 }, 290 { "getxattrdir", KSTAT_DATA_UINT64 } 291 }; 292 293 static void 294 nfsstat_zone_init_aclreq_v3(zoneid_t zoneid, struct nfs_version_stats *statsp) 295 { 296 statsp->aclreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs_acl", 0, 297 "aclreqcnt_v3", aclreqcnt_v3_tmpl, sizeof (aclreqcnt_v3_tmpl)); 298 } 299 300 static void 301 nfsstat_zone_fini_aclreq_v3(zoneid_t zoneid, struct nfs_version_stats *statsp) 302 { 303 nfsstat_zone_fini_common(zoneid, "nfs_acl", 0, "aclreqcnt_v3"); 304 kmem_free(statsp->aclreqcnt_ptr, sizeof (aclreqcnt_v3_tmpl)); 305 } 306 307 /* 308 * NFSv3 server ACL stats 309 */ 310 static const kstat_named_t aclproccnt_v3_tmpl[] = { 311 { "null", KSTAT_DATA_UINT64 }, 312 { "getacl", KSTAT_DATA_UINT64 }, 313 { "setacl", KSTAT_DATA_UINT64 }, 314 { "getxattrdir", KSTAT_DATA_UINT64 } 315 }; 316 317 /* 318 * NFSv4 client stats 319 */ 320 static const kstat_named_t rfsreqcnt_v4_tmpl[] = { 321 { "null", KSTAT_DATA_UINT64 }, 322 { "compound", KSTAT_DATA_UINT64 }, 323 { "reserved", KSTAT_DATA_UINT64 }, 324 { "access", KSTAT_DATA_UINT64 }, 325 { "close", KSTAT_DATA_UINT64 }, 326 { "commit", KSTAT_DATA_UINT64 }, 327 { "create", KSTAT_DATA_UINT64 }, 328 { "delegpurge", KSTAT_DATA_UINT64 }, 329 { "delegreturn", KSTAT_DATA_UINT64 }, 330 { "getattr", KSTAT_DATA_UINT64 }, 331 { "getfh", KSTAT_DATA_UINT64 }, 332 { "link", KSTAT_DATA_UINT64 }, 333 { "lock", KSTAT_DATA_UINT64 }, 334 { "lockt", KSTAT_DATA_UINT64 }, 335 { "locku", KSTAT_DATA_UINT64 }, 336 { "lookup", KSTAT_DATA_UINT64 }, 337 { "lookupp", KSTAT_DATA_UINT64 }, 338 { "nverify", KSTAT_DATA_UINT64 }, 339 { "open", KSTAT_DATA_UINT64 }, 340 { "openattr", KSTAT_DATA_UINT64 }, 341 { "open_confirm", KSTAT_DATA_UINT64 }, 342 { "open_downgrade", KSTAT_DATA_UINT64 }, 343 { "putfh", KSTAT_DATA_UINT64 }, 344 { "putpubfh", KSTAT_DATA_UINT64 }, 345 { "putrootfh", KSTAT_DATA_UINT64 }, 346 { "read", KSTAT_DATA_UINT64 }, 347 { "readdir", KSTAT_DATA_UINT64 }, 348 { "readlink", KSTAT_DATA_UINT64 }, 349 { "remove", KSTAT_DATA_UINT64 }, 350 { "rename", KSTAT_DATA_UINT64 }, 351 { "renew", KSTAT_DATA_UINT64 }, 352 { "restorefh", KSTAT_DATA_UINT64 }, 353 { "savefh", KSTAT_DATA_UINT64 }, 354 { "secinfo", KSTAT_DATA_UINT64 }, 355 { "setattr", KSTAT_DATA_UINT64 }, 356 { "setclientid", KSTAT_DATA_UINT64 }, 357 { "setclientid_confirm", KSTAT_DATA_UINT64 }, 358 { "verify", KSTAT_DATA_UINT64 }, 359 { "write", KSTAT_DATA_UINT64 } 360 }; 361 362 static void 363 nfsstat_zone_init_rfsreq_v4(zoneid_t zoneid, struct nfs_version_stats *statsp) 364 { 365 statsp->rfsreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs", 0, 366 "rfsreqcnt_v4", rfsreqcnt_v4_tmpl, sizeof (rfsreqcnt_v4_tmpl)); 367 } 368 369 static void 370 nfsstat_zone_fini_rfsreq_v4(zoneid_t zoneid, struct nfs_version_stats *statsp) 371 { 372 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsreqcnt_v4"); 373 kmem_free(statsp->rfsreqcnt_ptr, sizeof (rfsreqcnt_v4_tmpl)); 374 } 375 376 /* 377 * NFSv4 server stats 378 */ 379 static const kstat_named_t rfsproccnt_v4_tmpl[] = { 380 { "null", KSTAT_DATA_UINT64 }, 381 { "compound", KSTAT_DATA_UINT64 }, 382 { "reserved", KSTAT_DATA_UINT64 }, 383 { "access", KSTAT_DATA_UINT64 }, 384 { "close", KSTAT_DATA_UINT64 }, 385 { "commit", KSTAT_DATA_UINT64 }, 386 { "create", KSTAT_DATA_UINT64 }, 387 { "delegpurge", KSTAT_DATA_UINT64 }, 388 { "delegreturn", KSTAT_DATA_UINT64 }, 389 { "getattr", KSTAT_DATA_UINT64 }, 390 { "getfh", KSTAT_DATA_UINT64 }, 391 { "link", KSTAT_DATA_UINT64 }, 392 { "lock", KSTAT_DATA_UINT64 }, 393 { "lockt", KSTAT_DATA_UINT64 }, 394 { "locku", KSTAT_DATA_UINT64 }, 395 { "lookup", KSTAT_DATA_UINT64 }, 396 { "lookupp", KSTAT_DATA_UINT64 }, 397 { "nverify", KSTAT_DATA_UINT64 }, 398 { "open", KSTAT_DATA_UINT64 }, 399 { "openattr", KSTAT_DATA_UINT64 }, 400 { "open_confirm", KSTAT_DATA_UINT64 }, 401 { "open_downgrade", KSTAT_DATA_UINT64 }, 402 { "putfh", KSTAT_DATA_UINT64 }, 403 { "putpubfh", KSTAT_DATA_UINT64 }, 404 { "putrootfh", KSTAT_DATA_UINT64 }, 405 { "read", KSTAT_DATA_UINT64 }, 406 { "readdir", KSTAT_DATA_UINT64 }, 407 { "readlink", KSTAT_DATA_UINT64 }, 408 { "remove", KSTAT_DATA_UINT64 }, 409 { "rename", KSTAT_DATA_UINT64 }, 410 { "renew", KSTAT_DATA_UINT64 }, 411 { "restorefh", KSTAT_DATA_UINT64 }, 412 { "savefh", KSTAT_DATA_UINT64 }, 413 { "secinfo", KSTAT_DATA_UINT64 }, 414 { "setattr", KSTAT_DATA_UINT64 }, 415 { "setclientid", KSTAT_DATA_UINT64 }, 416 { "setclientid_confirm", KSTAT_DATA_UINT64 }, 417 { "verify", KSTAT_DATA_UINT64 }, 418 { "write", KSTAT_DATA_UINT64 }, 419 { "release_lockowner", KSTAT_DATA_UINT64 }, 420 { "illegal", KSTAT_DATA_UINT64 }, 421 }; 422 423 /* 424 * NFSv4 client ACL stats 425 */ 426 static const kstat_named_t aclreqcnt_v4_tmpl[] = { 427 { "null", KSTAT_DATA_UINT64 }, 428 { "getacl", KSTAT_DATA_UINT64 }, 429 { "setacl", KSTAT_DATA_UINT64 }, 430 }; 431 432 static void 433 nfsstat_zone_init_aclreq_v4(zoneid_t zoneid, struct nfs_version_stats *statsp) 434 { 435 statsp->aclreqcnt_ptr = nfsstat_zone_init_common(zoneid, "nfs_acl", 0, 436 "aclreqcnt_v4", aclreqcnt_v4_tmpl, sizeof (aclreqcnt_v4_tmpl)); 437 } 438 439 static void 440 nfsstat_zone_fini_aclreq_v4(zoneid_t zoneid, struct nfs_version_stats *statsp) 441 { 442 nfsstat_zone_fini_common(zoneid, "nfs_acl", 0, "aclreqcnt_v4"); 443 kmem_free(statsp->aclreqcnt_ptr, sizeof (aclreqcnt_v4_tmpl)); 444 } 445 446 /* 447 * Zone initializer callback to setup the kstats. 448 */ 449 void * 450 nfsstat_zone_init(zoneid_t zoneid) 451 { 452 struct nfs_stats *nfs_stats_ptr; 453 454 nfs_stats_ptr = kmem_zalloc(sizeof (*nfs_stats_ptr), KM_SLEEP); 455 456 /* 457 * Initialize v2 stats 458 */ 459 nfsstat_zone_init_rfsreq_v2(zoneid, &nfs_stats_ptr->nfs_stats_v2); 460 nfsstat_zone_init_aclreq_v2(zoneid, &nfs_stats_ptr->nfs_stats_v2); 461 /* 462 * Initialize v3 stats 463 */ 464 nfsstat_zone_init_rfsreq_v3(zoneid, &nfs_stats_ptr->nfs_stats_v3); 465 nfsstat_zone_init_aclreq_v3(zoneid, &nfs_stats_ptr->nfs_stats_v3); 466 /* 467 * Initialize v4 stats 468 */ 469 nfsstat_zone_init_rfsreq_v4(zoneid, &nfs_stats_ptr->nfs_stats_v4); 470 nfsstat_zone_init_aclreq_v4(zoneid, &nfs_stats_ptr->nfs_stats_v4); 471 472 return (nfs_stats_ptr); 473 } 474 475 /* 476 * Zone destructor callback to tear down the various kstats. 477 */ 478 void 479 nfsstat_zone_fini(zoneid_t zoneid, void *data) 480 { 481 struct nfs_stats *nfs_stats_ptr = data; 482 483 /* 484 * Free v2 stats 485 */ 486 nfsstat_zone_fini_rfsreq_v2(zoneid, &nfs_stats_ptr->nfs_stats_v2); 487 nfsstat_zone_fini_aclreq_v2(zoneid, &nfs_stats_ptr->nfs_stats_v2); 488 /* 489 * Free v3 stats 490 */ 491 nfsstat_zone_fini_rfsreq_v3(zoneid, &nfs_stats_ptr->nfs_stats_v3); 492 nfsstat_zone_fini_aclreq_v3(zoneid, &nfs_stats_ptr->nfs_stats_v3); 493 /* 494 * Free v4 stats 495 */ 496 nfsstat_zone_fini_rfsreq_v4(zoneid, &nfs_stats_ptr->nfs_stats_v4); 497 nfsstat_zone_fini_aclreq_v4(zoneid, &nfs_stats_ptr->nfs_stats_v4); 498 499 kmem_free(nfs_stats_ptr, sizeof (*nfs_stats_ptr)); 500 } 501 502 void 503 rfs_stat_zone_init(nfs_globals_t *ng) 504 { 505 zoneid_t zoneid = ng->nfs_zoneid; 506 507 /* Initialize all versions of the nfs_server */ 508 nfsstat_zone_init_server(zoneid, ng->svstat); 509 510 /* NFS proc */ 511 ng->rfsproccnt[NFS_V2] = nfsstat_zone_init_common(zoneid, "nfs", 0, 512 "rfsproccnt_v2", rfsproccnt_v2_tmpl, sizeof (rfsproccnt_v2_tmpl)); 513 514 ng->rfsproccnt[NFS_V3] = nfsstat_zone_init_common(zoneid, "nfs", 0, 515 "rfsproccnt_v3", rfsproccnt_v3_tmpl, sizeof (rfsproccnt_v3_tmpl)); 516 517 ng->rfsproccnt[NFS_V4] = nfsstat_zone_init_common(zoneid, "nfs", 0, 518 "rfsproccnt_v4", rfsproccnt_v4_tmpl, sizeof (rfsproccnt_v4_tmpl)); 519 520 /* ACL proc */ 521 ng->aclproccnt[NFS_V2] = nfsstat_zone_init_common(zoneid, "nfs_acl", 0, 522 "aclproccnt_v2", aclproccnt_v2_tmpl, sizeof (aclproccnt_v2_tmpl)); 523 524 ng->aclproccnt[NFS_V3] = nfsstat_zone_init_common(zoneid, "nfs_acl", 0, 525 "aclproccnt_v3", aclproccnt_v3_tmpl, sizeof (aclproccnt_v3_tmpl)); 526 527 } 528 529 void 530 rfs_stat_zone_fini(nfs_globals_t *ng) 531 { 532 zoneid_t zoneid = ng->nfs_zoneid; 533 534 /* Free nfs:x:nfs_server stats */ 535 nfsstat_zone_fini_server(zoneid, ng->svstat); 536 537 /* NFS */ 538 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsproccnt_v2"); 539 kmem_free(ng->rfsproccnt[NFS_V2], sizeof (rfsproccnt_v2_tmpl)); 540 541 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsproccnt_v3"); 542 kmem_free(ng->rfsproccnt[NFS_V3], sizeof (rfsproccnt_v3_tmpl)); 543 544 nfsstat_zone_fini_common(zoneid, "nfs", 0, "rfsproccnt_v4"); 545 kmem_free(ng->rfsproccnt[NFS_V4], sizeof (rfsproccnt_v4_tmpl)); 546 547 /* ACL */ 548 nfsstat_zone_fini_common(zoneid, "nfs_acl", 0, "aclproccnt_v2"); 549 kmem_free(ng->aclproccnt[NFS_V2], sizeof (aclproccnt_v2_tmpl)); 550 551 nfsstat_zone_fini_common(zoneid, "nfs_acl", 0, "aclproccnt_v3"); 552 kmem_free(ng->aclproccnt[NFS_V3], sizeof (aclproccnt_v3_tmpl)); 553 554 } 555