Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_log.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_log.c
↓ open down ↓ 203 lines elided ↑ open up ↑
 204  204                          bcopy((void *)zdomain->z_domain, start,
 205  205                              strlen(zdomain->z_domain) + 1);
 206  206                          start = (caddr_t)start +
 207  207                              strlen(zdomain->z_domain) + 1;
 208  208                  }
 209  209          }
 210  210          return (start);
 211  211  }
 212  212  
 213  213  /*
 214      - * zfs_log_create() is used to handle TX_CREATE, TX_CREATE_ATTR, TX_MKDIR,
 215      - * TX_MKDIR_ATTR and TX_MKXATTR
 216      - * transactions.
      214 + * Handles TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, TX_MKDIR_ATTR and
      215 + * TK_MKXATTR transactions.
 217  216   *
 218  217   * TX_CREATE and TX_MKDIR are standard creates, but they may have FUID
 219  218   * domain information appended prior to the name.  In this case the
 220  219   * uid/gid in the log record will be a log centric FUID.
 221  220   *
 222  221   * TX_CREATE_ACL_ATTR and TX_MKDIR_ACL_ATTR handle special creates that
 223  222   * may contain attributes, ACL and optional fuid information.
 224  223   *
 225  224   * TX_CREATE_ACL and TX_MKDIR_ACL handle special creates that specify
 226  225   * and ACL and normal users/groups in the ACEs.
↓ open down ↓ 106 lines elided ↑ open up ↑
 333  332          }
 334  333          /*
 335  334           * Now place file name in log record
 336  335           */
 337  336          bcopy(name, end, namesize);
 338  337  
 339  338          zil_itx_assign(zilog, itx, tx);
 340  339  }
 341  340  
 342  341  /*
 343      - * zfs_log_remove() handles both TX_REMOVE and TX_RMDIR transactions.
      342 + * Handles both TX_REMOVE and TX_RMDIR transactions.
 344  343   */
 345  344  void
 346  345  zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
 347  346          znode_t *dzp, char *name, uint64_t foid)
 348  347  {
 349  348          itx_t *itx;
 350  349          lr_remove_t *lr;
 351  350          size_t namesize = strlen(name) + 1;
 352  351  
 353  352          if (zil_replaying(zilog, tx))
↓ open down ↓ 3 lines elided ↑ open up ↑
 357  356          lr = (lr_remove_t *)&itx->itx_lr;
 358  357          lr->lr_doid = dzp->z_id;
 359  358          bcopy(name, (char *)(lr + 1), namesize);
 360  359  
 361  360          itx->itx_oid = foid;
 362  361  
 363  362          zil_itx_assign(zilog, itx, tx);
 364  363  }
 365  364  
 366  365  /*
 367      - * zfs_log_link() handles TX_LINK transactions.
      366 + * Handles TX_LINK transactions.
 368  367   */
 369  368  void
 370  369  zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
 371  370          znode_t *dzp, znode_t *zp, char *name)
 372  371  {
 373  372          itx_t *itx;
 374  373          lr_link_t *lr;
 375  374          size_t namesize = strlen(name) + 1;
 376  375  
 377  376          if (zil_replaying(zilog, tx))
↓ open down ↓ 2 lines elided ↑ open up ↑
 380  379          itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
 381  380          lr = (lr_link_t *)&itx->itx_lr;
 382  381          lr->lr_doid = dzp->z_id;
 383  382          lr->lr_link_obj = zp->z_id;
 384  383          bcopy(name, (char *)(lr + 1), namesize);
 385  384  
 386  385          zil_itx_assign(zilog, itx, tx);
 387  386  }
 388  387  
 389  388  /*
 390      - * zfs_log_symlink() handles TX_SYMLINK transactions.
      389 + * Handles TX_SYMLINK transactions.
 391  390   */
 392  391  void
 393  392  zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
 394  393      znode_t *dzp, znode_t *zp, char *name, char *link)
 395  394  {
 396  395          itx_t *itx;
 397  396          lr_create_t *lr;
 398  397          size_t namesize = strlen(name) + 1;
 399  398          size_t linksize = strlen(link) + 1;
 400  399  
↓ open down ↓ 11 lines elided ↑ open up ↑
 412  411              sizeof (uint64_t));
 413  412          (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(zp->z_zfsvfs),
 414  413              lr->lr_crtime, sizeof (uint64_t) * 2);
 415  414          bcopy(name, (char *)(lr + 1), namesize);
 416  415          bcopy(link, (char *)(lr + 1) + namesize, linksize);
 417  416  
 418  417          zil_itx_assign(zilog, itx, tx);
 419  418  }
 420  419  
 421  420  /*
 422      - * zfs_log_rename() handles TX_RENAME transactions.
      421 + * Handles TX_RENAME transactions.
 423  422   */
 424  423  void
 425  424  zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
 426  425          znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp)
 427  426  {
 428  427          itx_t *itx;
 429  428          lr_rename_t *lr;
 430  429          size_t snamesize = strlen(sname) + 1;
 431  430          size_t dnamesize = strlen(dname) + 1;
 432  431  
↓ open down ↓ 5 lines elided ↑ open up ↑
 438  437          lr->lr_sdoid = sdzp->z_id;
 439  438          lr->lr_tdoid = tdzp->z_id;
 440  439          bcopy(sname, (char *)(lr + 1), snamesize);
 441  440          bcopy(dname, (char *)(lr + 1) + snamesize, dnamesize);
 442  441          itx->itx_oid = szp->z_id;
 443  442  
 444  443          zil_itx_assign(zilog, itx, tx);
 445  444  }
 446  445  
 447  446  /*
 448      - * zfs_log_write() handles TX_WRITE transactions.
      447 + * Handles TX_WRITE transactions.
 449  448   */
 450  449  ssize_t zfs_immediate_write_sz = 32768;
 451  450  
 452  451  void
 453  452  zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
 454  453          znode_t *zp, offset_t off, ssize_t resid, int ioflag)
 455  454  {
 456  455          itx_wr_state_t write_state;
 457  456          boolean_t slogging;
 458  457          uintptr_t fsync_cnt;
↓ open down ↓ 58 lines elided ↑ open up ↑
 517  516                          itx->itx_sync = B_FALSE;
 518  517  
 519  518                  zil_itx_assign(zilog, itx, tx);
 520  519  
 521  520                  off += len;
 522  521                  resid -= len;
 523  522          }
 524  523  }
 525  524  
 526  525  /*
 527      - * zfs_log_truncate() handles TX_TRUNCATE transactions.
      526 + * Handles TX_TRUNCATE transactions.
 528  527   */
 529  528  void
 530  529  zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
 531  530          znode_t *zp, uint64_t off, uint64_t len)
 532  531  {
 533  532          itx_t *itx;
 534  533          lr_truncate_t *lr;
 535  534  
 536  535          if (zil_replaying(zilog, tx) || zp->z_unlinked)
 537  536                  return;
↓ open down ↓ 2 lines elided ↑ open up ↑
 540  539          lr = (lr_truncate_t *)&itx->itx_lr;
 541  540          lr->lr_foid = zp->z_id;
 542  541          lr->lr_offset = off;
 543  542          lr->lr_length = len;
 544  543  
 545  544          itx->itx_sync = (zp->z_sync_cnt != 0);
 546  545          zil_itx_assign(zilog, itx, tx);
 547  546  }
 548  547  
 549  548  /*
 550      - * zfs_log_setattr() handles TX_SETATTR transactions.
      549 + * Handles TX_SETATTR transactions.
 551  550   */
 552  551  void
 553  552  zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
 554  553          znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp)
 555  554  {
 556  555          itx_t           *itx;
 557  556          lr_setattr_t    *lr;
 558  557          xvattr_t        *xvap = (xvattr_t *)vap;
 559  558          size_t          recsize = sizeof (lr_setattr_t);
 560  559          void            *start;
↓ open down ↓ 41 lines elided ↑ open up ↑
 602  601           */
 603  602  
 604  603          if (fuidp)
 605  604                  (void) zfs_log_fuid_domains(fuidp, start);
 606  605  
 607  606          itx->itx_sync = (zp->z_sync_cnt != 0);
 608  607          zil_itx_assign(zilog, itx, tx);
 609  608  }
 610  609  
 611  610  /*
 612      - * zfs_log_acl() handles TX_ACL transactions.
      611 + * Handles TX_ACL transactions.
 613  612   */
 614  613  void
 615  614  zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
 616  615      vsecattr_t *vsecp, zfs_fuid_info_t *fuidp)
 617  616  {
 618  617          itx_t *itx;
 619  618          lr_acl_v0_t *lrv0;
 620  619          lr_acl_t *lr;
 621  620          int txtype;
 622  621          int lrsize;
↓ open down ↓ 53 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX