MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zfs_log_remove

Function zfs_log_remove

freebsd/contrib/openzfs/module/zfs/zfs_log.c:414–444  ·  view source on GitHub ↗

* Handles both TX_REMOVE and TX_RMDIR transactions. */

Source from the content-addressed store, hash-verified

412 * Handles both TX_REMOVE and TX_RMDIR transactions.
413 */
414void
415zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
416 znode_t *dzp, const char *name, uint64_t foid, boolean_t unlinked)
417{
418 itx_t *itx;
419 lr_remove_t *lr;
420 size_t namesize = strlen(name) + 1;
421
422 if (zil_replaying(zilog, tx) || zfs_xattr_owner_unlinked(dzp))
423 return;
424
425 itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
426 lr = (lr_remove_t *)&itx->itx_lr;
427 lr->lr_doid = dzp->z_id;
428 bcopy(name, (char *)(lr + 1), namesize);
429
430 itx->itx_oid = foid;
431
432 /*
433 * Object ids can be re-instantiated in the next txg so
434 * remove any async transactions to avoid future leaks.
435 * This can happen if a fsync occurs on the re-instantiated
436 * object for a WR_INDIRECT or WR_NEED_COPY write, which gets
437 * the new file data and flushes a write record for the old object.
438 */
439 if (unlinked) {
440 ASSERT((txtype & ~TX_CI) == TX_REMOVE);
441 zil_remove_async(zilog, foid);
442 }
443 zil_itx_assign(zilog, itx, tx);
444}
445
446/*
447 * Handles TX_LINK transactions.

Callers 4

zfs_remove_Function · 0.85
zfs_rmdir_Function · 0.85
zfs_removeFunction · 0.85
zfs_rmdirFunction · 0.85

Calls 5

zil_replayingFunction · 0.85
zfs_xattr_owner_unlinkedFunction · 0.85
zil_itx_createFunction · 0.85
zil_remove_asyncFunction · 0.85
zil_itx_assignFunction · 0.85

Tested by

no test coverage detected