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 #if defined(USE_FOR_SNOOP) 27 %#include "ds_nfs_com.h" 28 %#include "ds_prot.h" 29 #else 30 #if defined(RPC_XDR) || defined(RPC_SVC) || defined(RPC_CLNT) 31 %#include <nfs/ds.h> 32 #endif 33 #endif 34 35 %#include <nfs/nfs41_fhtype.h> 36 37 const NFS_FH4MAXDATA = 26; 38 39 %#include <nfs/ds_filehandle.h> 40 41 /* 42 * Dot-x file for the data server control protocol. 43 */ 44 45 /* 46 * Control Protocol identifier 47 */ 48 typedef uint64_t ds_id; 49 typedef uint64_t ds_verifier; 50 51 enum ds_status { 52 DS_OK = 0, 53 DSERR_ACCESS, 54 DSERR_ATTR_NOTSUPP, 55 DSERR_BAD_COOKIE, 56 DSERR_BADHANDLE, 57 DSERR_BAD_MDSSID, 58 DSERR_BAD_STATEID, 59 DSERR_EXPIRED, 60 DSERR_FHEXPIRED, 61 DSERR_GRACE, 62 DSERR_INVAL, 63 DSERR_IO, 64 DSERR_NOENT, 65 DSERR_NOT_AUTH, 66 DSERR_NOSPC, 67 DSERR_NOTSUPP, 68 DSERR_OLD_STATEID, 69 DSERR_PNFS_NO_LAYOUT, 70 DSERR_RESOURCE, 71 DSERR_SERVERFAULT, 72 DSERR_STALE, 73 DSERR_STALE_CLIENTID, 74 DSERR_STALE_DSID, 75 DSERR_STALE_STATEID, 76 DSERR_TOOSMALL, 77 DSERR_WRONGSEC, 78 DSERR_XDR, 79 DSERR_ILLEGAL 80 }; 81 82 /* 83 * XXX: Note that the supported bits have yet to be defined 84 * and the size field would of course correspond to the 85 * file size. 86 */ 87 struct ds_attr { 88 int ds_attrmask; 89 uint64_t ds_size; 90 }; 91 92 struct identity { 93 ds_verifier boot_verifier; 94 opaque instance<MAXPATHLEN>; 95 }; 96 97 /* 98 * DS_EXIBI - Exchange Identity and Boot Instance 99 * 100 * ds_ident : An identiifier that the MDS can use to distinguish 101 * between data-server instances. 102 */ 103 struct DS_EXIBIargs { 104 identity ds_ident; 105 }; 106 107 /* 108 * ds_id : The 'short-hand' identifier for the DS (MDS assigned) 109 * 110 * mds_id : The 'short-hand' identifer for the MDS 111 * 112 * mds_boot_verifier: An identifier that the data-server can use to determine 113 * if an MDS has rebooted. 114 * 115 * mds_lease_period: A hint to the data-server on the lease period 116 * currently in effect at the MDS. 117 */ 118 struct DS_EXIBIresok { 119 ds_id ds_id; 120 ds_id mds_id; 121 ds_verifier mds_boot_verifier; 122 uint32_t mds_lease_period; 123 }; 124 125 union DS_EXIBIres switch (ds_status status) { 126 case DS_OK: 127 DS_EXIBIresok res_ok; 128 default: 129 void; 130 }; 131 132 /* 133 * DS_CHECKSTATEargs - 134 * 135 * The message from a DS that is asking for the presented file state 136 * to be verified. 137 * 138 * stateid: 139 * 140 * The stateid the client presented for the I/O. 141 * 142 * fh: 143 * 144 * File handle that the DS received in the compound (via PUTFH) 145 * from the client when the client performed I/O. 146 * 147 * co_owner: 148 * 149 * client owner (MUST be same as MDS client owner as per NFSv4.1) 150 * 151 * mode: READ or WRITE, needed for checking access mode. 152 */ 153 struct DS_CHECKSTATEargs { 154 stateid4 stateid; 155 nfs_fh4 fh; 156 client_owner4 co_owner; 157 int mode; 158 }; 159 160 /* 161 * ds_filestate - 162 * 163 * The reply to the DS from MDS that confirms the 164 * validity of the presented state. 165 * 166 * mds_clid: 167 * 168 * The MDS client id that corresponds to the presented stateid. 169 * 170 * layout: 171 * 172 * The layout of the file. This allows the DS 173 * to determine if the offset that the client is performing 174 * I/O to is valid based on the layout. 175 * 176 * open_mode: 177 * 178 * The effective open mode for the object + clientid, based on the 179 * mode open() mode and the export mode 180 * 181 */ 182 struct ds_filestate { 183 clientid4 mds_clid; 184 layout4 layout<>; 185 int open_mode; 186 }; 187 188 union DS_CHECKSTATEres switch (ds_status status) { 189 case DS_OK: 190 ds_filestate file_state; 191 default: 192 void; 193 }; 194 195 /* 196 * DS_FMATPT - 197 * 198 * A control protocol message that is used to transport FMA 199 * telemetry data to MDS. 200 * 201 * This is a placeholder for a post pNFS/Basic putback. 202 */ 203 struct DS_FMATPTargs { 204 opaque fma_msg<>; 205 }; 206 207 208 struct DS_FMATPTres { 209 ds_status status; 210 }; 211 212 /* 213 * DS_MAP_MDS_DATASET_ID 214 * 215 * For a given MDS Dataset ID at the MDS return the root path. 216 * 217 */ 218 struct DS_MAP_MDS_DATASET_IDargs { 219 mds_dataset_id mds_dataset_id; 220 }; 221 222 struct DS_MAP_MDS_DATASET_IDresok { 223 ds_status status; 224 utf8string pathname; 225 }; 226 227 union DS_MAP_MDS_DATASET_IDres switch (ds_status status) { 228 case DS_OK: 229 DS_MAP_MDS_DATASET_IDresok res_ok; 230 default: 231 void; 232 }; 233 234 /* 235 * DS_MAP_MDSSID 236 * 237 * Return a mapping for a given MDS Storage ID. 238 */ 239 struct DS_MAP_MDSSIDargs { 240 mds_sid mma_sid; 241 }; 242 243 enum storage_type { 244 ZFS = 1 245 }; 246 247 union ds_guid switch (storage_type stor_type) { 248 case ZFS: 249 opaque zfsguid<>; 250 default: 251 void; 252 }; 253 254 /* 255 * ds_guid_map - 256 * 257 * The mapping between the local data server guid value and the id-value 258 * assigned by the MDS for mapping. 259 * 260 * If the storage type is ZFS, encoded in the ds_guid will be 261 * a ds_zfsguid. Other storage types may have their own guid 262 * definition. 263 * 264 * Encoded in the mds_sid field will be an array of mds_sid_contents. 265 */ 266 struct ds_guid_map { 267 ds_guid ds_guid; 268 mds_sid mds_sid_array<>; 269 }; 270 271 struct DS_MAP_MDSSIDresok { 272 ds_guid_map guid_map; 273 }; 274 275 union DS_MAP_MDSSIDres switch (ds_status status) { 276 case DS_OK: 277 DS_MAP_MDSSIDresok res_ok; 278 default: 279 void; 280 }; 281 282 /* 283 * DS_RENEW - 284 * 285 * A message from the DS to MDS used to exchnage 286 * boot instances. This can be used to indicate to 287 * the MDS when a data server has rebooted, and 288 * also to the data-server when the MDS has rebooted. 289 * 290 * The data-server should drop all state when it 291 * detects that the MDS has rebooted. 292 * 293 * The MDS should drop any state that it believes 294 * the data-server is holding. 295 * 296 */ 297 struct DS_RENEWargs { 298 ds_id ds_id; 299 ds_verifier ds_boottime; 300 }; 301 302 union DS_RENEWres switch (ds_status status) { 303 case DS_OK: 304 ds_verifier mds_boottime; 305 default: 306 void; 307 }; 308 309 /* 310 * ds_zfsattr - 311 * 312 * Attribute that pertains to the zfs storage information/state etc. 313 * 314 * attrname: 315 * 316 * Name of attribute. 317 * 318 * attrvalue: 319 * 320 * Value of the attribute. 321 * 322 * Supported attributes: 323 * 324 * 325 * +----------+------------+----------------------------------------- 326 * | attrname | type | Description 327 * +----------+------------+----------------------------------------- 328 * | state | boolean | current status of pool: 0=offline, 329 * | | | 1=online 330 * +----------+------------+----------------------------------------- 331 * | size | uint64_t | bytes free on dataset. 332 * +----------+------------+----------------------------------------- 333 * | config | attrvalue: xxx - look at how zpool status 334 * | | displays the pool 335 * | | configuration. 336 * +----------+------------+----------------------------------------- 337 * | dataset | utf8string | hostname:root_pool/root_data_set 338 * +----------+------------+----------------------------------------- 339 */ 340 struct ds_zfsattr { 341 utf8string attrname; 342 opaque attrvalue<>; 343 }; 344 345 typedef uint32_t ds_addruse; 346 347 /* 348 * Intended usage for the addresses. 349 */ 350 const NFS = 0x00000001; 351 const DSERV = 0x00000002; 352 353 /* 354 * ds_addr - 355 * 356 * A structure that is used to specify an address and 357 * its usage. 358 * 359 * addr: 360 * 361 * The specific address on the DS. 362 * 363 * validuse: 364 * 365 * Bitmap associating the netaddr defined in "addr" 366 * to the protocols that are valid for that interface. 367 */ 368 struct ds_addr { 369 netaddr4 addr; 370 ds_addruse validuse; 371 }; 372 373 /* 374 * ds_zfsguid - 375 * 376 * The data server guid made up of the local zpool guid + dataset id 377 */ 378 struct ds_zfsguid { 379 uint64_t zpool_guid; 380 uint64_t dataset_guid; 381 }; 382 383 /* 384 * ds_zfsinfo - 385 * 386 * Contains all the attributes that pertain to the specified ZFS storage 387 * identifier. 388 * 389 * guid_map: 390 * 391 * Unique value identifying the pNFS dataset and the zpool it lives in. 392 * *Note: This has to be unique across all storage in our 393 * system. Meaning that we may have to generate ids 394 * which take into account the poolid assigned by the SPA 395 * and the DS that the pool belongs to. 396 * 397 * attrs: 398 * 399 * List of name value pairs corresponding to the attributes 400 * of the ZFS data store (e.g. zpool and dataset attribues). 401 * *Note: We may want to rethink how we are handling attributes. 402 * We should probably have some general attributes (e.g. 403 * online/offline, size, free_size). Then we can have 404 * attributes that are specific to the storage type (e.g. 405 * zpool configuration (e.g. mirrored, RAIDZ), 406 * dataset attributes (e.g. encryption, compression). 407 */ 408 struct ds_zfsinfo { 409 ds_guid_map guid_map; 410 ds_zfsattr attrs<>; 411 }; 412 413 /* 414 * ds_storinfo - 415 * 416 * Information about the storage available to the data server. 417 * Currently, the only storage type is ZFS, but there may be others 418 * in the future. 419 */ 420 union ds_storinfo switch (storage_type type) { 421 case ZFS: 422 ds_zfsinfo zfs_info; 423 default: 424 void; 425 }; 426 427 enum ds_attr_version { 428 DS_ATTR_v1 = 1 429 }; 430 431 /* 432 * DS_REPORTAVAILargs - 433 * 434 * A message to the MDS from a DS to provide availability 435 * information for storage pools and network interfaces. 436 * 437 * ds_id: 438 * 439 * The short-hand idenifier assigned by the MDS and returned 440 * in the DS_EXIBI reply. 441 * 442 * ds_addrs: 443 * 444 * An array of DS_addr associated with DS and information 445 * about the intended use of each address; Specified as 446 * an array since it is possible for a DS to have multiple 447 * interfaces available. 448 * 449 * ds_attrvers: 450 * 451 * Version indicating the set of attributes that the data server is 452 * aware of/supports. (XXX - This may change to a supported attrs bitmask). 453 * 454 * ds_storinfo: 455 * 456 * Array of storage information. For each piece of storage there will 457 * be one entry in this array. 458 */ 459 struct DS_REPORTAVAILargs { 460 ds_id ds_id; 461 ds_verifier ds_verifier; 462 struct ds_addr ds_addrs<>; 463 ds_attr_version ds_attrvers; 464 ds_storinfo ds_storinfo<>; 465 }; 466 467 /* 468 * DS_REPORTAVAILres_ok - 469 * 470 * Response from the MDS on a successful DS_REPORTAVAIL call. 471 * 472 * ds_attrvers: 473 * 474 * Version indicating the set of attributes that the metadata server is 475 * aware of/supports. (XXX - This may change to a supported attrs bitmask). 476 * 477 * guid_map: 478 * 479 * Map of data server guids to Metadata Server Storage IDs (MDS SIDs) 480 */ 481 struct DS_REPORTAVAILresok { 482 ds_attr_version ds_attrvers; 483 ds_guid_map guid_map<>; 484 }; 485 486 union DS_REPORTAVAILres switch (ds_status status) { 487 case DS_OK: 488 DS_REPORTAVAILresok res_ok; 489 default: 490 void; 491 }; 492 493 /* 494 * DS_SECINFO - 495 * 496 * A message from the DS to MDS used to inquire 497 * for the secrity flavors of an object. 498 * 499 */ 500 struct DS_SECINFOargs { 501 nfs_fh4 object; 502 netaddr4 cl_addr; 503 }; 504 505 /* RPCSEC_GSS has a value of '6' - See RFC 2203 */ 506 union ds_secinfo switch (uint32_t flavor) { 507 case RPCSEC_GSS: 508 rpcsec_gss_info flavor_info; 509 default: 510 void; 511 }; 512 513 typedef ds_secinfo DS_SECINFOresok<>; 514 515 union DS_SECINFOres switch (ds_status status) { 516 case DS_OK: 517 DS_SECINFOresok res_ok; 518 default: 519 void; 520 }; 521 522 /* 523 * DS_SHUTDOWN - 524 * 525 * A notification to the MDS that this Data Server has/is in 526 * the process of a graceful shutdown. 527 * 528 */ 529 struct DS_SHUTDOWNargs { 530 ds_id ds_id; 531 }; 532 533 534 struct DS_SHUTDOWNres { 535 ds_status status; 536 }; 537 538 program PNFSCTLDS { 539 version PNFSCTLDS_V1 { 540 void 541 DSPROC_NULL(void) = 0; 542 543 DS_CHECKSTATEres 544 DS_CHECKSTATE(DS_CHECKSTATEargs) = 1; 545 546 DS_EXIBIres 547 DS_EXIBI(DS_EXIBIargs) = 2; 548 549 DS_FMATPTres 550 DS_FMATPT(DS_FMATPTargs) = 3; 551 552 DS_MAP_MDS_DATASET_IDres 553 DS_MAP_MDS_DATASET_ID(DS_MAP_MDS_DATASET_IDargs) = 4; 554 555 DS_MAP_MDSSIDres 556 DS_MAP_MDSSID(DS_MAP_MDSSIDargs) = 5; 557 558 DS_RENEWres 559 DS_RENEW(DS_RENEWargs) = 6; 560 561 DS_REPORTAVAILres 562 DS_REPORTAVAIL(DS_REPORTAVAILargs) = 7; 563 564 DS_SECINFOres 565 DS_SECINFO(DS_SECINFOargs) = 8; 566 567 DS_SHUTDOWNres 568 DS_SHUTDOWN(DS_SHUTDOWNargs) = 9; 569 } = 1; 570 } = 104001; 571 572 573 /* 574 * NFS MDS Control Protocol: 575 * 576 * Traffic flows from the MDS to the data-server 577 */ 578 579 struct ds_filesegbuf { 580 offset4 offset; 581 opaque data<>; 582 }; 583 584 struct ds_fileseg { 585 offset4 offset; 586 count4 count; 587 }; 588 589 590 /* 591 * DS_COMMIT: 592 * 593 * Commit a range written to a data-server. 594 * 595 */ 596 struct DS_COMMITargs { 597 nfs_fh4 fh; 598 ds_fileseg cmv<>; 599 }; 600 601 struct DS_COMMITresok { 602 ds_verifier writeverf; 603 count4 count<>; 604 }; 605 606 union DS_COMMITres switch (ds_status status) { 607 case DS_OK: 608 DS_COMMITresok res_ok; 609 default: 610 void; 611 }; 612 613 /* 614 * DS_GETATTR: 615 * 616 * Query data-server for attributes for the specified object. 617 * 618 * fh: 619 * 620 * The file handle for the object for which the DS 621 * is to give attributes for. 622 * 623 * dattr: 624 * 625 * Bitmap of attributes. 626 */ 627 struct DS_GETATTRargs { 628 nfs_fh4 fh; 629 ds_attr dattrs; 630 }; 631 632 union DS_GETATTRres switch (ds_status status) { 633 case DS_OK: 634 ds_attr dattrs; 635 default: 636 void; 637 }; 638 639 /* 640 * DS_INVALIDATE: 641 * 642 * Invalidate state at the data-server. 643 * 644 * The scope of invalidation is dependent on object type. 645 * 646 * type: 647 * 648 * represents the type (and by virtue scope) of state invalidation 649 * that should occur at the DS. 650 * 651 * Examples of when the different invalidate types will be used are as follows: 652 * DS_INVALIDATE_ALL - Used on nfs/server service offlined on the MDS 653 * DS_INVALIDATE_CLIENTID - Used on client lease (with the MDS) expiration 654 * DS_INVALIDATE_LAYOUT_BY_CLIENT - Used on LAYOUTRETURN when 655 * invalidating all layouts held by a client 656 * DS_INVALIDATE_LAYOUT_BY_FH - Used on REMOVE issued from client to MDS 657 * DS_INVALIDATE_LAYOUT_BY_STATEID - Used on LAYOUTRETURN when 658 * invalidating a specific layout held by a client 659 * DS_INVALIDATE_MDS_DATASET_ID - Used on unshare of MDS FS 660 * DS_INVALIDATE_STATEID - Used on CLOSE, UNLOCK, DELEGRETURN issued from 661 * client to MDS 662 */ 663 enum ds_invalidate_type { 664 DS_INVALIDATE_ALL, 665 DS_INVALIDATE_CLIENTID, 666 DS_INVALIDATE_LAYOUT_BY_CLIENT, 667 DS_INVALIDATE_LAYOUT_BY_FH, 668 DS_INVALIDATE_LAYOUT_BY_STATEID, 669 DS_INVALIDATE_MDS_DATASET_ID, 670 DS_INVALIDATE_STATEID 671 }; 672 673 struct ds_inval_layout_by_clid { 674 clientid4 mds_clid; 675 nfs_fh4 fh; 676 }; 677 678 struct ds_inval_layout_by_lo_stateid { 679 stateid4 layout_stateid; /* MUST be layout stateid */ 680 nfs_fh4 fh; 681 }; 682 683 struct ds_inval_stateid { 684 stateid4 stateid; /* MUST be open, lock or delegation stateid */ 685 nfs_fh4 fh; 686 }; 687 688 union DS_INVALIDATEargs switch (ds_invalidate_type obj) { 689 690 case DS_INVALIDATE_ALL: 691 void; 692 693 case DS_INVALIDATE_CLIENTID: 694 clientid4 clid; 695 696 case DS_INVALIDATE_LAYOUT_BY_CLIENT: 697 ds_inval_layout_by_clid layout; 698 699 case DS_INVALIDATE_LAYOUT_BY_FH: 700 nfs_fh4 fh; 701 702 case DS_INVALIDATE_LAYOUT_BY_STATEID: 703 ds_inval_layout_by_lo_stateid lo_stateid; 704 705 case DS_INVALIDATE_MDS_DATASET_ID: 706 mds_dataset_id dataset_id; 707 708 case DS_INVALIDATE_STATEID: 709 ds_inval_stateid stateid; 710 }; 711 712 struct DS_INVALIDATEres { 713 ds_status status; 714 }; 715 716 /* 717 * DS_LIST: 718 * 719 * Get a list of objects from the data-server matching provided 720 * criteria. (either mds_dataset_id or mds_sid) 721 */ 722 enum ds_list_type { 723 DS_LIST_MDS_SID, 724 DS_LIST_MDS_DATASET_ID 725 }; 726 727 struct ds_list_sid_arg { 728 mds_sid mds_sid; 729 uint64_t cookie; 730 count4 maxcount; 731 }; 732 733 struct ds_list_dataset_arg { 734 mds_dataset_id dataset_id; 735 uint64_t cookie; 736 count4 maxcount; 737 }; 738 739 union DS_LISTargs switch (ds_list_type dla_type) { 740 case DS_LIST_MDS_SID: 741 ds_list_sid_arg sid; 742 743 case DS_LIST_MDS_DATASET_ID: 744 ds_list_dataset_arg dataset_id; 745 746 default: 747 void; 748 }; 749 750 struct DS_LISTresok { 751 nfs_fh4 fh_list<>; 752 uint64_t cookie; 753 }; 754 755 union DS_LISTres switch (ds_status status) { 756 case DS_OK: 757 DS_LISTresok res_ok; 758 default: 759 void; 760 }; 761 762 /* 763 * MDS to DS - Data movement initiation messages 764 */ 765 struct DS_OBJ_MOVEargs { 766 uint64_t taskid; 767 nfs_fh4 source; 768 nfs_fh4 target; 769 netaddr4 targetserver; 770 }; 771 772 struct DS_OBJ_MOVEres { 773 ds_status status; 774 }; 775 776 struct DS_OBJ_MOVE_STATUSargs { 777 uint64_t taskid; 778 }; 779 780 struct DS_OBJ_MOVE_STATUSresok { 781 uint64_t maxoffset; 782 bool complete; 783 }; 784 785 union DS_OBJ_MOVE_STATUSres switch (ds_status status) { 786 case DS_OK: 787 DS_OBJ_MOVE_STATUSresok res_ok; 788 default: 789 void; 790 }; 791 792 struct DS_OBJ_MOVE_ABORTargs { 793 uint64_t taskid; 794 }; 795 796 struct DS_OBJ_MOVE_ABORTres { 797 ds_status status; 798 }; 799 800 /* 801 * DS_PNFSSTAT 802 * 803 * Return the kstat counters. 804 * 805 */ 806 807 /* RPC kstats */ 808 const DS_NFSSTAT_RPC = 0x000000001; 809 810 /* NFS kstats */ 811 const DS_NFSSTAT_NFS = 0x000000002; 812 813 /* the DMOV protocol kstats */ 814 const DS_NFSSTAT_DMOV = 0x000000004; 815 816 /* the control protocol kstats */ 817 const DS_NFSSTAT_CP = 0x000000008; 818 819 /* CPU kstat (all stats for module cpu)*/ 820 const DS_NFSSTAT_CPU = 0x000000010; 821 822 /* 823 * More anticipated ... 824 */ 825 struct DS_PNFSSTATargs { 826 uint64_t stat_wanted; 827 }; 828 829 struct DS_PNFSSTATresok { 830 opaque nvlist<>; 831 }; 832 833 union DS_PNFSSTATres switch (ds_status status) { 834 case DS_OK: 835 DS_PNFSSTATresok res_ok; 836 default: 837 void; 838 }; 839 840 /* 841 * DS_READ: 842 * 843 * Read a range of bytes from a data-server 844 */ 845 struct DS_READargs { 846 nfs_fh4 fh; 847 count4 count; 848 ds_fileseg rdv<>; 849 }; 850 851 struct DS_READresok { 852 bool eof; 853 count4 count; 854 ds_filesegbuf rdv<>; 855 }; 856 857 union DS_READres switch (ds_status status) { 858 case DS_OK: 859 DS_READresok res_ok; 860 default: 861 void; 862 }; 863 864 %/* 865 % * CTL_MDS_REMOVE: 866 % * 867 % * Sent from MDS to DS to remove object(s) or entire fsid at the data-server 868 % * 869 % */ 870 enum ctl_mds_rm_type { 871 CTL_MDS_RM_OBJ, 872 CTL_MDS_RM_MDS_DATASET_ID 873 }; 874 875 struct ctl_mds_remove_mds_dataset_id { 876 mds_sid mds_sid; 877 mds_dataset_id dataset_id<>; 878 }; 879 880 union CTL_MDS_REMOVEargs switch (ctl_mds_rm_type type) { 881 case CTL_MDS_RM_OBJ: 882 nfs_fh4 obj<>; 883 case CTL_MDS_RM_MDS_DATASET_ID: 884 ctl_mds_remove_mds_dataset_id dataset_info; 885 default: 886 void; 887 }; 888 889 struct CTL_MDS_REMOVEres { 890 ds_status status; 891 }; 892 893 /* 894 * DS_SETATTR: 895 * 896 * Set/Store attributes for the specified object 897 * at the data-server 898 * 899 * fh: 900 * 901 * The file handle for the object for which the DS 902 * is to set attributes for. 903 * 904 * dattrs: 905 * 906 * Bitmap of attributes. 907 */ 908 struct DS_SETATTRargs { 909 nfs_fh4 fh; 910 ds_attr dattrs; 911 }; 912 913 struct DS_SETATTRres { 914 ds_status status; 915 }; 916 917 /* 918 * DS_SNAP 919 * 920 * For a given MDS Dataset ID at the MDS, snapshot the data-set. 921 * 922 */ 923 struct DS_SNAPargs { 924 mds_dataset_id dataset_id; 925 }; 926 927 struct DS_SNAPresok { 928 utf8string name; 929 }; 930 931 union DS_SNAPres switch (ds_status status) { 932 case DS_OK: 933 DS_SNAPresok res_ok; 934 default: 935 void; 936 }; 937 938 /* 939 * DS_STAT: 940 * 941 * Collect statistics for the status of an object, 942 * like size etc.. 943 * 944 */ 945 struct DS_STATargs { 946 nfs_fh4 object; 947 }; 948 949 950 union DS_STATres switch (ds_status status) { 951 case DS_OK: 952 ds_attr dattr; 953 default: 954 void; 955 }; 956 957 /* 958 * DS_WRITE: 959 * 960 * Write a range of bytes to a data-server 961 * 962 */ 963 struct DS_WRITEargs { 964 nfs_fh4 fh; 965 stable_how4 stable; 966 count4 count; 967 ds_filesegbuf wrv<>; 968 }; 969 970 struct DS_WRITEresok { 971 stable_how4 committed; 972 ds_verifier writeverf; 973 count4 wrv<>; 974 }; 975 976 union DS_WRITEres switch (ds_status status) { 977 case DS_OK: 978 DS_WRITEresok res_ok; 979 default: 980 void; 981 }; 982 983 %/* 984 % * The PNFS_CTL_MDS RPC program defines the control protocol messages that 985 % * are sent from the MDS to the DS. 986 % */ 987 program PNFS_CTL_MDS { 988 version PNFS_CTL_MDS_V1 { 989 990 void 991 DSPROC_NULL(void) = 0; 992 993 DS_COMMITres 994 DS_COMMIT(DS_COMMITargs) = 1; 995 996 DS_GETATTRres 997 DS_GETATTR(DS_GETATTRargs) = 2; 998 999 DS_INVALIDATEres 1000 DS_INVALIDATE(DS_INVALIDATEargs) = 3; 1001 1002 DS_LISTres 1003 DS_LIST(DS_LISTargs) = 4; 1004 1005 DS_OBJ_MOVEres 1006 DS_OBJ_MOVE(DS_OBJ_MOVEargs) = 5; 1007 1008 DS_OBJ_MOVE_ABORTres 1009 DS_OBJ_MOVE_ABORT(DS_OBJ_MOVE_ABORTargs) = 6; 1010 1011 DS_OBJ_MOVE_STATUSres 1012 DS_OBJ_MOVE_STATUS(DS_OBJ_MOVE_STATUSargs) = 7; 1013 1014 DS_PNFSSTATres 1015 DS_PNFSSTAT(DS_PNFSSTATargs) = 8; 1016 1017 DS_READres 1018 DS_READ(DS_READargs) = 9; 1019 1020 CTL_MDS_REMOVEres 1021 CTL_MDS_REMOVE(CTL_MDS_REMOVEargs) = 10; 1022 1023 DS_SETATTRres 1024 DS_SETATTR(DS_SETATTRargs) = 11; 1025 1026 DS_STATres 1027 DS_STAT(DS_STATargs) = 12; 1028 1029 DS_SNAPres 1030 DS_SNAP(DS_SNAPargs) = 13; 1031 1032 DS_WRITEres 1033 DS_WRITE(DS_WRITEargs) = 14; 1034 1035 } = 1; 1036 } = 104000; 1037 1038 /* 1039 * DS to DS data movement protocol. 1040 */ 1041 1042 struct MOVEargs { 1043 uint64_t taskid; 1044 uint64_t minoffset; 1045 uint64_t maxoffset; 1046 uint32_t maxbytes; 1047 }; 1048 1049 struct MOVEsegment { 1050 uint64_t fileoffset; 1051 uint32_t len; 1052 }; 1053 1054 struct MOVEresok { 1055 opaque data<>; 1056 struct MOVEsegment segments<>; 1057 }; 1058 1059 union MOVEres switch (ds_status status) { 1060 case DS_OK: 1061 MOVEresok res_ok; 1062 default: 1063 void; 1064 }; 1065 1066 program PNFSCTLMV { 1067 version PNFSCTLMV_V1 { 1068 void 1069 DSPROC_NULL(void) = 0; 1070 1071 MOVEres 1072 MOVE(MOVEargs) = 1; 1073 } = 1; 1074 } = 104002; 1075